This has been bugging me for awhile now. I know there are multiple mapping reads in my alignments, but bowtie2 does not assign the 256 flag for any of my reads. Bowtie2 says in the manual that is should be doing this:
Each reported read or pair alignment beyond the first has the SAM ‘secondary’ bit (which equals 256) set in its FLAGS field.
But when I check for any secondary alignments:
$ samtools view -f 256 my_file.bam | wc -l
0
There are apparently no secondary alignments.
How do I know there actually are multiple mapping reads? Well bowtie2 also uses the XS:i:
field
XS:i:<n> Alignment score for the best-scoring alignment found other than the alignment reported. 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. Note that, when the read is part of a concordantly-aligned pair, this score could be greater than AS:i.
So, since XS:i
is only present if more than one alignment was found for the read, let's check that:
$ samtools view my_file.bam | grep "XS:i:" | wc -l
42821156
Am I missing something here? There are clearly multiple alignments for a LOT of my reads, so why is there not a single alignment with 256 flag set?