samtools-fixmate(1)

πŸ’– samtools-fixmate(1) β€” the glow-up your mates deserved πŸ’–

okay so bestie, welcome to samtools-fixmate, part of the samtools tool family (that's the samtools manual, page one, iykyk). this is the little icon that goes through your name-sorted alignments and fills in all the mate info so your downstream tools stop ghosting you. let's get into it 🫢


✨ NAME ✨

samtools fixmate β€” fills in mate coordinates and insert size fields. that's the whole personality, and honestly? it ate. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

samtools fixmate [-rpcmu] [-O format] in.nameSrt.bam out.bam

🌸 DESCRIPTION 🌸

so here's the vibe: you give it a name-sorted or name-collated alignment, and it fills in the mate coordinates, the ISIZE, and all the mate-related flags and tags. no cap, it does the boring bookkeeping so you don't have to. 😭

and it's not just the basics β€” it also handles the mate CIGAR (MC) and mate mapping quality (MQ) tags, and it does this on both primary and supplementary alignments. equal opportunity tagging, we love to see it ✨


πŸŽ€ OPTIONS πŸŽ€

  • -r β€” remove secondary and unmapped reads. lowkey important caveat: if one of a pair gets removed, the PAIRED flag will not be unset on the read that's left behind. this is a change from the older behaviour in samtools versions up to 1.20, so if you're coming from an ancient version, heads up bestie πŸ’€
  • -p β€” disable the FR proper pair check. yes, it's just turning that check off. sometimes you just need to let things be πŸ™ˆ
  • -c β€” add the template cigar ct tag. cute little extra tag, no notes πŸ’œ
  • -m β€” add ms (mate score) tags. these are the ones markdup uses to pick the best reads to keep, so if you're doing a markdup run later, this is your moment πŸ”₯
  • -M β€” fix any base modification tags (MM, ML and MN). the whole situation: if we have secondary alignments with hard-clipping and the hard clipped reads don't have an MN tag, then we use the base modification tags in the primary alignment to clip the secondary alignment modifications β€” and we add MN tags in the process. this also does other sanity checks on the consistency of these tags. very much the responsible older sister of the option list 🌈
  • -u β€” output uncompressed BAM or CRAM. uncompressed! living freely! πŸ¦‹
  • -O FORMAT β€” write the final output as sam, bam, or cram. by default, samtools tries to pick a format based on the output filename extension; if output is to standard output or no format can be deduced, bam is selected. it's giving "i'll figure it out" energy ✨
  • --no-PG β€” do not add a @PG line to the header of the output file. no provenance line, no problem πŸŽ€
  • -@, --threads INT β€” number of input/output compression threads to use in addition to the main thread. default is [0], as in none, as in the main thread is doing all the work solo 😭
  • -z FLAGs, --sanitize FLAGs β€” perform basic sanitizing of records. FLAGs is a comma-separated list of keywords, defined in the samtools-view(1) man page. by default all FLAGs are enabled, and you can use -z off to disable this. off means off, periodt πŸ’…
🫢 friendly reminder: -z takes that comma-separated keyword list from samtools-view(1), and the default is all of them β€” don't come for me if you forgot to write off.

πŸ‘‘ AUTHOR πŸ‘‘

written by Heng Li from the Sanger Institute. legend behaviour, honestly 🫑


⭐ SEE ALSO ⭐

samtools website: http://www.htslib.org/ 🌈


and that's the whole page bestie πŸ’– this one ships as samtools-1.24, dated 9 July 2026 β€” go fill in those mates, slay, and remember: name-sorted input or it's not happening πŸŽ€βœ¨

πŸ“¦ where this page comes from