samtools-calmd(1)
π
samtools-calmd(1) β the samtools calmd page, bestie edition π
okay so you're looking at the manual for samtools calmd, which literally just calculates MD and NM tags. that's the whole gig. iconic, honestly.
β¨ NAME β¨
samtools calmd β calculates MD and NM tags π§¬
πΈ SYNOPSIS πΈ
samtools calmd [-Eeubr] [-C capQcoef] aln.bam ref.fasta
that's it, that's the vibe check. two files in, tags out π
π¦ DESCRIPTION π¦
so what it does is generate the MD tag. and if the MD tag is already there? it'll give you a lil warning if the MD tag it generated is different from the existing one. no drama, just a heads-up π«Ά Output is SAM by default.
Calmd can also read and write CRAM files, although in most cases it's giving pointless, because CRAM recalculates MD and NM tags on the fly anyway. the one exception to this β the single scenario where it's actually doing something β is where both input and output CRAM files have been / are being created with the no_ref option. iykyk.
π real talk: some aligners do not include sequence or confidence values in secondary and supplementary alignment records. where this happens in SAM files, you'll see a*character chillin' in theSEQandQUALcolumns. those records get skipped, because there's literally no way to recalculate the MD and NM tags without access to the query sequence.samtools calmdwill emit a warning if any records have been skipped for this reason. so if you see that warning, that's why, don't panic π
Calmd works best on position-sorted input files, because with these it can stream through the reference sequence and so doesn't have to store much reference data at any one time. β¨ main character streaming energy β¨
For other orderings though? it may have to switch to a caching mode which keeps the reference sequences in memory. and that means calmd uses more memory β up to the full size of the reference β than it would in the position-sorted case. lowkey expensive π
β οΈ also, versions of samtools calmd up to 1.16.1 should only be used on position sorted inputs, as they could be very slow when run on other orderings. like, painfully slow. so if you're on an old version, sort first, bestie.
π OPTIONS π
-Aβ when used jointly with-r, this option overwrites the original base quality. rude but valid.-eβ convert a the read base to=if it is identical to the aligned reference base. (yes, the original says "a the", we're keeping the lore.) β οΈ the indel caller does not support the=bases at the moment, so heads up.-uβ output uncompressed BAM-bβ output compressed BAM-C INTβ coefficient to cap mapping quality of poorly mapped reads. see thempileupcommand for details.[0]π«-rβ compute the BQ tag (without-A) or cap base quality by BAQ (with-A).-Eβ extended BAQ calculation. this option trades specificity for sensitivity, though the effect is minor. tiny slay.--no-PGβ do not add a@PGline to the header of the output file. π«-@,--threads INTβ number of input/output compression threads to use in addition to main thread[0]. more threads = more go β¨
π EXAMPLES π
- dump BAQ applied alignment for other SNP callers:
samtools calmd -bAr aln.bam > aln.baq.bam
it adds and corrects the NM and MD tags at the same time. the calmd command also comes with the -C option, the same as the one in mpileup. apply if it helps. π«Ά
π AUTHOR π
Written by Heng Li from the Sanger Institute. legend behavior, fr fr.
β SEE ALSO β
samtools(1), samtools-mpileup(1)
Samtools website: <http://www.htslib.org/> π
and that's the whole page, bestie!! ππ go forth and tag your MDs and NMs. this was samtools-1.24, dated 9 July 2026 β see you in the next release, mwah ππ¦
π¦ where this page comes from
- epel 10: samtools 1.24-2.el10_3 Β· MIT
- nixpkgs unstable: samtools 1.24
- Copyright (C) 2008-2011, 2013-2018, 2022 Genome Research Ltd
- copyright (C) 2010, 2011 Broad Institute
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms