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
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              23 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              20 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              42 views
              0 reactions
              Last Post SEQadmin2  
              Working...