Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JChase
    Member
    • Jun 2012
    • 17

    #1

    Extracting unpaired reads from BAM file

    Hello,

    I'm a bit confused about the various SAM flags and how to selectively pull reads from a BAM file. I got a little carried away with samtools merge, and now I have a BAM file that includes paired as well as unpaired reads. Having both paired and unpaired reads in the same file is hindering some downstream analyses. I've figured out how to pull paired reads from the BAM file and put them into another BAM file, but does anyone know how I can pull unpaired reads from a BAM file and put them into a new BAM file? Or, alternatively, delete all paired reads from a BAM file, leaving only unpaired reads?

    Thanks!
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #2
    Paired reads should have the 1 flag set. samtools view -F1 should get all the unpaired reads.

    Comment

    • JChase
      Member
      • Jun 2012
      • 17

      #3
      Originally posted by swbarnes2 View Post
      Paired reads should have the 1 flag set. samtools view -F1 should get all the unpaired reads.
      Ah, thank you! I see now that my confusion was due to misunderstanding the -f vs -F options. I didn't realize different cases resulted in different types of filtering. Thanks again.

      Comment

      • lramsay
        Junior Member
        • Aug 2012
        • 1

        #4
        Originally posted by JChase View Post
        Hello,

        I'm a bit confused about the various SAM flags and how to selectively pull reads from a BAM file. I got a little carried away with samtools merge, and now I have a BAM file that includes paired as well as unpaired reads. Having both paired and unpaired reads in the same file is hindering some downstream analyses. I've figured out how to pull paired reads from the BAM file and put them into another BAM file, but does anyone know how I can pull unpaired reads from a BAM file and put them into a new BAM file? Or, alternatively, delete all paired reads from a BAM file, leaving only unpaired reads?

        Thanks!
        I am trying to pull paired reads from a BAM file. What options did you use to do that?

        Thank you!

        Edit: I was also confused about the upper vs. lower case options, but I think I get it now. Just to verify -f1 should get all the paired reads?
        Last edited by lramsay; 08-09-2012, 07:24 AM.

        Comment

        • nilshomer
          Nils Homer
          • Nov 2008
          • 1283

          #5
          Originally posted by lramsay View Post
          I am trying to pull paired reads from a BAM file. What options did you use to do that?

          Thank you!

          Edit: I was also confused about the upper vs. lower case options, but I think I get it now. Just to verify -f1 should get all the paired reads?
          This site can help you get the flags correctly set: http://picard.sourceforge.net/explain-flags.html

          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
          60 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-22-2026, 10:48 AM
          0 responses
          42 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-15-2026, 10:52 AM
          0 responses
          75 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-14-2026, 05:39 AM
          0 responses
          74 views
          0 reactions
          Last Post SEQadmin2  
          Working...