deepTools icon indicating copy to clipboard operation
deepTools copied to clipboard

`bamCompare --skipZeroOverZero` bugged

Open joshscurll opened this issue 3 years ago • 1 comments

This is related to issue #1108. Running bamCompare with --skipZeroOverZero gives incorrect results. From left to right, the attached figure shows the following deepTools heatmaps: a ChIP-seq input control (RPGC-normalized output from bamCoverage); a ChIP-seq sample (RPGC-normalized output from bamCoverage); the output of bigwigCompare to subtract the input from the ChIP sample; the output of bamCompare -b1 <sample> -b2 <input> --ignoreDuplicates --extendReads 200 --binSize 10 --scaleFactorsMethod None --normalizeUsing None --operation first -p 32; and finally the output of the exact same bamCompare command as above with the addition of the --skipZeroOverZero flag. The peaks are clearly lost from the expected locations after skipping "0-over-0" bins. This could be explained by the coordinates being shifted after --skipZeroOverZero.

TEST_bamCompare RefPt

On lines 246-247 of writeBedGraph.py, I think value needs to be set to None (or possibly NaN) before continuing to the next iteration of the for loop. This will prevent situations where previous_value gets extended over non-covered regions. Not sure that this will fix the coordinate issue though, so perhaps there are two bugs here.

joshscurll avatar Mar 22 '22 20:03 joshscurll

Having the same issue here. Using --skipZeroOverZero produces large bins that appear as long blocks in the UCSC browser when visualising the data. Removing --skipZeroOverZero resolves the issue.

Command used (deeptools v3.5.5):

bamCompare --bamfile1 sample1.bam \
                --bamfile2 sample2.bam \
                -o results.bg \
                --outFileFormat bedgraph \
                --binSize 100 \
                --normalizeUsing CPM --scaleFactorsMethod None \
                --effectiveGenomeSize $effectivegenomesize \
                --ignoreForNormalization chrX chrY \
                --extendReads \
                --operation ratio \
                --pseudocount 0 1 \
                --skipZeroOverZero

Output bedgraph: Screenshot 2024-11-04 at 17 43 57

lconde-ucl avatar Nov 05 '24 10:11 lconde-ucl