Question: Remove flags of MarkDuplicates (picard)
0
gravatar for Coryza
3.9 years ago by
Coryza360
Netherlands
Coryza360 wrote:

Hi,

Is it possible to remove the MarkDuplicates flags (not the sequences) from a BAM file? If so, how?

flags samtools picard duplicates • 2.9k views
ADD COMMENTlink modified 3.9 years ago by Malachi Griffith16k • written 3.9 years ago by Coryza360
1

duplicate of Tool to unmark duplicates

ADD REPLYlink written 3.9 years ago by Pierre Lindenbaum112k
6
gravatar for Malachi Griffith
3.9 years ago by
Washington University School of Medicine, St. Louis, USA
Malachi Griffith16k wrote:

You can use Picard RevertSam for this.  This tool can be used to reset various attributes of a BAM file including duplicate information.  Simply use: REMOVE_DUPLICATE_INFORMATION=true

Example command:

java -Xmx7g -jar ~/tools/picard/picard-tools-1.118/RevertSam.jar OUTPUT=UnmarkedDuplicates.bam INPUT=MarkedDuplicates.bam REMOVE_DUPLICATE_INFORMATION=true

ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by Malachi Griffith16k

RevertSam is new to me. Thanks.

ADD REPLYlink written 3.9 years ago by Pierre Lindenbaum112k
2
gravatar for Devon Ryan
3.9 years ago by
Devon Ryan84k
Freiburg, Germany
Devon Ryan84k wrote:

Depending on the version of awk you have on your computer then something like the following should work:

samtools view -h foo.bam | awk 'BEGIN{OFS="\t"}{if(NF>5) {if(and($2,1024)) {$2-=1024}} print $0}' | samtools view -Sbo foo.unmarked.bam -

I think Macs have mawk rather than gawk, so this doesn't work there.

ADD COMMENTlink written 3.9 years ago by Devon Ryan84k
1

If you're on Mac and not using homebrew, you're missing out on a bunch of cool stuff.

ADD REPLYlink written 3.9 years ago by RamRS17k

Thanks! Worked perfectly ;)

ADD REPLYlink written 3.9 years ago by Coryza360

Worked for me but the next stage of my pipeline (realignment using GATK) did not like the resulting BAM files.

##### ERROR MESSAGE: SAM/BAM file /home/cci/sau103/datahome/sals/scratch/Run/bowtie2/100028_S233_L001.asd.bam is malformed: Invalid file pointer: 4570

 

ADD REPLYlink written 3.4 years ago by Neilfws48k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 971 users visited in the last hour