前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >笔记 | GWAS 操作流程4-2:LM模型+数值协变量

笔记 | GWAS 操作流程4-2:LM模型+数值协变量

作者头像
邓飞
发布2020-05-26 10:13:33
1.1K0
发布2020-05-26 10:13:33
举报

上一篇,我们介绍了数量性状进行GWAS的一般线性模型分析的方法(笔记 | GWAS 操作流程4:LM模型assoc),这里我们考虑一下数字协变量,然后用R语言进行对比。

1. 协变量文件整理

第一列为FID 第二列为ID 第三列以后为协变量(注意,只能是数字,不能是字符!)

这里协变量文件为:

代码语言:javascript
复制
[dengfei@ny 03_linear_cov]$ head cov.txt 
1061 1061 F 3
1062 1062 M 3
1063 1063 F 3
1064 1064 F 3
1065 1065 F 3
1066 1066 F 3
1067 1067 F 3
1068 1068 M 3
1069 1069 M 3
1070 1070 M 3

这里第三列为性别,第四列为世代,为了方便操作,我们将世代作为数值,直接进行协变量分析

2. 数字协变量

代码语言:javascript
复制
awk '{print $1,$2,$4}' cov.txt >cov1.txt 

数据如下:

代码语言:javascript
复制
1061 1061 3
1062 1062 3
1063 1063 3
1064 1064 3
1065 1065 3
1066 1066 3
1067 1067 3
1068 1068 3
1069 1069 3
1070 1070 3

3. 进行数值协变量GWAS分析LM模型

「代码:」

代码语言:javascript
复制
plink --file b --pheno phe.txt --allow-no-sex --linear --covar cov1.txt --out re

「日志:」

代码语言:javascript
复制
PLINK v1.90b5.3 64-bit (21 Feb 2018)           www.cog-genomics.org/plink/1.9/
(C) 2005-2018 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to re.log.
Options in effect:
  --allow-no-sex
  --covar cov1.txt
  --file b
  --linear
  --out re
  --pheno phe.txt

515199 MB RAM detected; reserving 257599 MB for main workspace.
.ped scan complete (for binary autoconversion).
Performing single-pass .bed write (10000 variants, 1500 people).
--file: re-temporary.bed + re-temporary.bim + re-temporary.fam written.
10000 variants loaded from .bim file.
1500 people (0 males, 0 females, 1500 ambiguous) loaded from .fam.
Ambiguous sex IDs written to re.nosex .
1500 phenotype values present after --pheno.
Using 1 thread (no multithreaded calculations invoked).
--covar: 1 covariate loaded.
Before main variant filters, 1500 founders and 0 nonfounders present.
Calculating allele frequencies... done.
10000 variants and 1500 people pass filters and QC.
Phenotype data is quantitative.
Writing linear model association results to re.assoc.linear ... done.

「结果文件:」re.assoc.linear

「结果预览:」

在这里插入图片描述

这里的结果包括协变量的检验,我们不需要输出协变量结果,可以加上参数:--hide-covar

4. 使用R语言进行结果比较

代码语言:javascript
复制
library(data.table)
geno = fread("c.raw")
geno[1:10,1:10]
phe = fread("phe.txt")
cov = fread("cov.txt")
dd = data.frame(phe$V3,cov$V4,geno[,7:20])
head(dd)
str(dd)
mod_M7 = lm(phe.V3 ~ cov.V4 + M7_1,data=dd)
summary(mod_M7)
mod_M9 = lm(phe.V3 ~ cov.V4 + M9_1,data=dd);summary(mod_M9)

M7加上数值协变量结果:

M9加上数值协变量结果:

结果完全一致。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-05-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 育种数据分析之放飞自我 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 协变量文件整理
  • 2. 数字协变量
  • 3. 进行数值协变量GWAS分析LM模型
  • 4. 使用R语言进行结果比较
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档