### R代码来自vignette源代码的GSReg。Rnw ' ################################################### ### 代码块1号:开始 ################################################### 选项(宽度= 85)选项(继续= " ")# rm(列表= ls ()) ################################################### ### 代码块2号:GSReg。Rnw: 165 - 170 ################################################### 库(GSBenchMark)数据(diracpathways)类(diracpathways)名称(diracpathways)[1:5]类(diracpathways [[1 ]]) ################################################### ### 代码块3号:GSReg。Rnw: 179 - 181 ################################################### 数据(GSBenchMarkDatasets)打印(GSBenchMark.Dataset.names ) ################################################### ### 代码块数量4:GSReg。Rnw: 187 - 190 ################################################### DataSetStudy = GSBenchMark.Dataset.names[[9]]打印(DataSetStudy)数据(= DataSetStudy列表 ) ################################################### ### 代码块5号:GSReg。Rnw: 199 - 201 ################################################### 如果总和(应用(is.nan (exprsdata), 1,总和)> 0))exprsdata = exprsdata[——(应用(is.nan (exprsdata), 1,总和)> 0),);################################################### ### 代码块6号:GSReg。Rnw: 205 - 207 ################################################### genenames = rownames (exprsdata);genenames [1:10 ] ################################################### ### 代码块7号:GSReg。Rnw: 237 - 238 ################################################### 库(GSReg ) ################################################### ### 代码块8号:GSReg。Rnw: 244 - 248 ################################################### Nperm = 10系统。时间({DIRACperm = GSReg.GeneSets.DIRAC (exprsdata diracpathways,表型,Nperm = Nperm)})系统。时间({DIRACAn = GSReg.GeneSets.DIRAC (exprsdata diracpathways,表型 )}) ################################################### ### 代码块9号:GSReg。Rnw: 251 - 252 ################################################### 嘘(DIRACAn pvalues美元,xlab =“pvalue”,主要= "嘘pvalues应用狄拉克的分析 .") ################################################### ### 代码块10号:GSReg。Rnw: 259 - 268 ################################################### 情节(x = abs (DIRACAn zscores美元),y = DIRACperm pvalues美元,xlab =“| z分数|”, ylab="p-value",col="red1",main="DIRAC p-value comparisons") zscorelin <- seq(min(abs(DIRACAn$zscores)),max(abs(DIRACAn$zscores)),by = 0.1) pvaltheoretic = (1-pnorm(zscorelin))*2 lines(x=zscorelin,y=pvaltheoretic,type="l",pch=50,lty=5,col="darkblue") legend("topright",legend=c("permutation test","Normal Approx."), col=c("red1","blue"),text.col=c("red1","blue"), lty=c(NA,1),lwd=c(NA,2.5),pch=c(21,NA)) ################################################### ### code chunk number 11: GSReg.Rnw:300-309 ################################################### #Calculating the variance for the pathways #Calculate how much it takes to calculate the statistics and their p-value for all pathways system.time({VarAnKendallV = GSReg.GeneSets.EVA(geneexpres=exprsdata, pathways=diracpathways, phenotypes=as.factor(phenotypes)) }) names(VarAnKendallV)[[1]] VarAnKendallV[[1]] ################################################### ### code chunk number 12: GSReg.Rnw:320-337 ################################################### Nperm = 10; VarAnPerm = vector(mode="list",length=Nperm) for( i in seq_len(Nperm)) { VarAnPerm[[i]] = GSReg.GeneSets.EVA(geneexpres=exprsdata, pathways=diracpathways, phenotypes=sample(phenotypes)) } pvaluesperm = vector(mode="numeric",length=length(VarAnPerm[[1]])) for( i in seq_along(VarAnPerm[[1]])) { z = sapply(VarAnPerm,function(x) x[[i]]$E1 - x[[i]]$E2) pvaluesperm[i] = mean(abs(VarAnKendallV[[i]]$E1-VarAnKendallV[[i]]$E2)