### R code from vignette source 'GSReg.Rnw' ################################################### ### code chunk number 1: start ################################################### options(width=85) options(continue=" ") #rm(list=ls()) ################################################### ### code chunk number 2: GSReg.Rnw:166-171 ################################################### library(GSBenchMark) data(diracpathways) class(diracpathways) names(diracpathways)[1:5] class(diracpathways[[1]]) ################################################### ### code chunk number 3: GSReg.Rnw:180-182 ################################################### data(GSBenchMarkDatasets) print(GSBenchMark.Dataset.names) ################################################### ### code chunk number 4: GSReg.Rnw:188-191 ################################################### DataSetStudy = GSBenchMark.Dataset.names[[9]] print(DataSetStudy) data(list=DataSetStudy) ################################################### ### code chunk number 5: GSReg.Rnw:200-202 ################################################### if(sum(apply(is.nan(exprsdata),1,sum)>0)) exprsdata = exprsdata[-which(apply(is.nan(exprsdata),1,sum)>0),]; ################################################### ### code chunk number 6: GSReg.Rnw:206-208 ################################################### genenames = rownames(exprsdata); genenames[1:10] ################################################### ### code chunk number 7: GSReg.Rnw:238-239 ################################################### library(GSReg) ################################################### ### code chunk number 8: GSReg.Rnw:245-247 ################################################### Nperm = 10 system.time({DIRACAn =GSReg.GeneSets.DIRAC(exprsdata,diracpathways,phenotypes,Nperm=Nperm)}) ################################################### ### code chunk number 9: GSReg.Rnw:250-251 ################################################### hist(DIRACAn$pvalues,xlab="pvalue",main="Hist of pvalues applying DIRAC Analysis.") ################################################### ### code chunk number 10: GSReg.Rnw:272-281 ################################################### #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 11: GSReg.Rnw:292-309 ################################################### 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)