Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • SAM file after running bowtie2

    Hello experts,

    I ran bowtie2 mapping with "local" setting on my illumina datasets a while ago and sam files were generated. Basically, I mapped reads onto assembled contigs. Unfortunately, sequence reads used for mapping are not available anymore so I need run bowtie2 again without "local" setting. Is there any way that I can do something with the sam files generated before? Any comments would be appreciated.

  • #2
    Can you clarify your goal? It sounds like you want to convert the sam files to fastq files in order to remap them; is that correct? The other option, converting local alignments into global alignments, is not really as far as I know. Converting the sam to fastq is easy, though, as long as the reads were soft-clipped rather than hard-clipped.

    Comment


    • #3
      You can transform your bam files into fastq files. There is a great tool called bam2fastq for this purpose.

      Link:


      to extract only unaligned reads:
      bam2fastq -o yourdata_unaligned.fastq --no-aligned yourdata.bam

      to extract only aligned reads:
      bam2fastq -o yourdata_aligned.fastq --no-unaligned yourdata.bam
      Last edited by diego diaz; 02-25-2015, 12:31 PM.

      Comment


      • #4
        Thanks!

        To clarify my goal, I would like to obtain fastq files used for mapping from SAM files. Based on comments from Brian Bushnell and diego diaz, it looks doable. Is there any tool for SAM files not BAM files? Thanks.

        Comment


        • #5
          Reformat will do that:
          reformat.sh in=reads.sam out=reads.fastq

          Depending on whether the reads were initially paired, you may need to reprocess the output. Do you happen to know if they were paired?

          Comment


          • #6
            For input of bowtie2 mapping, i used paired reads with flags -1 and -2.

            Comment


            • #7
              OK - in that case, after you convert the sam to fastq as above, you should first test if the pairs are correctly ordered, like this:

              reformat.sh in=reads.fastq verifypairing

              If that completes successfully and says the reads were correctly paired, then you can simply de-interleave it into two files like this:

              reformat.sh in=reads.fastq out1=r1.fastq out2=r2.fastq

              That will probably be the case. If not, let me know and that can be solved also.

              Comment


              • #8
                Also you can use SamToFastq from PicardTools to convert your sam files into fastqs.

                Comment


                • #9
                  Did you check to see if bowtie will take a .bam as input, instead of a fastq?

                  My version, which might be a little old says it has an option

                  Code:
                   -r                 query input files are raw one-sequence-per-line
                  So rather than reformat the .sam to a fastq, maybe you could do a little unix piping, and use the file you already have, without having to make a fastq version of it.

                  Comment


                  • #10
                    Thanks all for the valuable comments.

                    Basically, I have tried reformat with multiple sam files and it worked great. I will also try with other comments (e.g. PicardTools). Thanks again!

                    Comment

                    Latest Articles

                    Collapse

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

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by seqadmin, Yesterday, 06:37 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, Yesterday, 06:07 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-22-2024, 10:03 AM
                    0 responses
                    49 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-21-2024, 07:32 AM
                    0 responses
                    67 views
                    0 likes
                    Last Post seqadmin  
                    Working...
                    X