Minimap2: Question about SAM output tags

Created on 9 Sep 2017  Β·  10Comments  Β·  Source: lh3/minimap2

Hi,

I generated "sam" file using "minimap2", and I noticed there are some additional tags in the output compared to the standard "sam" format, e.g. "tp:A:P cm:i:8 s1:i:46 s2:i:0 NM:i:264 ms:i:194 AS:i:194 nn:i:0". I was wondering if you can tell me what do the tags "tp", "cm", "ms" and "nn" mean.
Next, I want to extract the number of matches and mismatches from the cigar alignment. However, the "sam" file contains only the tag M, which stands for both matches and mismatches, so I was wondering if any of these additional tags can help me differentiate between the both. If not, can you please suggest me a way to do that ?

Thank you,
Natasha

question

Most helpful comment

For people who encounter this issue via Google in the future, here is the table of tags as of minimap 2.10:

                        β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚Tag β”‚ Type β”‚                      Description                      β”‚
                        β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                        β”‚ tp β”‚  A   β”‚ Type of aln: P/primary, S/secondary and I,i/inversion β”‚
                        β”‚ cm β”‚  i   β”‚ Number of minimizers on the chain                     β”‚
                        β”‚ s1 β”‚  i   β”‚ Chaining score                                        β”‚
                        β”‚ s2 β”‚  i   β”‚ Chaining score of the best secondary chain            β”‚
                        β”‚ NM β”‚  i   β”‚ Total number of mismatches and gaps in the alignment  β”‚
                        β”‚ MD β”‚  Z   β”‚ To generate the ref sequence in the alignment         β”‚
                        β”‚ AS β”‚  i   β”‚ DP alignment score                                    β”‚
                        β”‚ ms β”‚  i   β”‚ DP score of the max scoring segment in the alignment  β”‚
                        β”‚ nn β”‚  i   β”‚ Number of ambiguous bases in the alignment            β”‚
                        β”‚ ts β”‚  A   β”‚ Transcript strand (splice mode only)                  β”‚
                        β”‚ cg β”‚  Z   β”‚ CIGAR string (only in PAF)                            β”‚
                        β”‚ cs β”‚  Z   β”‚ Difference string                                     β”‚
                        β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

All 10 comments

For tags, see the table at the bottom of man ./minimap2.1.

NM gives the number of mismatches and gaps. You can count the number of gaps from CIGAR. The difference gives the number of mismatches.

Thank you @lh3 , that worked perfectly!

Hi Dr. Li:

You can count the number of gaps from CIGAR

I initially assumed this meant N from the CIGAR, however, when I took NM-N I obtained an array with negative values, so clearly I had been mistaken. I am now assuming that you are referring to D from the CIGAR ('Deletion', in which the nucleotide is present in the reference but not in the read),

This would imply that # mismatches = NM-D

If that's incorrect, could you please set me straight? Thank you.

answered below: # mismatches = NM-D-I-"ambiguous bases"

@Blosberg , according my understanding, the number of gaps is the number of insertions and deletions from the CIGAR output, so I ended up using #mismatches=NM-I-D.

I forgot what the SAM spec says, but for minimap2:

NM = #mismatches + #I + #D + #ambiguous_bases

NM does not count reference skip N.

@npavlovikj , @lh3 ,
ok. Thank you both very much for your help.

For people who encounter this issue via Google in the future, here is the table of tags as of minimap 2.10:

                        β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚Tag β”‚ Type β”‚                      Description                      β”‚
                        β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                        β”‚ tp β”‚  A   β”‚ Type of aln: P/primary, S/secondary and I,i/inversion β”‚
                        β”‚ cm β”‚  i   β”‚ Number of minimizers on the chain                     β”‚
                        β”‚ s1 β”‚  i   β”‚ Chaining score                                        β”‚
                        β”‚ s2 β”‚  i   β”‚ Chaining score of the best secondary chain            β”‚
                        β”‚ NM β”‚  i   β”‚ Total number of mismatches and gaps in the alignment  β”‚
                        β”‚ MD β”‚  Z   β”‚ To generate the ref sequence in the alignment         β”‚
                        β”‚ AS β”‚  i   β”‚ DP alignment score                                    β”‚
                        β”‚ ms β”‚  i   β”‚ DP score of the max scoring segment in the alignment  β”‚
                        β”‚ nn β”‚  i   β”‚ Number of ambiguous bases in the alignment            β”‚
                        β”‚ ts β”‚  A   β”‚ Transcript strand (splice mode only)                  β”‚
                        β”‚ cg β”‚  Z   β”‚ CIGAR string (only in PAF)                            β”‚
                        β”‚ cs β”‚  Z   β”‚ Difference string                                     β”‚
                        β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tag dv:f:

Approximately estimate per-base sequence divergence (i.e. 1-identity) without performing base-level alignment, using a MashMap-like method. The estimate is written to a new dv:f tag.

Just added "dv" to the man page via aef7b07. BTW, you can also find the table here.

Hi,
I noticed that some alignments don't have the dv tag. Under what circumstances will this tag not be present?

Thanks,
Natasha

Was this page helpful?
0 / 5 - 0 ratings