Seqanswers Leaderboard Ad

Collapse

Announcement

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

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

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


    • #3
      Hi GenoMax,

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

      Comment


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


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


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


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

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Techniques and Challenges in Conservation Genomics
                by seqadmin



                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                Avian Conservation
                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                03-08-2024, 10:41 AM
              • seqadmin
                The Impact of AI in Genomic Medicine
                by seqadmin



                Artificial intelligence (AI) has evolved from a futuristic vision to a mainstream technology, highlighted by the introduction of tools like OpenAI's ChatGPT and Google's Gemini. In recent years, AI has become increasingly integrated into the field of genomics. This integration has enabled new scientific discoveries while simultaneously raising important ethical questions1. Interviews with two researchers at the center of this intersection provide insightful perspectives into...
                02-26-2024, 02:07 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 03-14-2024, 06:13 AM
              0 responses
              33 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-08-2024, 08:03 AM
              0 responses
              72 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-07-2024, 08:13 AM
              0 responses
              81 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-06-2024, 09:51 AM
              0 responses
              68 views
              0 likes
              Last Post seqadmin  
              Working...
              X