Generate the MD tag. If the MD tag is already present, this command will give a warning if the MD tag generated is different from the existing tag. Calmd can also read and write CRAM files although in most cases it is pointless as CRAM recalculates MD and NM tags on the fly. The one exception to this case is where both input and output CRAM files have been / are being created with the no_ref option.
samtools calmd [-eubrAESQ] <aln.bam> <ref.fasta>
The samtools calmd
command is an integral component of the samtools suite, specifically tailored for handling SAM (Sequence Alignment/Map) and BAM (Binary Alignment/Map) format files. At its core, the purpose of the MD tag is to represent the alignment differences between a read sequence and a reference sequence. This tag helps researchers and bioinformaticians quickly identify and analyze variations, including substitutions, insertions, and deletions, when comparing aligned reads to a known reference. By computing and appending the MD tag to alignments, the tool aids in downstream analyses such as variant calling, structural variant detection, and alignment quality assessment.
An example usage of computing MD tags against an alignment BAM file with a reference FASTA file: samtools calmd input.bam reference.fasta
Utilizing the -e option to change identical bases to '=': samtools calmd -e input.bam reference.fasta