处理 SAM/BAM/CRAM 比对文件的核心工具箱。Core toolkit for manipulating SAM/BAM/CRAM alignment files.
mamba install -c bioconda samtools
SAM 转排序 BAM:
samtools sort -@ 8 -o sample.sorted.bam sample.sam
建立索引:
samtools index sample.sorted.bam
按区域查看:
samtools view -h sample.sorted.bam chr1:100000-200000
基础统计:
samtools flagstat sample.sorted.bam > sample.flagstat.txt
samtools idxstats sample.sorted.bam > sample.idxstats.txt
计算深度:
samtools depth -a sample.sorted.bam > sample.depth.tsv
view:查看、过滤、格式转换。sort:排序 BAM/CRAM。index:建立随机访问索引。flagstat / stats / idxstats:比对统计。depth:按位点深度。-@:线程数。