bcftools command
1. bcftools view
VCF/BCF 파일을 필터링하거나 서브셋을 추출할 때 사용됩니다.
# 특정 크롬소롬과 범위를 지정하여 필터링
bcftools view -r chr1:1000000-2000000 input.vcf
# 특정 샘플만 추출
bcftools view -s sample1,sample2 input.vcf
# 품질 기준으로 필터링
bcftools view -i 'QUAL>20' input.vcf
2. bcftools filter
VCF 파일에서 변이 필터링을 수행합니다.
# 품질 점수가 20보다 낮은 변이를 필터링
bcftools filter -e 'QUAL<20' input.vcf -o filtered.vcf
# 여러 조건을 사용하여 필터링
bcftools filter -e 'QUAL<20 || DP<10' input.vcf -o filtered.vcf
3. bcftools mpileup
bam 파일에서 다형성 호출을 위한 데이터 생성에 사용됩니다.
# bam 파일에서 mpileup 데이터 생성
bcftools mpileup -Ou -f reference.fa sample.bam | bcftools call -mv -Oz -o calls.vcf.gz
4. bcftools call
mpileup 데이터를 사용하여 변이를 호출합니다.
# mpileup 데이터에서 변이 호출
bcftools mpileup -Ou -f reference.fa sample.bam | bcftools call -mv -Oz -o calls.vcf.gz
5. bcftools merge
여러 VCF 파일을 병합합니다.
# 여러 VCF 파일을 병합
bcftools merge file1.vcf.gz file2.vcf.gz -Oz -o merged.vcf.gz
6. bcftools concat
연속적인 VCF 파일을 하나로 결합합니다.
# 여러 VCF 파일을 순차적으로 결합
bcftools concat part1.vcf.gz part2.vcf.gz -Oz -o concatenated.vcf.gz
7. bcftools stats
VCF 파일의 통계를 생성합니다.
# VCF 파일의 통계 생성
bcftools stats input.vcf > stats.txt
# 통계 결과를 시각화
plot-vcfstats -p plot/ stats.txt
8. bcftools annotate
VCF 파일에 주석을 추가하거나 기존 주석을 수정합니다.
# INFO 필드에 새로운 주석 추가
bcftools annotate -a annotation.vcf -c CHROM,POS,ANNO input.vcf -o annotated.vcf
# FORMAT 필드에서 주석을 제거
bcftools annotate -x FORMAT/DP input.vcf -o output.vcf
9. bcftools norm
VCF 파일을 정규화합니다. 예를 들어, 중복된 변이를 제거하거나, indel 변이를 표준화합니다.
# 중복된 변이 제거
bcftools norm -d all input.vcf -o normed.vcf
# 참조 유전자 서열을 기반으로 indel 변이 정규화
bcftools norm -f reference.fa input.vcf -o normed.vcf
10. bcftools reheader
VCF 파일의 헤더를 수정합니다.
# 샘플 이름 수정
bcftools reheader -s new_samples.txt input.vcf -o reheadered.vcf
https://samtools.github.io/bcftools/bcftools.html
bcftools(1)
Comma-separated list of columns or tags to carry over from the annotation file (see also -a, --annotations). If the annotation file is not a VCF/BCF, list describes the columns of the annotation file and must include CHROM, POS (or, alternatively, FROM,TO
samtools.github.io
https://samtools.github.io/bcftools/howtos/index.html
BCFtools HowTo
BCFtools is a program for variant calling and manipulating files in the Variant Call Format (VCF) and its binary counterpart BCF. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. In order to avoid tedious repe
samtools.github.io
'Bioinformatics' 카테고리의 다른 글
vcf <NON_REF> 해결 방법 (feat. GATK) (2) | 2025.01.07 |
---|---|
VCF 파일로 할 수 있는 분석 방법 (feat bcftools, snpEff) (2) | 2024.07.12 |
VCF 파일에서 Ts/Tv 비율 구하기 (1) | 2024.03.15 |
VCF 파일에서 SNP, Indel 개수 세기 (1) | 2024.03.13 |
VCF 파일에서 변이 개수 세기 (0) | 2024.03.13 |