Seqanswers Leaderboard Ad

Collapse

Announcement

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

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

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

    Comment


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


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


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

          • seqadmin
            Essential Discoveries and Tools in Epitranscriptomics
            by seqadmin


            The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist on Modified Bases...
            Yesterday, 07:01 AM
          • 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

          ad_right_rmr

          Collapse

          News

          Collapse

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