Unconfigured Ad

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

    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
                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
              • SEQadmin2
                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                by SEQadmin2



                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                ...
                07-09-2026, 11:10 AM
              • SEQadmin2
                Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                by SEQadmin2



                Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                07-08-2026, 05:17 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 07-24-2026, 12:17 PM
              0 responses
              21 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-23-2026, 11:41 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-20-2026, 11:10 AM
              0 responses
              26 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-13-2026, 10:26 AM
              0 responses
              38 views
              0 reactions
              Last Post SEQadmin2  
              Working...