38 / d4-format

The D4 Quantitative Data Format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

depth is 0 for samtools/examples/toy.sam

lindenb opened this issue · comments

I tried to play with d4 and https://github.com/lindenb/jvarkit/blob/master/src/test/resources/toy.sam sorted and converted to bam ( https://github.com/lindenb/jvarkit/blob/master/src/test/resources/toy.bam )

I created a d4 with

./target/release/d4utils create -Azr ~/src/jvarkit/src/test/resources/toy.fa -q 0 ~/src/jvarkit/src/test/resources/toy.bam

'view' returns a depth=0 everywhere:

$ ./target/release/d4utils view  ~/src/jvarkit/src/test/resources/toy.d4       
ref	0	45	0
ref2	0	40	0

while samtools depth returns a depth up to 6 reads.

$ samtools depth -q 0 ~/src/jvarkit/src/test/resources/toy.bam | sort -t $'\t' -k3,3n | tail
ref2	13	5
ref2	21	5
ref2	22	5
ref2	14	6
ref2	15	6
ref2	16	6
ref2	17	6
ref2	18	6
ref2	19	6
ref2	20	6

Am I missing something ? Is there anything filtered during the 'create' step ?

I also experience this issue on my own data. Using a bam file returns 0 coverage everywhere, but converting that to a bigwig, then using the bigwig to make the d4 returns the expected coverage values.

It looks like the recent change to override the minimum map qual of 60 isn't working. With my test, it is always 60 no matter what is provided on the CL. Therefore since none of the alignments in the test have MAPQ >=60, the depth is zero. Should be a simple fix for @38.

https://github.com/38/d4-format/blob/master/d4utils/src/create/main.rs#L89-L91

This should be fixed in the latest commit, thanks for reporting!