samtools-tview(1)

πŸ’… samtools-tview πŸ’…

ok so real talk, this is the samtools tview page from the samtools manual β€” the cute little interactive alignment viewer β€” and i'm gonna walk you through every single bit of it, no skips, no "you'll figure it out" energy πŸ’–


✨ NAME ✨

samtools tview β€” display alignments in a curses-based interactive viewer πŸ¦‹

like, yes bestie, your BAM alignments. in a terminal. with ncurses. iconic behavior honestly.


🌸 SYNOPSIS 🌸

samtools tview [-p chr:pos] [-s STR] [-d display] in.sorted.bam
[ref.fasta]

that's the whole vibe. sorted bam in, optional reference fasta, some flags if you're feeling spicy πŸ”₯


πŸŽ€ DESCRIPTION πŸŽ€

so this is the text alignment viewer β€” it's based on the ncurses library, meaning it runs right there in your terminal and it's fully interactive. main character energy fr πŸ’…

once you're inside the viewer:

  • hit ? for help β€” yes it has a help menu, she's helpful
  • hit g to jump the alignment start to a region. the format is like chr10:10,000,000, or =10,000,000 when you're viewing the same reference sequence as before ✨

now, the layout, top to bottom:

  1. the top line shows the reference sequence β€” or just a bunch of 'N's if the reference is unknown 🫠
  2. underneath that is the consensus, derived from the sequence alignments
  3. below the consensus, all the sequence alignment records get shown

and about the casing: uppercase vs lowercase is how you tell the sequence strand apart. uppercase = top / forward strand, periodt πŸ‘‘

when the reference is known, both the consensus and the alignment record sequences get displayed in a dot-notation πŸŽ€ where a matching character shows up as '.' (forward strand) or ',' (reverse strand), and like... only the mismatching bases and the missing bases actually show up as letters. sneak peek just the drama, love that for us.

you can toggle this mode on and off with the "." command πŸ’«


⭐ OPTIONS ⭐

  • -d display β€” output as (H)tml, (C)urses or (T)ext. that's the display mode bestie, pick your fighter.

the width of the generated text is controlled by the COLUMNS environment variable, or by the -w option for the non-curses outputs πŸ‘€ heads up tho: COLUMNS may be a local shell variable, so you might need to export it first, or just specify it right on the command line before the command. like so:

export COLUMNS ; samtools tview -d T -p 1:234567 in.bam
  • -p chr:pos β€” go directly to this position πŸš€ no scrolling around like a lost little guy.
  • -s STR β€” display only alignments from this sample or read group. STR has to match either an ID or SM field in an @RG header record, no cap. for example:
samtools tview -p chr20:10M -s NA12878 grch38.fa
  • -w INT β€” specifies the display width when using the HTML or Text output modes πŸ“ (curses does its own thing, she doesn't need it).
  • -X β€” if this option is set, it will allows user to specify customized index file location(s) if the data folder does not contain any index file πŸ—‚οΈ (yes i kept the original wording, she said "it will allows", we respect her). example usage:
samtools tview [options] -X </data_folder/data.bam>
[/index_folder/index.bai] [ref.fasta]
lowkey important: in.sorted.bam in the synopsis β€” the bam's gotta be sorted. the manpage says it, i'm saying it, we're all saying it together 🫢

πŸ‘‘ AUTHOR πŸ‘‘

written by Heng Li from the Sanger Institute πŸ’œ an absolute legend, we stan.


🌈 SEE ALSO 🌈


and that's the whole page bestie, every flag accounted for, nothing dropped, we ate and left no crumbs πŸ“

samtools-1.24 Β· 9 July 2026 β€” that's the version and date this page shipped with, mwah πŸ’‹ catch you in the next manpage πŸ˜­πŸ’–

πŸ“¦ where this page comes from