# NOT RUN {
modelA <- epocA(X,U)
modelG <- epocG(X,U)
# plot sparsest A and G models using the igraph package
# arrows only tell direction, not inhibit or stimulate
par(mfrow=c(1,2))
plot(modelA)
plot(modelG)
# OpenGL 3D plot on sphere using the igraph and rgl packages
plot(modelA,threed=T)
# Write the graph to a file in SIF format for import in e.g. Cytoscape
write.sif(modelA,file="modelA.sif")
# plot graph in Cytoscape using Cytoscape XMLRPC plugin and
# R packages RCytoscape, bioconductor graph, XMLRPC
require('graph')
require('RCytoscape')
g <- as.graph.EPOCA(modelA,k=5)
cw <- CytoscapeWindow("EPoC", graph = g)
displayGraph(cw)
# prediction
N <- dim(X)[1]
ii <- sample(1:N, N/3)
modelG <- epocG(X[ii,], U[ii,])
K <- length(modelA$lambda) # densest model index index
newdata <- list(U=U[-ii,])
e <- X[-ii,] - predict(modelA, newdata, k=K)
RSS <- sum(e^2)
cat("RMSD:", sqrt(RSS/N), "\n")
# }
Run the code above in your browser using DataLab