Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • makarovv
    Junior Member
    • Apr 2010
    • 6

    #1

    Picard MarkDuplicates - How to identify duplicates in generated BAM file

    Dear members,

    When I run Picard MarkDuplicates, in my understanding, if I choose to keep the duplicates, they will be flagged in my BAM output file.

    The question is how to find records marked "duplicates" in the output BAM file ???

    Details: I ran the command like this:

    java -jar MarkDuplicates.jar INPUT=sorted.bam OUTPUT=sorted.flag_dup.bam METRICS_FILE=metrics.txt REMOVE_DUPLICATES=false ASSUME_SORTED=true

    It runs and generate the sorted.flag_dup.bam in which duplicates must be flagged in one of optional field

    According to specs, optional fields are in the format: <TAG>:<VTYPE>:<VALUE> and
    0x0400 means that the read is either a PCR duplicate or an optical duplicate.

    My optional fields look like that:

    XT:A:R NM:i:1 SM:i:0 AM:i:0 X0:i:454 XM:i:1 XO:i:0 XG:i:0 MD:Z:31A5

    The site http://picard.sourceforge.net/explain-flags.html tells me that
    read is PCR or optical duplicate is '1024' in Integer format

    I am searching resulting file i:1024 and find some X0:i:1024 and some X1:i:1024
    but it is only about 200 of them, whereas the metrics said I have 131000 duplicates, which is likely true.

    Could someone kindly explain how do I find the duplicate records in BAM/SAM file generated by Picard?

    Thank you very much in advance

    Vlad
    Last edited by makarovv; 11-09-2010, 02:59 PM.
  • drio
    Senior Member
    • Oct 2008
    • 323

    #2
    read (or re-read) carefully the bam specification.

    Reads are flagged with 0x400 (check section 2.2.2.) if they are considered
    duplicates.

    So you have to filter those ones out. With samtools:

    $ samtools view -F 1023 your_bam > your_bam.without_dups.sam
    -drd

    Comment

    • makarovv
      Junior Member
      • Apr 2010
      • 6

      #3
      Dear Drio,

      It is
      samtools view -F 0x400 sorted.mark_dup.bam > rm_dup.sam

      to output those reads marked duplicates.

      Thank you for pointing me in right direction

      Comment

      • drio
        Senior Member
        • Oct 2008
        • 323

        #4
        I made a typo while replying, you can both provide the decimal or the hexadecimal representation of the number that encodes your desire filtering.
        -drd

        Comment

        • makarovv
          Junior Member
          • Apr 2010
          • 6

          #5
          Yes, thanks, I figured out:

          samtools view -F 0x40 - to filter out duplicates (create rmdup sam file)

          samtools view -f 0x40 - to filter out evrything else, but duplicates (save duplicates in separate sam file)

          I wish samtools authors provided more clear examples

          Comment

          • drio
            Senior Member
            • Oct 2008
            • 323

            #6
            0x400 not 0x40
            -drd

            Comment

            • makarovv
              Junior Member
              • Apr 2010
              • 6

              #7
              Yes, of course. My typo

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                by SEQadmin2



                CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                Despite this, “CRISPR helped turn genome editing from a specialized technique into
                ...
                07-31-2026, 11:01 AM
              • SEQadmin2
                Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                by SEQadmin2


                Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                The systematic characterization of the human proteome has
                ...
                07-20-2026, 11:48 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 10:05 AM
              0 responses
              8 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 08-13-2026, 12:22 PM
              0 responses
              33 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 08-11-2026, 10:35 AM
              0 responses
              27 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 08-06-2026, 07:41 AM
              0 responses
              38 views
              0 reactions
              Last Post SEQadmin2  
              Working...