Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • bamToFastq not working with .bam file from bwa-mem

    I have aligned my paired end reads using bwa mem. I then filtered my .bam file in order to obtain a .bam file that has all the unmapped reads.

    When I tried to take this .bam file and convert it into 2 .fq reads for each replicate, i kept getting this error:

    *****WARNING: Query M00532:8:000000000-A17VF:1:2114:24702:5749 is marked as paired, but it's mate does not occur next to it in your .bam file. Skipping.


    What do I do?

  • #2
    Which bamToFastq tool are you using?

    Comment


    • #3
      bedtools bamToFastq

      Comment


      • #4
        When you filtered the data did you keep the other read if only one out of the pair was mapped? Looks like you did not do that.

        Comment


        • #5
          Here is an example:

          M00532:8:000000000-A17VF:1:2110:8760:26938 121 NODE_140_length_92945_cov_15.514477 91194 60 28S101M126S = 91194 0 AATGTCGCCTCGGTCCGCCGACTCCCAGCCGCACCTACCTGACCGATGAACAGATCAATGGCGACTGTGCGGCGCTGCTGACGGCGCTGGCTTCGCGGTTGACCCCTGGCGAGAAGGTGAACGCCGAGTCTCCTTCCTCCTTCCCTCCCTCCTTTCCTCCTTCTCAGTGCGCACTTCGCCAGCATTCCTTCTCTTACCCCTTACTCTCTGACCCCTTCCACCCCGCGCTGCCGCAGGACGGGCTGTTGGTGCGCT //''-''-''''''.'.-.((((((.''-'<6/(.....(/(6=;;6.((/(EEEE?96<46.(6;2'45';5/<66/-'..5'2<<;6.-'''64/(6/((;6<;?269/((.6(669;42?6(///((((((((((((((''(('((.((((((-((/(((((-.'-'6/(1))@E@9*110***********<3+++++2++++++33)+43+5))55**5+5+CC5CAEC>>>CC@@@@@<@@<+===<5, NM:i:4 MD:Z:5A7G49G0G36 AS:i:81 XS:i:0 RG:Z:cof1 SA:Z:NODE_140_length_92945_cov_15.514477,91388,-,222S33M,60,1;
          M00532:8:000000000-A17VF:1:2110:8760:26938 2169 NODE_140_length_92945_cov_15.514477 91388 60 222H33M = 91388 0 CCGCGCTGCCGCAGGACGGGCTGTTGGTGCGCT *5+5+CC5CAEC>>>CC@@@@@<@@<+===<5, NM:i:1 MD:Z:32G0 AS:i:32 XS:i:0 RG:Z:cof1 SA:Z:NODE_140_length_92945_cov_15.514477,91194,-,28S101M126S,60,4;
          M00532:8:000000000-A17VF:1:2110:8760:26938 181 NODE_140_length_92945_cov_15.514477 91194 0 * = 91194 0 TGCTGCAGCGGATTACGCTTCACCGTCTGCCGTGCAGTTCGCAATTTCTCCACACGGCCCCGCCAGTGCATGCGGCCTGTTCCGGGTTTCCTACCTGCCCTGCCCCAACCCGTCCCCCGTCTCCGGGTGCCACTCCGTCGGATCCGCTTAACTCCTGGTGGATTTGTTGACCGCCCCCTGCTTCCGCGGTTGCTTGTCCGCCTGAATCCCCCCCCCTTGGGTTTTGGTTTTCCCCTCCACGCCGTCGTCCGCCA (((.''((((((((/'((((((('(('''.(/((/(''-(((((/(((((((''44'-'''/(.((((-('''(((((.'-'-(((;(/((.('(((''6-(''.'(.'-'.'4.'-((-'''.(/((((-(.-'.'9/..'''.(6./(/((((((((((.//(/.(-''.''-'((((('''-''(((6/(('--4..((((((-.'''5)<95+9E5+5++C5--5++*+5++>55<5555+55==<<=<, AS:i:0 XS:i:0 RG:Z:cof1



          Here is the command line i used after mapping my reads in order to filter:


          samtools view -u -f 4 –F 264 alignments.bam > tmps1.bam
          samtools view -u -f 8 -F 260 alignments.bam > tmps2.bam
          samtools view -u -f 12 -F 256 alignments.bam > tmps3.bam
          samtools merge –u output.bam input1.bam input2.bam input3.bam
          samtools sort –n input.bam output

          bamToFastq –i unmapped.bam –fq unmapped_reads1.fastq –fq2 unmapped_reads2.fastq

          Comment


          • #6
            bump still need help

            Comment


            • #7
              bump still need help

              Comment


              • #8
                bump still need help

                Comment


                • #9
                  bump still need help

                  Comment


                  • #10
                    I don't know that bamToFastq supports chimeric alignments, such as the one you showed.

                    Comment


                    • #11
                      Originally posted by dpryan View Post
                      I don't know that bamToFastq supports chimeric alignments, such as the one you showed.
                      When I used novoalign and then converted my bam file into the unmapped fastq files, the unmapped fastq files did not contain any chimeric reads.

                      But the BWA one does. Is it better to just to leave these reads out?

                      Comment


                      • #12
                        Given that novoalign at least used to not produce chimeric alignments, that's not surprising. You can just filter out the reads with the 0x800 bit set in the flag and then things should work.

                        Comment


                        • #13
                          So essentially get rid of the chimeric alignments? How do I "filter" them using BWA? or what program will I end up using?

                          Comment


                          • #14
                            Code:
                            samtools view -bF 0x800 foo.bam > foo.filtered.bam

                            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
                            30 views
                            0 likes
                            Last Post seqadmin  
                            Started by seqadmin, 04-10-2024, 10:19 PM
                            0 responses
                            32 views
                            0 likes
                            Last Post seqadmin  
                            Started by seqadmin, 04-10-2024, 09:21 AM
                            0 responses
                            28 views
                            0 likes
                            Last Post seqadmin  
                            Started by seqadmin, 04-04-2024, 09:00 AM
                            0 responses
                            53 views
                            0 likes
                            Last Post seqadmin  
                            Working...
                            X