GWAS logistic + 显性模型 回归分析

 

001、plink

复制代码
root@PC1:/home/test# ls
gwas_case_cont.map  gwas_case_cont.ped
root@PC1:/home/test# plink --file gwas_case_cont --logistic dominant beta 1> /dev/null   ## 使用显性模型分析
root@PC1:/home/test# ls
gwas_case_cont.map  gwas_case_cont.ped  plink.assoc.logistic  plink.log
root@PC1:/home/test# head -n 5 plink.assoc.logistic
 CHR        SNP         BP   A1       TEST    NMISS       BETA         STAT            P
   1       snp1       3046    A        DOM      288     0.1018       0.2601       0.7948
   1       snp2       3092    T        DOM      288     0.1018       0.2601       0.7948
   1       snp3       3174    T        DOM      288   -0.04925       -0.159       0.8737
   1       snp4      32399    T        DOM      288     0.0702       0.2153       0.8295
复制代码

 

 

002、R语言

复制代码
root@PC1:/home/test# ls
gwas_case_cont.map  gwas_case_cont.ped
root@PC1:/home/test# plink --file gwas_case_cont --recode A 1> /dev/null   ## 转换为数值型
root@PC1:/home/test# ls
gwas_case_cont.map  gwas_case_cont.ped  plink.log  plink.raw
root@PC1:/home/test# sed 1d plink.raw | cut -d " " -f 7- | sed 's/2/1/g' > temp
root@PC1:/home/test# sed -n 1p plink.raw | cat - <(sed 1d plink.raw | cut -d " " -f 1-6 | paste -d " " - temp ) > plink2.raw  ## 修改格式
root@PC1:/home/test# ls
gwas_case_cont.map  gwas_case_cont.ped  plink2.raw  plink.log  plink.raw  temp
root@PC1:/home/test# head plink2.raw | cut -d " " -f 1-10
FID IID PAT MAT SEX PHENOTYPE snp1_A snp2_T snp3_T snp4_T
A1 A1 0 0 1 1 1 1 0 0
A2 A2 0 0 1 1 0 0 0 0
A3 A3 0 0 1 1 0 0 0 0
A4 A4 0 0 1 1 0 0 0 0
A5 A5 0 0 1 1 0 0 0 0
A6 A6 0 0 1 1 0 0 0 0
A7 A7 0 0 1 1 0 0 0 0
A8 A8 0 0 1 1 0 0 0 0
A9 A9 0 0 1 1 0 0 0 0
复制代码

 

复制代码
dir()
library(data.table)
dat <- fread("plink2.raw", header = T, data.table = F)
dat <- dat[,-c(1,3:5)]
dat[,2] <- dat[,2] - 1

result <- data.frame()

for (i in 3:10) {
  logis <- glm(dat[,2]~dat[,i], family = "binomial", data = dat)
  result <- rbind(result, c(exp(logis$coefficients[2]),summary(logis)$coefficients[2,]))
}

names(result) <- c("OR",names(summary(logis)$coefficients[2,]))
result
复制代码

 

posted @   小鲨鱼2018  阅读(132)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2021-07-31 linux系统中scp命令实现服务器之间数据的传输
2021-07-31 SRA Toolkit的下载安装及使用
2021-07-31 NCBI中sra数据的下载
2018-07-31 linux 系统 grep 命令
点击右上角即可分享
微信分享提示