我正在使用SNPassoc包运行GWAS分析。我想分两个步骤进行分析: 1.测试所有snps,以确定它们是否处于hardy平衡(HWE);2.对被发现在HWE中的snps进行关联测试(使用Bonfirroni校正来纠正错误发现)。
为了进行这些分析,我尝试使用R中的SNPassoc包。使用这个包,首先使用函数setupSNP转换数据:
在本例中,假设列1是一些范畴因变量,2-10是具有三个级别(AA、AB、BB)的myData<-setupSNP(data=SNPs,colSNPs=1:10,sep="")。
一旦数据采用这种格式,就可以使用以下函数测试所有snps的HWE:
res<-tableHWE(myData)
产生以下双值,其中标志<-指向为<=.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我要做的是只选择那些在HWE中的snps (即p >.05),然后只对这些snps进行关联测试。有人知道怎么做吗?我在文档中找不到它(见下文)
有关文档,请参见(lab/tools/SNPassoc/SupplementaryMaterial.pdf)。
发布于 2018-03-31 03:27:44
在我看来,您想要将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)https://stackoverflow.com/questions/49583818
复制相似问题