### R code from vignette source 'IntroDoFEM.Rnw' ### Encoding: UTF-8 ################################################### ### code chunk number 1: IntroDoFEM.Rnw:48-52 ################################################### library("igraph"); library("marray"); library("corrplot"); library("graph"); ################################################### ### code chunk number 2: IntroDoFEM.Rnw:57-58 ################################################### library("FEM"); ################################################### ### code chunk number 3: IntroDoFEM.Rnw:61-62 ################################################### data(Toydata) ################################################### ### code chunk number 4: IntroDoFEM.Rnw:66-67 ################################################### names(Toydata) ################################################### ### code chunk number 5: IntroDoFEM.Rnw:71-72 ################################################### head(Toydata$statM) ################################################### ### code chunk number 6: IntroDoFEM.Rnw:78-80 ################################################### rownames(Toydata$statM)[which(Toydata$statM[,1]>2)]->tennodes; tennodes; ################################################### ### code chunk number 7: IntroDoFEM.Rnw:83-84 ################################################### head(Toydata$statR) ################################################### ### code chunk number 8: IntroDoFEM.Rnw:87-88 ################################################### rownames(Toydata$statM)[which(Toydata$statR[,1]< -2)]; ################################################### ### code chunk number 9: IntroDoFEM.Rnw:95-98 ################################################### mod.idx <- match(Toydata$tennodes,rownames(Toydata$adj)); plot.igraph(graph.adjacency(Toydata$adjacency,mod="undirected"), vertex.size=8,mark.groups=mod.idx,mark.col="yellow") ################################################### ### code chunk number 10: IntroDoFEM.Rnw:105-106 ################################################### intFEM.o <- list(statM=Toydata$statM,statR=Toydata$statR,adj=Toydata$adj); ################################################### ### code chunk number 11: IntroDoFEM.Rnw:108-110 ################################################### DoFEMtoy.o <- DoFEMbi(intFEM.o,nseeds=1,gamma=0.5,nMC=1000, sizeR.v=c(1,100),minsizeOUT=10,writeOUT=TRUE,nameSTUDY="TOY",ew.v=NULL); ################################################### ### code chunk number 12: IntroDoFEM.Rnw:128-129 ################################################### DoFEMtoy.o$fem ################################################### ### code chunk number 13: IntroDoFEM.Rnw:134-135 ################################################### head(DoFEMtoy.o$topmod$SGMS2,n=5L) ################################################### ### code chunk number 14: IntroDoFEM.Rnw:139-142 ################################################### mod.idx<- match(DoFEMtoy.o$topmod$SGMS2[,1],rownames(Toydata$adj)); plot.igraph(graph.adjacency(Toydata$adjacency,mod="undirected"), vertex.size=8,mark.groups=mod.idx,mark.col="yellow") ################################################### ### code chunk number 15: IntroDoFEM.Rnw:147-149 ################################################### sensitivity=length(intersect(tennodes,rownames(Toydata$adj)[mod.idx]))/length(tennodes); sensitivity ################################################### ### code chunk number 16: IntroDoFEM.Rnw:158-160 ################################################### data(Realdata); attributes(Realdata); ################################################### ### code chunk number 17: IntroDoFEM.Rnw:164-165 ################################################### intFEM.o <- list(statM=Realdata$statM,statR=Realdata$statR,adj=Realdata$adj) ################################################### ### code chunk number 18: IntroDoFEM.Rnw:168-171 ################################################### #Realdata$fembi.o <- DoFEMbi(intFEM.o, # nseeds=100,gamma=0.5,nMC=1000,sizeR.v=c(1,100), # minsizeOUT=10,writeOUT=TRUE,nameSTUDY="TCGA-EC",ew.v=NULL); ################################################### ### code chunk number 19: IntroDoFEM.Rnw:176-177 ################################################### Realdata$fembi.o$fem ################################################### ### code chunk number 20: IntroDoFEM.Rnw:181-182 ################################################### Realdata$fembi.o$topmod ################################################### ### code chunk number 21: IntroDoFEM.Rnw:186-190 ################################################### library("marray"); library("corrplot"); HAND2.mod<-Realdata$fembi.o$topmod$HAND2; HAND2.graphNEL.o=FemModShow(Realdata$fembi.o$topmod$HAND2,name="HAND2",Realdata$fembi.o) ################################################### ### code chunk number 22: IntroDoFEM.Rnw:206-209 ################################################### #for(m in 1:length(names(Realdata$fembi.o$topmod))){ #FemModShow(Realdata$fembi.o$topmod[[m]], #name=names(Realdata$fembi.o$topmod)[m],Realdata$fembi.o)} ################################################### ### code chunk number 23: IntroDoFEM.Rnw:224-225 ################################################### #DoIntFEM450k(statM.o,statR.o,adj.m,cM,cR) ################################################### ### code chunk number 24: IntroDoFEM.Rnw:244-250 ################################################### #statM.o <- GenStatM(dnaM.m,phenoM.v,"450k"); #intEpi.o=DoIntEpi450k(statM.o,adj.m,c=1) #EpiMod.o=DoEpiMod(intEpi.o, # nseeds=100,gamma=0.5,nMC=1000,sizeR. # v=c(1,100), minsizeOUT=10,writeOUT=TRUE, # nameSTUDY="TCGA-EC",ew.v=NULL); ################################################### ### code chunk number 25: IntroDoFEM.Rnw:259-266 ################################################### #statR.o <- GenStatR(exp.m,pheno.v); #intExp.o=DoIntExp(statR.o,adj.m) #ExpMod.o=DoExpMod(intExp.o, # nseeds=100,gamma=0.5,nMC=1000, # sizeR.v=c(1,100),minsizeOUT=10, # writeOUT=TRUE,nameSTUDY="TCGA-EC",ew.v=NULL) # ################################################### ### code chunk number 26: IntroDoFEM.Rnw:274-287 ################################################### #library(minfi); #require(IlluminaHumanMethylation450kmanifest); #baseDIR <- getwd();# the base dir of the Rawdata #setwd(baseDIR); #targets <- read.450k.sheet(baseDIR);#read the csv file. #RGset <- read.450k.exp(baseDIR); #Reads an entire 450k experiment # using a sample sheet #MSet.raw <- preprocessRaw(RGset);#Converts the Red/Green channel for an Illumina # methylation array into methylation signal, # without using any normalization #beta.m <- getBeta(MSet.raw,type = "Illumina");# get normalized beta #pval.m <- detectionP(RGset,type ="m+u")