001、
root@PC1:/home/test# ls gwas_test.bed gwas_test.bim gwas_test.fam root@PC1:/home/test# gcta64 --bfile gwas_test --make-grm --out gmat 1> /dev/null ## 生成亲缘关系矩阵 root@PC1:/home/test# ls gmat.grm.bin gmat.grm.id gmat.grm.N.bin gmat.log gwas_test.bed gwas_test.bim gwas_test.fam root@PC1:/home/test# gcta64 --grm gmat --grm-cutoff 0.04 --make-grm --out gmat2 1> /dev/null ## 剔除亲缘关系较近的个体 root@PC1:/home/test# ls gmat2.grm.bin gmat2.grm.N.bin gmat.grm.bin gmat.grm.N.bin gwas_test.bed gwas_test.fam gmat2.grm.id gmat2.log gmat.grm.id gmat.log gwas_test.bim root@PC1:/home/test# awk '{OFS = "\t"; print $1, $2, $6}' gwas_test.fam > phenotype.txt ## 提取表型数据 root@PC1:/home/test# gcta64 --grm gmat2 --pheno phenotype.txt --reml --out heritability 1> /dev/null ## 计算遗传力 root@PC1:/home/test# ls gmat2.grm.bin gmat2.grm.N.bin gmat.grm.bin gmat.grm.N.bin gwas_test.bed gwas_test.fam heritability.log gmat2.grm.id gmat2.log gmat.grm.id gmat.log gwas_test.bim heritability.hsq phenotype.txt root@PC1:/home/test# cat heritability.hsq ## 查看遗传力 Source Variance SE V(G) 2746.572134 5196.829394 V(e) 3701.195986 4998.514624 Vp 6447.768120 848.295747 V(G)/Vp 0.425973 0.790360 logL -602.427 logL0 -602.575 LRT 0.296 df 1 Pval 2.9307e-01 n 124 root@PC1:/home/test# ls gmat2.grm.bin gmat2.grm.N.bin gmat.grm.bin gmat.grm.N.bin gwas_test.bed gwas_test.fam heritability.log gmat2.grm.id gmat2.log gmat.grm.id gmat.log gwas_test.bim heritability.hsq phenotype.txt root@PC1:/home/test# plink --bfile gwas_test --pca 10 1> /dev/null ## 生成pca root@PC1:/home/test# ls gmat2.grm.bin gmat2.log gmat.grm.N.bin gwas_test.bim heritability.log plink.eigenvec gmat2.grm.id gmat.grm.bin gmat.log gwas_test.fam phenotype.txt plink.log gmat2.grm.N.bin gmat.grm.id gwas_test.bed heritability.hsq plink.eigenval root@PC1:/home/test# gcta64 --grm gmat2 --pheno phenotype.txt --reml --qcovar plink.eigenvec --out heritability2 1> /dev/null ## 把pca作为协变量 root@PC1:/home/test# ls gmat2.grm.bin gmat2.log gmat.grm.N.bin gwas_test.bim heritability2.log phenotype.txt plink.log gmat2.grm.id gmat.grm.bin gmat.log gwas_test.fam heritability.hsq plink.eigenval gmat2.grm.N.bin gmat.grm.id gwas_test.bed heritability2.hsq heritability.log plink.eigenvec root@PC1:/home/test# cat heritability2.hsq ## 查看遗传力 Source Variance SE V(G) 2674.861685 6039.792458 V(e) 3943.467510 5741.458624 Vp 6618.329195 934.087164 V(G)/Vp 0.404160 0.891956 logL -544.303 logL0 -544.406 LRT 0.206 df 1 Pval 3.2493e-01 n 124
参考:https://zhuanlan.zhihu.com/p/364046099