본문 바로가기
Bioinformatics

[bcftools] 사용 방법/명령어 총정리 -2

by 코딩하는 미토콘드리아 bioinformatics 2023. 12. 13.
반응형

bcftools 사용법

출처:https://github.com/samtools/bcftools

 

 

GATK CombineVariants 에서 지정된 세트 확인하기

bcftools query -f out_combine.vcf.gz |sort |uniq

 

VCF 에서 샘플 리스트 확인하기

bcftools query -l test.vcf

 

지정 파일에서 snps 확인하기 

bcftools view -v snps sample.vcf.gz

 

VCF 에서 변이정보(variants) 확인하기 (0|0 genotypes 제외)

bcftools view -c1 input.vcf

 

VCF 에서 non-variants 정보 확인하기 (AC=0)

bcftools view -H -c0 input.vcf.gz

 

FORMAT 영역 필터링 하기

bcftools filter -sFilterName -e'FORMAT/DP<5' input.vcf

 

INFO 영역 필터링 하기

bcftools filter -sFilterName -e'INFO/DP<5' input.vcf

 

multiallelic snps 선택하기

bcftools view -m3 -v snps input.vcf.gz

 

quality <10 추출하기

bcftools view -i 'QUAL<10' in.vcf.gz

 

FORMAT 컬럼 (VCF 에서) 제거하기  (GT 정보 제외 하고 제거)

bcftools annotate -x FORMAT ifile.vcf.gz

 

INFO 영역 제거하기

bcftools annotate --remove INFO in.vcf.gz

 

다른 VCF 주석 (in.vcf.gz) 정보로 VCF 파일 (annt.vcf.gz) 주석하기 (INFO/DP 정보 주석)

bcftools annotate -c 'INFO/DP' -a annt.vcf.gz in.vcf.gz

 

VCF sample 이름 변경하기

bcftools reheader -s samplenames.txt oldsamplename.vcf.gz -o newsamplename.vcf.gz

 

결측 (uncalled) genotypes 불러오기 

bcftools view -u in.vcf.gz -o sample.vcf.gz -Oz

 

특정 AF (allele frequency) 에 대한 VCF 필터링 하기

bcftools view -i 'INFO/AF > 0.8' sample.vcf.gz

 

 

참고:https://samtools.github.io/bcftools/bcftools.html

 

bcftools(1)

HTSlib was designed with BCF format in mind. When parsing VCF files, all records are internally converted into BCF representation. Simple operations, like removing a single column from a VCF file, can be therefore done much faster with standard UNIX comman

samtools.github.io

반응형