A colouriser for the SAM/BAM file format.
sampaint reads SAM or BAM files and outputs colourised SAM text, making it easier to visually scan alignment data. It can be used as a filter in a pipeline or as a standalone viewer.
# View a BAM file with colourised output
sampaint file.bam | less -SR
# Use as a filter in a pipeline
samtools view -h file.bam | sampaint | less -SR
# View multiple files
sampaint file1.bam file2.sam | less -SR
# Header only
sampaint -H file.bam
# Alignments only (no header)
sampaint -B file.bam- Header lines are syntax-coloured per field (@PG, @SQ, @RG, @HD)
- FLAG is coloured by meaning (unmapped, duplicate, reverse, etc.)
- MAPQ uses a red-to-green gradient (in 256-colour mode)
- SEQ bases are coloured per the IGV convention (A=green, C=blue, G=yellow, T=red)
- Tags containing DNA sequences (e.g. barcodes) are automatically detected and base-coloured
Terminal colour capabilities are auto-detected from $TERM and
$COLORTERM. Use --ansi to force basic 16-colour mode or --256 to
force extended 256-colour mode. For the full colour specification, see
docs/COLOURS.md.
cargo build --release