## Not run:
# # Load the XGR package and specify the location of built-in data
# library(XGR)
# RData.location <- "http://galahad.well.ox.ac.uk/bigdata_dev/"
#
# # a) provide the input nodes/genes with the significance info
# ## load human genes
# org.Hs.eg <- xRDataLoader(RData='org.Hs.eg',
# RData.location=RData.location)
# sig <- rbeta(500, shape1=0.5, shape2=1)
# data <- data.frame(symbols=org.Hs.eg$gene_info$Symbol[1:500], sig)
#
# # b) perform network analysis
# # b1) find maximum-scoring subnet based on the given significance threshold
# subnet <- xSubneterGenes(data=data, network="STRING_high",
# subnet.significance=0.01, RData.location=RData.location)
# # b2) find maximum-scoring subnet with the desired node number=50
# subnet <- xSubneterGenes(data=data, network="STRING_high",
# subnet.size=50, RData.location=RData.location)
#
# # c) save subnet results to the files called 'subnet_edges.txt' and 'subnet_nodes.txt'
# output <- igraph::get.data.frame(subnet, what="edges")
# utils::write.table(output, file="subnet_edges.txt", sep="\t",
# row.names=FALSE)
# output <- igraph::get.data.frame(subnet, what="vertices")
# utils::write.table(output, file="subnet_nodes.txt", sep="\t",
# row.names=FALSE)
#
# # d) visualise the identified subnet
# ## do visualisation with nodes colored according to the significance (you provide)
# xVisNet(g=subnet, pattern=-log10(as.numeric(V(subnet)$significance)),
# vertex.shape="sphere", colormap="wyr")
# ## do visualisation with nodes colored according to transformed scores
# xVisNet(g=subnet, pattern=as.numeric(V(subnet)$score),
# vertex.shape="sphere")
#
# # e) visualise the identified subnet as a circos plot
# library(RCircos)
# xCircos(g=subnet, entity="Gene", colormap="white-gray",
# RData.location=RData.location)
# ## End(Not run)
Run the code above in your browser using DataLab