Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hollandorange
    Member
    • May 2010
    • 11

    #1

    max mismatches in Bowtie2

    Hello,

    Does anyone know how to set the parameters to align the reads with no more than 2 mismatches in bowtie2?

    In Bowtie, the command line (-v is the parameter) is like the following:
    >Bowtie ref -a -v 2 -f read.fa output.sam

    How to record all the reads with no more than 2 mismatches in Bowtie2?

    Thanks,
    Yanju
  • mgogol
    Senior Member
    • Mar 2008
    • 197

    #2
    I haven't actually *run* it yet, but I'm talking about bowtie 2 at journal club and I don't think this is actually possible at this point. You'd have to do it by filtering the sam file, I think. MD tag?

    The -N parameter controls the number of mismatches allowed per seed, but now we have overlapping seeds spaced at intervals.

    Comment

    • Dario1984
      Senior Member
      • Jun 2011
      • 166

      #3
      I've been working with it this week. You can't set it as a parameter. The cutoff is based on a minimum score threshold and the score is a function of the number of matches and gaps, and their associated penalties.

      Comment

      • mgogol
        Senior Member
        • Mar 2008
        • 197

        #4
        Oh, also look at the SAM optional field XM:i<N> which tells you the number of mismatches. (XO and XG tell number of gap opens and gap extensions, and NM is the edit distance).

        Comment

        • mihuzx
          Member
          • Apr 2013
          • 20

          #5
          Originally posted by hollandorange View Post
          Hello,

          Does anyone know how to set the parameters to align the reads with no more than 2 mismatches in bowtie2?

          In Bowtie, the command line (-v is the parameter) is like the following:
          >Bowtie ref -a -v 2 -f read.fa output.sam

          How to record all the reads with no more than 2 mismatches in Bowtie2?

          Thanks,
          Yanju
          hi,
          had your problem been solved. but now i meet the same problem, could you please tell me how you extract the reads no more than 2 mismatch?
          thanks a lot.

          Comment

          • mgogol
            Senior Member
            • Mar 2008
            • 197

            #6
            I think you could do something by filtering on the field XM:i:0 and XM:i:1 and XM:i:2 from the sam file.

            Probably something like:

            samtools view | cut whatever column it is | grep "XM:i:0" > zero_mismatch.sam

            and then do that for XM:i:1 and XM:i:2, then combine?

            Comment

            • gringer
              David Eccles (gringer)
              • May 2011
              • 845

              #7
              Originally posted by mgogol View Post
              Code:
              samtools view | cut whatever column it is | grep "XM:i:0" > zero_mismatch.sam
              I'm pretty sure that the cut in there will mean that only that column is included in the output. The problem is also trickier because the optional fields are tab separated and not necessarily always in the same column. However, if you don't care about the string 'XM:i:X' appearing in the read name, then a regular expression filter should still work fine:

              Code:
              samtools view -Sh - | grep -e "^@" -e "XM:i:[012][^0-9]" > low_mismatch.sam

              Comment

              • mgogol
                Senior Member
                • Mar 2008
                • 197

                #8
                Thanks for improving on my hasty and incorrect answer...

                Comment

                • mihuzx
                  Member
                  • Apr 2013
                  • 20

                  #9
                  thanks a lot. from the answer, I think out a another solution using perl. the code is :
                  perl -ne "print if /XM:i:[0-2]/;" raw.sam >cleaned.sam

                  Comment

                  • gringer
                    David Eccles (gringer)
                    • May 2011
                    • 845

                    #10
                    Originally posted by mihuzx View Post
                    thanks a lot. from the answer, I think out a another solution using perl. the code is :
                    Code:
                    perl -ne "print if /XM:i:[0-2]/;" raw.sam >cleaned.sam
                    You missed out the headers and haven't considered >9 mismatches (unlikely, but it could happen). The perl equivalent (using your syntax) of what I wrote is as follows:

                    Code:
                    perl -ne "print if((/XM:i:[0-2][^0-9]/) || (/^@/));" raw.sam >cleaned.sam
                    But if you're always going to use that filter you might as well just pipe straight from bowtie2 without making the intermediate 'raw.sam' file, as in my previous example.
                    Last edited by gringer; 11-15-2013, 01:17 PM.

                    Comment

                    • mihuzx
                      Member
                      • Apr 2013
                      • 20

                      #11
                      thanks for your quick and well-thought answer.
                      I was always thinking about how to get the low_mismatch.sam directly,but failed. now I know there so many things to lean for me.
                      thanks again for your guidance.

                      Comment

                      Latest Articles

                      Collapse

                      • SEQadmin2
                        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                        by SEQadmin2



                        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                        ...
                        10-14-2026, 09:55 AM
                      • SEQadmin2
                        New Genomics Technologies Take Aim at Long-Standing Limits
                        by SEQadmin2


                        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                        ...
                        09-28-2026, 10:25 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, Yesterday, 11:13 AM
                      0 responses
                      16 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, Yesterday, 10:48 AM
                      0 responses
                      16 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-15-2026, 10:52 AM
                      0 responses
                      35 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-14-2026, 05:39 AM
                      0 responses
                      42 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...