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

Hi,

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

flags samtools picard duplicates • 3.0k views
ADD COMMENTlink modified 4.1 years ago by Malachi Griffith17k • written 4.1 years ago by Coryza370
1

duplicate of Tool to unmark duplicates

ADD REPLYlink written 4.1 years ago by Pierre Lindenbaum115k
6
gravatar for Malachi Griffith
4.1 years ago by
Washington University School of Medicine, St. Louis, USA
Malachi Griffith17k 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 4.1 years ago • written 4.1 years ago by Malachi Griffith17k

RevertSam is new to me. Thanks.

ADD REPLYlink written 4.1 years ago by Pierre Lindenbaum115k
2
gravatar for Devon Ryan
4.1 years ago by
Devon Ryan86k
Freiburg, Germany
Devon Ryan86k 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 4.1 years ago by Devon Ryan86k
1

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

ADD REPLYlink written 4.1 years ago by RamRS19k

Thanks! Worked perfectly ;)

ADD REPLYlink written 4.1 years ago by Coryza370

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.6 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: 1623 users visited in the last hour