samtools

samtools

TLDR

Convert a SAM input file to BAM stream and save to file

>_ samtools view -S -b [input.sam] > [output.bam]
copy

Take input from stdin (-) and print the SAM header and any reads overlapping a specific region to stdout

>_ [other_command] | samtools view -h - chromosome:start-end
copy

Sort file and save to BAM (the output format is automatically determined from the output file's extension)

>_ samtools sort [input] -o [output.bam]
copy

Index a sorted BAM file (creates {{sorted_input.bam.bai}})

>_ samtools index [sorted_input.bam]
copy

Print alignment statistics about a file

>_ samtools flagstat [sorted_input]
copy

Count alignments to each index (chromosome / contig)

>_ samtools idxstats [sorted_indexed_input]
copy

Merge multiple files

>_ samtools merge [output] [input1 input2 …]
copy

Split input file according to read groups

>_ samtools split [merged_input]
copy

Copied to clipboard
free 100$ digital ocean credit