deeptools / pyBigWig

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

Mismatch in the magic number when trying to open bigwig file to fix chromosome names #105

Closed WimSpee closed 4 years ago

WimSpee commented 4 years ago

Hi,

I am trying to use pyBigWig to fix chromosome names as described in this Biostar answer.

https://www.biostars.org/p/322341/

This results in the following error.

python fix_big_chr_name.py  rename_chr.txt  input.bw output.bw
[readRTreeIdx] Mismatch in the magic number!
[bwOpen] bwg->idx is NULL bwg->hdr->dataOffset 0x259!
[pyBwOpen] bw is NULL!
Traceback (most recent call last):
  File "fix_big_chr_name.py", line 21, in <module>
    bw = pyBigWig.open(args.input)
RuntimeError: Received an error during file opening!

Is there a way to fix this, or at least to make if the input.bw file is correct?

Thank you.

dpryan79 commented 4 years ago

Are you sure args.input is actually a bigWig file? What does file input.bw return?

WimSpee commented 4 years ago

Hi Devon,

It turned out that the input file was corrupted by copying over a slow network connection. I recopied the file and then the renaming of the chromosomes via pyBigWig worked as expected. And I could finally load the file in our genome browser.

Thank you for the pyBigWig tool/library.