This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bwa Mem -M Option

Hello

I want to align my reads to the reference genome and then use GATK for downstream analysis. I am using bwa mem protocol.

As I was going through the options, I came across bwa mem -M option which is compatible with picard and GATK

-M         mark shorter split hits as secondary (for Picard/GATK compatibility)

Can someone explain me what does this option do.

Also can bwa mem accept compressed .bz2 fastq files as input??

Hope to hear soon

Regards

Varun

hello ,-M means only one alignment displayed in sam file?

1 answer

without -M, a split read is flagged as 2048 (supplementary alignment) see http://picard.sourceforge.net/explain-flags.html. This flag is a recent addition to the SAM spec.

$ ./bwa mem  ex1.fa <(echo -e "@R1\nATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAGGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC\n+\nIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII") 2> /dev/null 
@SQ    SN:seq1    LN:1575
@SQ    SN:seq2    LN:1584
R1    0    seq2    361    60    62M46S    *    0    0    ATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAGGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII    NM:i:0    AS:i:62    XS:i:0    SA:Z:seq1,1273,+,60S48M,60,0;
R1    2048    seq1    1273    60    60H48M    *    0    0    GATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII    NM:i:0    AS:i:48    XS:i:0    SA:Z:seq2,361,+,62M46S,60,0;

with option -M it is flagged as a duplicate flag=256 (not primary alignment): will be ignored by most 'old' tools.

$ ./bwa mem -M    ex1.fa <(echo -e "@R1\nATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAGGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC\n+\nIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII") 2> /dev/null 
@SQ    SN:seq1    LN:1575
@SQ    SN:seq2    LN:1584
R1    0    seq2    361    60    62M46S    *    0    0    ATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAGGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII    NM:i:0    AS:i:62    XS:i:0    SA:Z:seq1,1273,+,60S48M,60,0;
R1    256    seq1    1273    60    60H48M    *    0    0    GATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII    NM:i:0    AS:i:48    XS:i:0    SA:Z:seq2,361,+,62M46S,60,0;

Thanks Pierre

What does split read means here in context with -M option? So using option -M it says the read to be secondary alignment(not primary alignment) whereas without -M option it gives as supplementary alignment(2048).

What is the difference between "not a primary alignment " and supplementary alignment.

See the sam spec: http://samtools.github.io/hts-specs/SAMv1.pdf

An alignment of a read that cannot be represented as a linear alignment. A chimeric alignment is represented as a set of linear alignments that do not have large overlaps. Typically, one of the linear alignments in a chimeric alignment is considered the "representative" alignment, and the others are called "supplementary" and are distinguished by the supplementary alignment ag. A

Log in to answer this question.