igvteam / igv.js

Embeddable genomic visualization component based on the Integrative Genomics Viewer
MIT License
641 stars 229 forks source link

bigWig reader possible constant typo #786

Closed romgrk closed 4 years ago

romgrk commented 5 years ago

https://github.com/igvteam/igv.js/blob/e6b71982f61e96a1f14697379ba13708a41977ea/js/bigwig/bwReader.js#L34-L35

Is it possible that BIGWIG_MAGIC_HTL last byte should rather be 0x88?

jrobinso commented 5 years ago

Yes, its possible, do you have a big-endian bigwig? A small example would be good for the unit tests.

romgrk commented 5 years ago

No, just reading through the source, I don't have any available :/

jrobinso commented 5 years ago

I've never seen one. I'm not sure how you would create one, on a PC maybe? Those constants were copied from the original (Jim Kent's) "c" code, but there could have been a mistake of course.

romgrk commented 5 years ago

Probably on a big-endian machine, it wouldn't be OS dependent (I think). Sucks that the format didn't pick little-endian only :/

Kent's code defines only the little-endian magic and does the swapping with code, so it must have been swapped incorrectly when rewriting it.

jrobinso commented 5 years ago

OK well if you encounter one or have a test case let me know. Otherwise, I don't know what to do with this issue.