← ClaudeAtlas

samtools-bam-processinglisted

CLI toolkit for SAM/BAM/CRAM: sort, index, convert, filter, QC alignments. Core commands: view, sort, index, flagstat, stats, depth, markdup, merge. Required between alignment and variant/peak calling. Use pysam for Python-native BAM access; deeptools for normalized coverage tracks.
jaechang-hits/SciAgent-Skills · ★ 183 · AI & Automation · score 81
Install: claude install-skill jaechang-hits/SciAgent-Skills
# samtools — SAM/BAM/CRAM Alignment Toolkit ## Overview samtools is the standard command-line toolkit for processing sequence alignment files in SAM, BAM, and CRAM formats. It handles the complete alignment file lifecycle: format conversion, coordinate sorting, index creation, quality control statistics, read filtering, duplicate marking, and multi-file merging. samtools is a near-universal component of NGS pipelines between alignment (STAR, BWA) and downstream analysis (variant calling, peak calling, coverage). ## When to Use - Sorting BAM files by coordinate after alignment (required before indexing) - Indexing sorted BAM files for random access and region queries - Converting between SAM, BAM, and CRAM formats to save storage - Generating alignment QC metrics: mapping rates, insert sizes, per-chromosome stats - Filtering reads by mapping quality, FLAG bits, or genomic regions - Marking or removing PCR duplicates before variant calling - Merging multiple BAM files from different lanes or samples - Calculating per-base depth or coverage breadth for target regions - Use `pysam` instead for Python-native BAM manipulation in custom scripts - Use `deeptools bamCoverage` instead when you need normalized bigWig coverage tracks - Use `mosdepth` instead for whole-genome per-base depth (faster, parallelized) ## Prerequisites - **Installation**: samtools 1.17+ recommended - **Input requirements**: SAM/BAM/CRAM files; CRAM requires FASTA reference - **Companion tools**: `samtools