Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #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


    • #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


      • #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


        • #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


          • #6
            0x400 not 0x40
            -drd

            Comment


            • #7
              Yes, of course. My typo

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Current Approaches to Protein Sequencing
                by seqadmin


                Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                04-04-2024, 04:25 PM
              • seqadmin
                Strategies for Sequencing Challenging Samples
                by seqadmin


                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                03-22-2024, 06:39 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              24 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              25 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 09:21 AM
              0 responses
              21 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-04-2024, 09:00 AM
              0 responses
              52 views
              0 likes
              Last Post seqadmin  
              Working...
              X