deeptools / pyBigWig

A python extension for quick access to bigWig and bigBed files
MIT License
212 stars 48 forks source link

File with incorrect header information read as empty #111

Closed dkoes closed 3 years ago

dkoes commented 3 years ago

I am trying to read this 596M file: https://noble.gs.washington.edu/proj/segway/2011/bigWig/GATA1.K562.rawSignal.hg18.bw The header is not filled out and starting with 0.3.5 this makes the values inaccessible.

bw = pyBigWig.open('GATA1.K562.rawSignal.hg18.bw') 
print(bw.values('chr10',1000000,1500000))
bw.header()

Output:

[]
{'version': 1,
 'nLevels': 10,
 'nBasesCovered': 0,
 'minVal': 0,
 'maxVal': 0,
 'sumData': 0,
 'sumSquared': 0}

I suspect the issues is in commit 3b9b9a0da39b1bee1532c70094e0f1537dbfafd2 at line 376 of libBigWig/bwRead.c

dpryan79 commented 3 years ago

@dkoes Sorry for the delay, I'll take a look at this now.

dpryan79 commented 3 years ago

Indeed, I hadn't thought about a bigWig with the summary being incorrect but the remainder being valid. I'll need to come up with a way to handle this that won't result in any change in handling actually empty files. Do you happen to know how that file was generated?

dkoes commented 3 years ago

Unfortunately, I don't know anything about these files - they are a little old but were supplementary information to a paper we were looking at. Thanks for the quick fix!

dpryan79 commented 3 years ago

This should now be fixed in version 0.3.18. Thanks for bringing this to my attention!