VCFtools用来处理VCF文档。可以1,筛选特定突变 2,比较文件 3,总结突变 4,转化文件格式 5,验证并合并文件 6,取突变交集和差集
Get basic file statistics
input可以为VCF或BCF格式(--vcf --gvcf or --bcf
)。
vcftools --vcf cohort.intersect.vcf
or
zcat cohort.intersect.vcf | vcftools --vcf -
会输出总的个体数和总突变数。
Applying a filter
可以把筛选的突变写入一个新文件。--recode
表示输出筛选的内容,--recode-INFO-all
保留所有的INFO fields的内容。default情况下,INFO fields不写,因为筛选会改变文件里的突变情况。染色体名字要注意,比如是chr1还是1。要写全。
vcftools --vcf cohort.intersect.vcf --chr chr1 --from-bp 1000000 --to-bp 2000000 --recode --recode-INFO-all
输出到特定的位置和特定的文件名
vcftools --vcf cohort.intersect.vcf --chr chr1 --from-bp 1000000 --to-bp 2000000 --recode --recode-INFO-all --out subset
Writing out to screen
用--stdout or -c
可以重定位所有输出到标准输出,可以通过管道输出给别的软件或者直接输入到某个输出文件。
vcftools --vcf cohort.intersect.vcf --chr chr1 --from-bp 1000000 --to-bp 2000000 --recode --stdout | more
vcftools --vcf cohort.intersect.vcf --chr chr1 --from-bp 1000000 --to-bp 2000000 --recode -c > ../subset.vcf
vcftools --vcf cohort.intersect.vcf --chr chr1 --from-bp 1000000 --to-bp 2000000 --recode -c |gzip -c > ../subset.vcf.gz
comparing two files
比较2个VCF文件,看哪些个体或者位点是2个文件共享的。指定第二个文件要用--diff --gzdiff or --diff-bcf
。
vcftools --vcf input_data.vcf --diff other_data.vcf --out compare
Getting allele frequency
vcftools --vcf cohort.intersect.vcf --freq --out output
CHROM POS N_ALLELES N_CHR {ALLELE:FREQ}
chr1 861315 2 604 G:0.996689 A:0.00331126
chr1 865655 2 604 T:0.998344 A:0.00165563
chr1 865664 2 604 C:0.998344 T:0.00165563
Getting sequencing depth information
总结测序深度。
vcftools --vcf cohort.intersect.vcf --depth -c > depth_summary.txt
Getting linkage disequilibrium statistics
计算连锁不平衡。可以用--hap-r2 --geno-r2 or --geno-chisq
。因为是两两比较,比较耗费时间,建议用--ld-windows --ld-windows-bp or --min-r2
去减少比较的次数。
vcftools --vcf cohort.intersect.vcf --hap-r2 --ld-window-bp 500000 --out ld_windows_500000
Getting Fst population statistics
必须提供text文件,每行一个个体(同一个population)。
vcftools --vcf input_data.vcf --weir-fst-pop population_1.txt --weir-fst-pop population_2.txt --out pop1_vs_pop2
Converting VCF files to PLINK format
vcftools --vcf input_data.vcf --plink --chr 1 --out output_in_plink