Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • morning latte
    Member
    • Jun 2013
    • 91

    #1

    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.
  • Brian Bushnell
    Super Moderator
    • Jan 2014
    • 2709

    #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

    • diego diaz
      Member
      • Oct 2013
      • 62

      #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

      • morning latte
        Member
        • Jun 2013
        • 91

        #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

        • Brian Bushnell
          Super Moderator
          • Jan 2014
          • 2709

          #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

          • morning latte
            Member
            • Jun 2013
            • 91

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

            Comment

            • Brian Bushnell
              Super Moderator
              • Jan 2014
              • 2709

              #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

              • diego diaz
                Member
                • Oct 2013
                • 62

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

                Comment

                • swbarnes2
                  Senior Member
                  • May 2008
                  • 910

                  #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

                  • morning latte
                    Member
                    • Jun 2013
                    • 91

                    #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

                    • SEQadmin2
                      Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                      by SEQadmin2



                      CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                      Despite this, “CRISPR helped turn genome editing from a specialized technique into
                      ...
                      07-31-2026, 11:01 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
                      ...
                      07-20-2026, 11:48 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, 08-06-2026, 07:41 AM
                    0 responses
                    17 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 08-03-2026, 10:13 AM
                    0 responses
                    33 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-31-2026, 02:55 AM
                    0 responses
                    42 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-24-2026, 12:17 PM
                    0 responses
                    26 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...