Entering edit mode
6.5 years ago
chris.bird
▴
10
I'm trying to control which reads are mapped to a reference genome by adjusting the the -T parameter in bwa mem, which is the minimum acceptable alignment score. The only problem is that reads with an alignment score below the threshold are being mapped anyway. I can see this when using samtools view to visualize the bam file, reads with an AS value less than the threshold are there. My data is paired end, so I tried doubling the threshold to account for both reads, but that didn't work either.
What's going on here? Do some settings in bwa mem interfere with -T?
For things like this, please give the version of BWA, full command line, the reference genome and an example of the problematic reads.
Will create a new post if it's not acceptable to comment with the same issue
I have the same issue, using bwa mem 0.7.13 as follows:
The -K setting is for deterministic alignment, as seen in this post, and I don't think it's interfering with -T, since it says in the bwa manual that -T only affects the output.
Example problematic reads from sam file:
I appreciate any insights on this!
Out of curiosity do these reads have other alignments that satisfy the
-T
cut-off elsewhere in the file?No, these reads don't have other alignments at all in the file.
I have the same issue. I set -T to 75 and I still see reads with AS:i:30, for example
It seems -T parameter acts upon the MD:Z field, which apparently indicates all matches/mismatches/indels (not as straightforward as AS:i). Unmapped reads still remain in the SAM file. In my case, however, when I convert SAM to BAM, sort it and then filter it with $ samtools view -bq 1 sorted.bam > filtered.bam, then I see the min. value for the AS:i field as I set it with -T.
perhaps what is happening is that the mapping quality is set to 0 when the score is under the threshold, so the filtering takes place with the -q 1 step