bedgraph to bigwig to bedgraph not working properly
I've always wanted to use this executable instead of Kent's bedGraphToBigWig for several reasons, but probably the main one would be to avoid uncompressing the bedgraph file, which is a major limitation when dealing with big bam/cram files. Unfortunately, I've never been completely able to integrate it in our pipelines since the bigwig files generated sometimes didn't work when loading them in IGV.
I've just decided to have a deep look at it, and I've found a strange behaviour that I've traced down to this little example which you can replicate yourself:
$ cat test.bg
chr1 11259707 11259782 1
chr1 11259782 11259857 0
chr1 11259857 11259933 1
chr1 11259933 11260908 0
$ bigwig view -c hg38.fa.fai -O bigwig -o test.bw test.bg
$ bigwig view test.bw
chr1 11259707 11259782 1
chr1 11259782 11259857 0
chr1 11259857 11259932 1
chr1 11259932 11260007 1
chr1 11259933 11260908 0
As you can see, line
chr1 11259857 11259933 1
gets reduced to
chr1 11259857 11259932 1
and a new erroneous line
chr1 11259932 11260007 1
appears.
Do you have any idea why this could be happening?