参考:PLINK | File format reference
vcftools
plink的主要功能:数据处理,质量控制的基本统计,群体分层分析,单位点的基本关联分析,家系数据的传递不平衡检验,多点连锁分析,单倍体关联分析,拷贝数变异分析,Meta分析等等。
首先必须了解plink的三种格式:bed、fam和bim。(注意:这里的bed和我们genome里的区域文件bed完全不同)
plink需要的格式一般可以从vcf文件转化而来 (顺便了解一下ped和map两种格式):
PED: Original standard text format for sample pedigree information and genotype calls. Normally must be accompanied by a .map file. 谱系信息和基因型信息。每一行是一个人。
MAP: Variant information file accompanying a .ped text pedigree + genotype table. 变异信息。每一行是一个变异 | snp。
# PED
1 1 0 0 1 0 G G 2 2 C C
1 2 0 0 1 0 A A 0 0 A C
1 3 1 2 1 2 0 0 1 2 A C
2 1 0 0 1 0 A A 2 2 0 0
2 2 0 0 1 2 A A 2 2 0 0
2 3 1 2 1 2 A A 2 2 A A
# MAP
1 snp1 0 1
1 snp2 0 2
1 snp3 0 3
# vcf转ped和map
plink --vcf file.vcf --recode --out file
# ped和map转bed、bim和fam
plink --file test --make-bed --out test
bed文件(真实的bed文件是二进制的,比较难读)
bed:Primary representation of genotype calls at biallelic variants. Must be accompanied by .bim and .fam files. Loaded with --bfile; generated in many situations, most notably when the --make-bed command is used. Do not confuse this with the UCSC Genome Browser's BED format, which is totally different. 基因型信息。所以转换后就是一个matrix,每一行是一个个体,每一列就是一个变异。其中0、1、2分别对应了aa、Aa或aA和AA。不考虑碱基型,因为我们不关注ATGC的变化。
fam:Sample information file accompanying a .bed binary genotype table. 样本信息。每一行就是一个样本。
bim:Extended variant information file accompanying a .bed binary genotype table. 每一行是一个变异,及其注释信息。
rs497038