jackh726 / bigtools

A high-performance BigWig and BigBed library in Rust
MIT License
70 stars 7 forks source link

bigwigaverageoverbed: optionally allow execution to continue after: `The passed chromosome (X) was incorrect` #53

Open ghuls opened 1 month ago

ghuls commented 1 month ago

bigwigaverageoverbed and the python equivalent give The passed chromosome (X) was incorrect. when a chromosome name was not found. UCSC Kent bigWigAverageOverBed does not do that.

It would be nice if there would atleast be an option to disable this error message and return NaN for those regions. bigWigs don't store chromosome names in the chromosome tree if there is no entry at all for that chromosome, even if that chromosome was in the chromosome sizes file that was used to create the bigWig.

$ cat test.bed
chr1       100000  110000  region1
chr22       100000  110000  region2

$ bigWigAverageOverBed test.bw test.bed bigWigAverageOverBed.bwaob

$ bigwigaverageoverbed test.bw test.bed bigwigaverageoverbed.bwaob
The passed chromosome (chr22) was incorrect.

$ head bigWigAverageOverBed.bwaob bigwigaverageoverbed.bwaob
==> bigWigAverageOverBed.bwaob <==
region1 10000   272     5.98266 0.000598266     0.0219951
region2 10000   0       0       0       0

==> bigwigaverageoverbed.bwaob <==
region1 10000   272     5.983   0.001   0.022
jackh726 commented 1 week ago

This is mostly fixed with v0.5.3 that I just published. However, I'm realizing that size will be printed as 0, not end-start. Just pushed this fix and it'll be in the next release.