SAMtools
#
Find similar titles
- 최초 작성자
- 최근 업데이트
Structured data
- Category
- Analysis
- Software
Table of Contents
SAMtools (samtools) #
SAM #
SAM (Sequence Alignment/Map) 형식은 커다란 시퀀스 얼라인먼트를 저장하는 파일 포맷으로, 대부분의 시퀀싱 리드 매핑 프로그램들이 결과 포맷으로 사용하고 있다. SAM 파일은 시퀀싱 리드가 참조 유전체 서열의 어느 위치에 어떻게 매핑되었고 어떠한 서열로 이루어져 있는지 등, 매핑과 관련된 많은 정보를 담고 있으므로 대부분 파일 용량이 크다. 따라서, 파일 용량을 줄이기 위해서는 binary 형태인 BAM 포맷으로 변환하여 저장한다.
SAM 은 다양한 얼라인먼트 정보를 저장하고 있으며, index 파일을 생성해서 유전체 위치를 효과적으로 검색을 할 수도 있고, 전체의 얼라인먼트를 읽지 않아도 대부분 작업을 할 수 있습니다.
SAM format #
Col | Field | Description |
---|---|---|
1 | QNAME | Query template/pair NAME |
2 | FLAG | bitwise FLAG |
3 | RNAME | Reference sequence NAME |
4 | POS | 1-based leftmost POSition/coordinate of clipped sequence |
5 | MAPQ | MAPping Quality (Phred-scaled) |
6 | CIAGR | extended CIGAR string |
7 | MRNM | Mate Reference sequence NaMe (‘=’ if same as RNAME) |
8 | MPOS | 1-based Mate POSistion |
9 | TLEN | inferred Template LENgth (insert size) |
10 | SEQ | query SEQuence on the same strand as the reference |
11 | QUAL | query QUALity (ASCII-33 gives the Phred base quality) |
12 | OPT | variable OPTional fields in the format TAG:VTYPE:VALUE |
SAMtools #
SAM 포맷의 파일을 가지고 여러 가지 기능을 수행할 수 있는 커맨드 기반의 프로그램이다. SAMtools 로 분석하기 위해서는 SAM의 binary 형태인 BAM 으로 변환해야 한다. SAMtools 는 SAM 파일 안에서 얼라인먼트를 다루기 위한 다양한 프로그램을 제공합니다 (ex. sort, view, index, stats 등).
SAMtools 설치방법 #
-
압축파일 다운로드 받아서 설치
wget https://github.com/samtools/samtools/releases/download/1.17/samtools-1.17.tar.bz2 tar -xvf samtools-1.17.tar.bz2 cd samtools-1.17.tar.bz2 ./configure make make install
-
github를 통한 설치
git clone https://github.com/samtools/samtools.git cd samtools ./configure make make install
-
conda를 통한 설치
conda install -c bioconda samtools
SAMtools 명령어 #
1.17버전을 기준으로 함
- Indexing
Col | Field | Description |
---|---|---|
1 | dict | create a sequence dictionary file |
2 | faidx | index/extract FASTA |
3 | fqidx | index/extract FASTQ |
4 | index | index alignment |
- Editing
Col | Field | Description |
---|---|---|
1 | calmd | recalculate MD/NM tags and '=' bases |
2 | fixmate | fix mate information |
3 | reheader | replace BAM header |
4 | targetcut | cut fosmid regions (for fosmid pool only) |
5 | addreplacerg | adds or replaces RG tags |
6 | markdup | mark duplicates |
7 | ampliconclip | clip oligos from the end of reads |
- File operations
Col | Field | Description |
---|---|---|
1 | collate | shuffle and group alignments by name |
2 | cat | concatenate BAMs |
3 | consensus | produce a consensus Pileup/FASTA/FASTQ |
4 | merge | merge sorted alignments |
5 | mpileup | multi-way pileup |
6 | sort | sort alignment file |
7 | split | splits a file by read group |
8 | quickcheck | quickly check if SAM/BAM/CRAM file appears intact |
9 | fastq | converts a BAM to a FASTQ |
10 | fasta | converts a BAM to a FASTA |
11 | import | Converts FASTA or FASTQ files to SAM/BAM/CRAM |
12 | reference | Generates a reference from aligned data |
13 | reset | Reverts aligner changes in reads |
- Statistics
Col | Field | Description |
---|---|---|
1 | bedcov | read depth per BED region |
2 | coverage | alignment depth and percent coverage |
3 | depth | compute the depth |
4 | flagstat | simple stats |
5 | idxstats | BAM index stats |
6 | cram-size | list CRAM Content-ID and Data-Series sizes |
7 | phase | phase heterozygotest |
8 | stats | generate stats (former bamcheck) |
9 | ampliconstats | generate amplicon specific stats |
- Viewing
Col | Field | Description |
---|---|---|
1 | flags | explain BAM flags |
2 | head | header viewer |
3 | tview | text alignment viewer |
4 | view | SAM<->BAM<->CRAM conversion |
5 | depad | convert padded BAM to unpadded BAM |
6 | samples | list the samples in a set of SAM/BAM/CRAM files |
- Misc
Col | Field | Description |
---|---|---|
1 | help [cmd] | display this help message or help for [cmd] |
2 | version | detailed version information |
SAM workflow #
-
-
samtools view를 이용해서 변환한다.
samtools view -Sb -h -@ [threads] [SAM] -o [BAM] -S : input file 포맷 자동으로 확인함. -b : output file 포맷 BAM -h : SAM file header 출력 (사용하지 않으면, 매핑 결과부터 전환) -@ : 사용할 multi-core 수 -o : samtools view의 결과 파일 (사용하지 않으면, STDOUT)
-
-
Data processing을 간소화하기 위한 sorting
- 시퀀싱 리드 매핑 결과를 참조 유전체 서열의 포지션 별로 정렬하는 프로그램이다.
-
samtools sort를 이용해서 변환한다.
samtools sort -@ [threads] -o [sorted.bam] [BAM] -o : samtools sort의 결과 파일 (사용하지 않으면, STDOUT) -@ : 사용할 multi-core 수
-
sorted.bam file 내의 매핑 결과를 빠르게 접근하기 위한 index
samtool index -b -@ [threads] [sorted.bam] [out.index] -b : BAM file의 index (.bai 파일 생성) -@ : 사용할 multi-core 수
References #
- SAMtools Website 1
- SAMtools GitHub 2
- Li, Heng, et al.: The sequence alignment/map format and SAMtools. Bioinformatics 2009, 2078-2079. 3
Incoming Links #
Related Articles (Article 0) #
Related Bioinformaticses (Bioinformatics 1) #
- Biopython/GATK
- CoNIFER
- GATK
- GATK/VariantCalling
- MappingQuality
- STAR/Outputs
- Unmapped reads filtering
Suggested Pages #
- 0.414 PICARD
- 0.221 GBS read mapping/BWA
- 0.117 PICARD/MarkDuplicates
- 0.051 Alignment
- 0.045 TsTv
- 0.032 Reference-guided Alignment
- 0.029 파이썬/라이브러리/pySam
- 0.025 생물정보 데이터 형식
- 0.018 GBS read mapping
- 0.012 UniProt 데이터베이스의 구성
- More suggestions...