samtools是一個用于操作sam和bam文件的工具合集。能夠?qū)崿F(xiàn)二進(jìn)制查看执庐、格式轉(zhuǎn)換、排序及合并等功能导梆,結(jié)合sam格式中的flag轨淌、tag等信息迂烁,還可以完成比對結(jié)果的統(tǒng)計匯總。
- samtools安裝
conda install -c bioconda samtools # 參考:https://anaconda.org/bioconda/samtools
samtools --help # 安裝完即可使用
#安裝路徑:/export/home/hushy/miniconda2/pkgs/samtools-1.9-h8571acd_11
- samtools用法
Usage: samtools <command> [options]
Commands:
-- Indexing
dict create a sequence dictionary file
faidx index/extract FASTA
fqidx index/extract FASTQ
index index alignment
-- Editing
calmd recalculate MD/NM tags and '=' bases
fixmate fix mate information
reheader replace BAM header
targetcut cut fosmid regions (for fosmid pool only)
addreplacerg adds or replaces RG tags
markdup mark duplicates
-- File operations
collate shuffle and group alignments by name
cat concatenate BAMs
merge merge sorted alignments
mpileup multi-way pileup
sort sort alignment file
split splits a file by read group
quickcheck quickly check if SAM/BAM/CRAM file appears intact
fastq converts a BAM to a FASTQ
fasta converts a BAM to a FASTA
-- Statistics
bedcov read depth per BED region
depth compute the depth
flagstat simple stats
idxstats BAM index stats
phase phase heterozygotes
stats generate stats (former bamcheck)
-- Viewing
flags explain BAM flags
tview text alignment viewer
view SAM<->BAM<->CRAM conversion
depad convert padded BAM to unpadded BAM