Plink/howto
From Icbwiki
Plink
Utilities to convert Illumina SNP report files to plink format are available in icb-commons/plink-adapters.
If multiple patient cohorts are genotyped with the same SNP platform, simply concatenate all the lgen files into one.
rm all.lgen
cat *.lgen >all-lgen
mv all-lgen all.lgen
sort -u *.samples| awk '{print "0 "$1" 0 0 other 1"}' > all.fam
# create the familly info file for case-control study (use zero for parents ids so that samples are considered founders).
Convert the lgen file to binary plink format:
plink --lfile all --no-sex --out all-1 --make-bed
Assign phenotype based on LOAD attribute in all-phenotypes.cov (generated by plink-adapters)
plink --bfile all-1 --out LOAD-vs-others --make-pheno all-phenotypes.cov LOAD --make-bed
Inspect the file
plink --bfile LOAD-vs-others
Calculate minor allele frequencies:
plink --bfile LOAD-vs-others --freq --out freqs --allow-no-sex
Association test
plink --bfile all-1 --out LOAD-vs-others --make-pheno all-phenotypes.cov LOAD --allow-no-sex --assoc sort -k 9 -n LOAD-associations.assoc
LD calculations
plink --bfile all-1 --make-pheno all-phenotypes.cov LOAD --r2 --out LD --ld-window-r2 0
Find SNPs on chromosome 10
plink --chr 10 --bfile all-1 --out chr10-snps --freq
Create combinations of any SNP on chromosome 10 with rs2986017
awk '{print "* "$2" rs2986017 "}' chr10-snps.frq > rs2986017.hlist
Impute haplotypes for each pair
plink --bfile all-1 --out all-haplo-rs2986017 --allow-no-sex --hap rs2986017.hlist --hap-impute
Output ends with:
Writing imputed ped file to [ all-haplo-rs2986017.impute.ped ] Writing imputed map file to [ all-haplo-rs2986017.impute.map ]
Use haplotypes to create new markers
plink --file all-haplo-rs2986017.impute --make-pheno all-phenotypes.cov LOAD --out all-haplo-rs2986017-imputed-2 --make-bed
Test associations with the haplotype markers
plink --bfile all-haplo-imputed-2 --make-pheno all-phenotypes.cov LOAD --assoc --ci 0.05 --out rs2986017-haplo-associations-ci
plink --file all-haplo.impute --out all-haplo-2 --allow-no-sex --hap rs2986017.hlist --make-pheno all-phenotypes.cov LOAD --make-bed
low-throughput genotyping
The following converts text input files to the lgen plink format:
awk '{print "0 "$1" rs2986018 "substr($2,1,1)" "substr($2,3,2); }' rs2986018 > rs2986018.lgen
Input are expected in the format (where the second field indicate the genotype, e.g., C/C, C/T, T/T, or A/A, A/C, C/C)
patient-id [tab] A/A
