select snps 基于不重要的 HWE 使用 R 中 SNPassoc 包中的 tableHWE
select snps based on non-significant HWE using tableHWE in SNPassoc package in R
我是运行一个使用SNPassoc包的GWAS分析。我想分两步进行此分析: 1. 测试所有 snps 以确定它们是否处于哈迪温堡平衡 (HWE); 2. 运行 对发现在 HWE 中的 snps 进行关联测试(使用 Bonfirroni 校正来校正错误发现)。
为了进行这些分析,我试图在 R 中使用 SNPassoc 包。使用这个包,首先使用函数 setupSNP 转换数据:
myData<-setupSNP(data=SNPs,colSNPs=1:10,sep="")
在此示例中,假设第 1 列是某个分类因变量,而 2-10 是具有三个级别 (AA、AB、BB)
的 snps
一旦数据采用这种格式,您就可以使用以下函数在所有 snps 中测试 HWE:
res<-tableHWE(myData)
生成以下 double,其中标志 <- 指向 <=.05
的 p 值
HWE (p value) flag
rs001 0.6211
rs002 0.8866
rs003 0.8210
rs004 0.8474
rs005 0.8364
rs006 0.4969
rs007 0.7229
rs008 0.0345 <-
我还可以执行一组自动比较,执行以下操作:
ans<-WGassociation(myData$DV~1,data=myData)
产生以下结果:
comments codominant dominant recessive overdominant log-additive
rs001 - 0.63396 0.60907 0.56673 0.34511 0.98948
rs002 - 0.43964 0.30132 0.65763 0.20148 0.53629
rs003 - 0.76300 0.79052 0.46217 0.90503 0.60872
rs004 - 0.54956 0.35198 0.39842 0.64349 0.27900
rs005 - 0.37222 0.32537 0.53702 0.15989 0.71894
rs006 - 0.32753 0.18286 0.84399 0.13830 0.34471
rs007 - 0.82284 0.75360 0.68389 0.56956 0.95867
rs008 - 0.77077 0.48628 0.73038 0.53702 0.47055
我想做的是 select 只有 HWE 中的那些 snps(即 p >.05),然后只对那些进行关联测试。有没有人知道如何做到这一点?我在文档中找不到它(见下文)
有关文档,请参阅:(http://davinci.crg.es/estivill_lab/tools/SNPassoc/SupplementaryMaterial.pdf)。
在我看来,您想将 data.frame 子集化为包含 HWE P > 0.05 的 SNP 的行,然后 运行 对剩余值进行关联测试。以 R 为基数:
# example object containing all snp data
all_snps <- data.frame(SNP_ID=paste("POS_", 1:1000, sep=""), stat1=sample(100, size=1000, replace=TRUE))
# example object containing hwe test
res <- data.frame(SNP_ID=paste("POS_", 1:1000, sep=""), HWE_P=runif(1000))
# subset the rows where P is > 0.05, extact vector of SNP IDs
SNPS_in_HWE <- subset(res, HWE_P > 0.05)$SNP_ID
# you can subset your "all snp data" object to the rows where the SNP ID is in the list of SNPs with P > 0.05
snps_in_HWE_subset <- all_snps[all_snps$SNP_ID %in% SNPS_in_HWE,]
# run the WGassociation function with this subset
ans<-WGassociation(snps_in_HWE_subset$DV~1,data=snps_in_HWE_subset)
我是运行一个使用SNPassoc包的GWAS分析。我想分两步进行此分析: 1. 测试所有 snps 以确定它们是否处于哈迪温堡平衡 (HWE); 2. 运行 对发现在 HWE 中的 snps 进行关联测试(使用 Bonfirroni 校正来校正错误发现)。
为了进行这些分析,我试图在 R 中使用 SNPassoc 包。使用这个包,首先使用函数 setupSNP 转换数据:
myData<-setupSNP(data=SNPs,colSNPs=1:10,sep="")
在此示例中,假设第 1 列是某个分类因变量,而 2-10 是具有三个级别 (AA、AB、BB)
一旦数据采用这种格式,您就可以使用以下函数在所有 snps 中测试 HWE:
res<-tableHWE(myData)
生成以下 double,其中标志 <- 指向 <=.05
的 p 值 HWE (p value) flag
rs001 0.6211
rs002 0.8866
rs003 0.8210
rs004 0.8474
rs005 0.8364
rs006 0.4969
rs007 0.7229
rs008 0.0345 <-
我还可以执行一组自动比较,执行以下操作:
ans<-WGassociation(myData$DV~1,data=myData)
产生以下结果:
comments codominant dominant recessive overdominant log-additive
rs001 - 0.63396 0.60907 0.56673 0.34511 0.98948
rs002 - 0.43964 0.30132 0.65763 0.20148 0.53629
rs003 - 0.76300 0.79052 0.46217 0.90503 0.60872
rs004 - 0.54956 0.35198 0.39842 0.64349 0.27900
rs005 - 0.37222 0.32537 0.53702 0.15989 0.71894
rs006 - 0.32753 0.18286 0.84399 0.13830 0.34471
rs007 - 0.82284 0.75360 0.68389 0.56956 0.95867
rs008 - 0.77077 0.48628 0.73038 0.53702 0.47055
我想做的是 select 只有 HWE 中的那些 snps(即 p >.05),然后只对那些进行关联测试。有没有人知道如何做到这一点?我在文档中找不到它(见下文)
有关文档,请参阅:(http://davinci.crg.es/estivill_lab/tools/SNPassoc/SupplementaryMaterial.pdf)。
在我看来,您想将 data.frame 子集化为包含 HWE P > 0.05 的 SNP 的行,然后 运行 对剩余值进行关联测试。以 R 为基数:
# example object containing all snp data
all_snps <- data.frame(SNP_ID=paste("POS_", 1:1000, sep=""), stat1=sample(100, size=1000, replace=TRUE))
# example object containing hwe test
res <- data.frame(SNP_ID=paste("POS_", 1:1000, sep=""), HWE_P=runif(1000))
# subset the rows where P is > 0.05, extact vector of SNP IDs
SNPS_in_HWE <- subset(res, HWE_P > 0.05)$SNP_ID
# you can subset your "all snp data" object to the rows where the SNP ID is in the list of SNPs with P > 0.05
snps_in_HWE_subset <- all_snps[all_snps$SNP_ID %in% SNPS_in_HWE,]
# run the WGassociation function with this subset
ans<-WGassociation(snps_in_HWE_subset$DV~1,data=snps_in_HWE_subset)