broadinstitute/picard

UnMarkDuplicate

Davood-Norouzi opened this issue · 1 comments

I already have a bam file that its duplicates are marked and not removed by picard. I just want to unmark those marked reads. How can I achieve that? Can picard do that or should I use samtools somehow?

Thank you!
-Davood

There are many ways to do that. If you are confident in your abilities with unix tools such as awk and sed you can try out one-liners such as the ones here: https://www.biostars.org/p/117220/ and here: https://www.biostars.org/p/139875/

Note that the second answer in first link above (the one that uses awk) only clears the SAM flag bit that marks the read as a duplicate and will not remove the duplicate type tag if it was originally written. This should be fine for most downstream tools but if those tags exist and you would like to remove them, try out the answer in the second link but replace the tag with DT for duplicate type.

If, like me, you get a slight feeling of uneasiness every time you edit a SAM/BAM file manually, you could look into the GATK tool UnmarkDuplicates (https://gatk.broadinstitute.org/hc/en-us/articles/21905124739483-UnmarkDuplicates) which clears the duplication status bit of the SAM flag. Once again, if you also have duplicate type tags and want to clear them as well, https://fulcrumgenomics.github.io/fgbio/tools/latest/RemoveSamTags.html might be useful for you.