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