Bowtie2, -M Alignment/Reporting Mode
2
3
Entering edit mode
12.7 years ago
Gregor Rot ▴ 540

Hi everybody,

i would like bowtie2 to only report "unique" alignments (single hits), same as specifying "-m 1" with bowtie1. (note -m is not equal -M).

I am reading the documentation but can't find this option. The closest is "-M 3", but this would report a max of 4 alignments for a single read and also score them.

Any ideas?

Thank you, Gregor

bowtie • 19k views
ADD COMMENT
5
Entering edit mode
12.5 years ago
Owen S. ▴ 370

Hi Gregor:

If you re-read the -M section of the bowtie2 manual carefully, I think you will see that -M is in fact reporting one unique hit. It is in the description itself: "-M mode: search for multiple alignments, report the best one"

The integer you give it is just the number of alignments it will look for, before reporting the best one. In my experience, -M is reporting only one alignment per read (yes, even though the run-time output says it found multiple alignments, only primary alignments are reported in the report stream.)

Compare the results of the -k versus the -M options:

With -k 10 reporting, I get a total of 57 secondary alignments in this example:

$ bowtie2 -U reads.fq -S temp.sam -x index -k 10
912064 reads; of these:
  912064 (100.00%) were unpaired; of these:
    910706 (99.85%) aligned 0 times
    1321 (0.14%) aligned exactly 1 time
    37 (0.00%) aligned >1 times
0.15% overall alignment rate
$ samtools view -S -f 256 -c temp.sam 
[samopen] SAM header is present: 3827 sequences.
57

While with -M 10 reporting, I get zero secondary alignments:

$ bowtie2 -U reads.fq -S temp.sam -x index -M 10
912064 reads; of these:
  912064 (100.00%) were unpaired; of these:
    910706 (99.85%) aligned 0 times
    1321 (0.14%) aligned exactly 1 time
    37 (0.00%) aligned >1 times
0.15% overall alignment rate

$ samtools view -S -f 256 -c temp.sam 
[samopen] SAM header is present: 3827 sequences.
0

Hope this helps.

ADD COMMENT
0
Entering edit mode

Sorry, but I cannot find -M option in Bowtie2 manual, maybe was in older version... And reporting only one alignment per read doesn't mean this read is unique. A read is unique if it maps to only one place, not if you keep the best place of multiple alignments...

ADD REPLY
0
Entering edit mode

First, the question was not about unique reads, it was about reporting only a single, unique alignment per read. Second, your statement "a read is unique if it maps to only one place" makes no sense to me. (Are you confusing "read" with "alignment" or "hit"?)

Finally, yes, -M was deprecated with Bowtie2 Version 2.0.0-beta7 (July 13, 2012), shortly after I wrote my reply. The -M behavior is now default in Bowtie2. http://bowtie-bio.sourceforge.net/bowtie2/news.shtml

ADD REPLY
4
Entering edit mode
12.7 years ago
Vikas Bansal ★ 2.4k

I am not aware of -m in bowtie2 but a quick solution would be to find XS:i field in your output sam file and remove those reads which contains this field because bowtie2 manual says-

XS:i:<n> Alignment score for second-best alignment. Can be negative. Can be greater than 0 in --local mode (but not in --end-to-end mode).Only present if the SAM record is for an aligned read and more than one alignment was found for the read

ADD COMMENT
0
Entering edit mode

That seems interesting. I will check it out! Does someone confirm it work ?

ADD REPLY
0
Entering edit mode

Smart answer. Thank you ! I am now doing testing. Anyone confirmed this?

ADD REPLY
0
Entering edit mode

I just checked and I can see that :

MAPQ (uniqueness of the alignment) 42 AS (Alignment Score) 0 (good) XS (score for second-best alignment) -58 (very bad)

So this read have to be ketp ! You have to filer using MAPQ field. It s safe.

ADD REPLY

Login before adding your answer.

Traffic: 1611 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6