plink 软件中 --assoc 参数对二分类性状关联分析卡方值、及p值计算

 

001、

root@DESKTOP-1N42TVH:/home/test4# ls          ## 测试数据
gwas_test.map  gwas_test.ped
root@DESKTOP-1N42TVH:/home/test4# plink --file gwas_test --assoc --out test 1> /etc/null  ## 关联分析
root@DESKTOP-1N42TVH:/home/test4# ls
gwas_test.map  gwas_test.ped  test.assoc  test.log
root@DESKTOP-1N42TVH:/home/test4# head test.assoc
 CHR        SNP         BP   A1      F_A      F_U   A2        CHISQ            P           OR
   1       snp1       2802    G  0.08877   0.1094    T        1.296        0.255       0.7928
   1       snp2       2823    T  0.07065  0.05472    C        1.166       0.2803        1.313
   1       snp3       4512    G  0.07246  0.06038    A       0.6359       0.4252        1.216
   1       snp4      16529    T  0.06159  0.04717    C        1.091       0.2962        1.326
   1       snp5      16578    G  0.05978  0.06981    C       0.4494       0.5026       0.8472
   1       snp6      16579    C     0.25   0.3019    A        3.648      0.05615       0.7708
   1       snp7      16635    G  0.09239  0.08302    C       0.2966        0.586        1.124
   1       snp8      20879    T   0.1341   0.1264    G       0.1394       0.7089         1.07
   1       snp9      20908    C   0.1975   0.1358    T        7.369     0.006636        1.565

 

002、R语言中验证

dir()
dat <- read.table("test.assoc", header = T)       ## 读入数据
dim(dat)
head(dat)
p_verify <- vector()
for (i in 1:nrow(dat)) {
  p_verify[i] <- (1 - pchisq(dat[i,8], df = 1))
}
dat$p_verify <- p_verify
tail(dat)
cor(dat$P, dat$p_verify)

 

posted @ 2022-07-14 23:21  小鲨鱼2018  阅读(318)  评论(0编辑  收藏  举报