Question: How To Get The Correct Alignment Statistics After Using Bwa Mem With -M Option
gravatar for skm770
6.7 years ago by
skm770150 wrote:

I want to get uniquely mapped reads from bam files aligned with bwa-mem using the -M option (to make it compatible with picard-tools). If I try to use the following command with samtools to get uniquely mapping reads( or reads with mapping quality greater than 10. I get a very high number of around 90% uniquely mapping. I know I can decrease this number using a more strong threshold of mapping quality of 30 or so but I want to know what would be the ideal way to do so and if the bwa-mem needs to be run with different set of parameters to get more reliable alignments. Following are the bwa and samtools commands that I am using.

bwa mem -t 4  -M ref_genome.fasta  fastq[0] fastq[1] > samfile
samtools view -c -q10 -f 1 -F 12 -S samfile


picard samtools • 3.8k views
ADD COMMENTlink modified 6.7 years ago by Pavel Senin1.9k • written 6.7 years ago by skm770150

You can get non-secondary alignments with samtools view -F 0x100 (see:

ADD REPLYlink written 6.7 years ago by brentp23k
gravatar for Pavel Senin
6.7 years ago by
Pavel Senin1.9k
Los Alamos, NM
Pavel Senin1.9k wrote:

I am not sure if I understand the purpose of the procedure aiming on the reliability of an alignment right, but you can make bwa to search for seeds in more rigorous way - exhaustively - by lowering the r paremeters which is set by default to 1.5. Alternatively or in addition, you could adjust A and B parameters to penalize mismatches more aggressively - if your reads are of good quality, then it makes sense not to align a read if there is mismatch, IMO. Then, you can scrutinize what is going on with gaps and tighten that too as well as clipping and unpaired read penalties.

ADD COMMENTlink modified 6.7 years ago • written 6.7 years ago by Pavel Senin1.9k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 826 users visited in the last hour