plink 软件中 --assoc (或 --linear)对数量性状进行关联分析中T检验,由T值计算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> /dev/null  ## 关联分析
root@DESKTOP-1N42TVH:/home/test4# ls
gwas_test.map  gwas_test.ped  test.log  test.qassoc
root@DESKTOP-1N42TVH:/home/test4# head test.qassoc   ## 查看结果文件
 CHR        SNP         BP    NMISS       BETA         SE         R2        T            P
   1       snp1       2802      541     -8.911      8.344   0.002111   -1.068        0.286
   1       snp2       2823      541      7.754      10.04   0.001104    0.772       0.4405
   1       snp3       4512      541      9.264      9.814    0.00165   0.9439       0.3456
   1       snp4      16529      541     -18.49      10.81   0.005401   -1.711      0.08769
   1       snp5      16578      541      5.661       9.93  0.0006026   0.5701       0.5689
   1       snp6      16579      541     -5.577      5.657     0.0018  -0.9858       0.3247
   1       snp7      16635      541      2.985      8.717  0.0002176   0.3425       0.7321
   1       snp8      20879      541      9.053       7.29   0.002853    1.242       0.2148
   1       snp9      20908      541      9.278      6.695    0.00355    1.386       0.1664

 

002、R语言中进行验证

dir()
dat <- read.table("test.qassoc", header = T)
dim(dat)
head(dat)
p_verify <- vector()
for (i in 1:nrow(dat)) {
  p_verify[i] <- 2 * pt(-abs(dat[i,8]), df = dat[i,4] - 1)   ## 由T值和自由度计算p值
}
dat$p_verify <- p_verify
head(dat)
cor(dat$P, dat$p_verify)            ## 计算相关

 

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