samtools Command Examples

Tools for handling high-throughput sequencing (genomics) data. Used for reading/writing/editing/indexing/viewing of data in SAM/BAM/CRAM format. More information: https://www.htslib.org.

samtools view -S {{[-b|--bam]}} {{input.sam}} > {{output.bam}}

{{other_command}} | samtools view {{[-h|--with-header]}} - chromosome:start-end

samtools sort {{input}} {{[-o|--output]}} {{output.bam}}

samtools index {{sorted_input.bam}}

samtools flagstat {{sorted_input}}

samtools idxstats {{sorted_indexed_input}}

samtools merge {{output}} {{input1 input2 ...}}

samtools split {{merged_input}}