sam(5)

Okay bestie, let's talk about sam, the manual page you'd find in section 5 under Bioinformatics formats. It's all about the Sequence Alignment/Map file format 🧬✨

πŸŽ€ NAME πŸŽ€

sam β€” Sequence Alignment/Map file format πŸ’–

🌸 DESCRIPTION 🌸

Okay so the Sequence Alignment/Map (SAM) format is TAB-delimited πŸ“‹ It's giving very neat rows and columns πŸ’… Apart from the header lines, which start with the @ symbol, every alignment line has these eleven fixed columns, plus optional extras after them:

  • 1 QNAME β€” Query template/pair NAME 🏷️
  • 2 FLAG β€” bitwise FLAG 🚩
  • 3 RNAME β€” Reference sequence NAME 🧭
  • 4 POS β€” 1-based leftmost POSition/coordinate of clipped sequence πŸ“
  • 5 MAPQ β€” MAPping Quality (Phred-scaled) 🌟
  • 6 CIGAR β€” extended CIGAR string βœ‚οΈ
  • 7 MRNM β€” Mate Reference sequence NaMe (= if same as RNAME) πŸ‘―
  • 8 MPOS β€” 1-based Mate POSition πŸ“Œ
  • 9 TLEN β€” inferred Template LENgth (insert size) πŸ“
  • 10 SEQ β€” query SEQuence on the same strand as the reference 🧬
  • 11 QUAL β€” query QUALity (ASCII-33 gives the Phred base quality) 🫧
  • 12+ OPT β€” variable OPTional fields in the format TAG:VTYPE:VALUE 🧩

🚩 The FLAG field 🚩

Each bit in the FLAG field is its own little vibe ✨ Here's the breakdown, where the second column gives the string representation of the FLAG field:

  • 0x0001, p β€” the read is paired in sequencing πŸ‘―β€β™€οΈ
  • 0x0002, P β€” the read is mapped in a proper pair πŸ’ž
  • 0x0004, u β€” the query sequence itself is unmapped πŸ™ˆ
  • 0x0008, U β€” the mate is unmapped πŸ’€
  • 0x0010, r β€” strand of the query (1 for reverse) πŸ”„
  • 0x0020, R β€” strand of the mate πŸ”
  • 0x0040, 1 β€” the read is the first read in a pair πŸ₯‡
  • 0x0080, 2 β€” the read is the second read in a pair πŸ₯ˆ
  • 0x0100, s β€” the alignment is not primary πŸ«₯
  • 0x0200, f β€” the read fails platform/vendor quality checks ❌
  • 0x0400, d β€” the read is either a PCR or an optical duplicate πŸ‘―
  • 0x0800, S β€” the alignment is supplementary πŸ¦‹

πŸ”— SEE ALSO πŸ”—


htslib, August 2013, sam(5) 🌈 That's the whole tea, bestie, and you're literally ready to read SAM files now πŸ’œπŸ«Ά

πŸ“¦ where this page comes from