Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • antifolate
    Member
    • Aug 2015
    • 52

    samtools fastq (bam2fq) producing non-paired reads

    Hello,

    I'm trying to produce 2 fastq files from a bam file with
    Code:
     samtools fastq -1 reads1.fastq -2 reads2.fastq
    but the resulting files don't have matching reads. Some reads in reads1 don't have pairs in reads2 and vice-versa. Is there a solution?

    Thanks.
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    Are you able to see both reads in the bam file? If it is a small file you could name sort and see if they are there.

    Comment

    • antifolate
      Member
      • Aug 2015
      • 52

      #3
      Hi GenoMax,

      bam is binary. I don't speak binary. Did you mean the sam file?

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Something along the lines of "samtools view your_bam". I have a feeling that you may have a file where the reads that did not map may have been discarded. I assume you got this file from someone else?

        If that is all you have to work with then you could repair the output files using repair.sh from BBMap like this:
        Code:
        $ repair.sh in1=r1.fq in2=r2.fq out1=fixed1.fq out2=fixed2.fq outsingle=singletons.fq

        Comment

        • antifolate
          Member
          • Aug 2015
          • 52

          #5
          You're exactly right; I used
          Code:
           samtools view -b -F4
          to exclude nonmapped reads. Can I tell it to remove both reads if one is removed, or do I have to Perl that up?

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            Originally posted by antifolate View Post
            You're exactly right; I used
            Code:
             samtools view -b -F4
            to exclude nonmapped reads. Can I tell it to remove both reads if one is removed, or do I have to Perl that up?
            If you have the R1/R2 files then just use Brian's repair.sh program from BBMap like shown above.

            If you want to use samtools then see this thread: https://www.biostars.org/p/111481/ and then use your original command.

            Comment

            • antifolate
              Member
              • Aug 2015
              • 52

              #7
              Thanks GenoMax! This command worked for me:
              Code:
              samtools view -f 0x2 bamfile

              Comment

              Latest Articles

              Collapse

              • mylaser
                Reply to Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                by mylaser
                The world of online gaming has grown tremendously over the past few years, giving players access to exciting sports, casino games, and interactive entertainment from the comfort of their homes. Among the platforms gaining attention, Kheloyaar has become a trusted destination for users seeking a fast, secure, and engaging gaming experience.
                Whether you're a first-time visitor or an existing user, understanding the features of Kheloyar and the Kheloyaar login process can help you enjoy everything...
                Today, 12:33 AM
              • 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
                ...
                Yesterday, 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

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 11:10 AM
              0 responses
              8 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-13-2026, 10:26 AM
              0 responses
              30 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-09-2026, 10:04 AM
              0 responses
              39 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-08-2026, 10:08 AM
              0 responses
              25 views
              0 reactions
              Last Post SEQadmin2  
              Working...