knitr::opts_chunk$set(message=FALSE, warning=FALSE, comment="") devtools::load_all(".") library(igraph) library(hypeR)
An extension of hypeR for network enrichment through random walks.
devtools::install_github("montilab/hypeR-next")
library(hypeR.next)
data(ig)
This package works with undirected igraph
objects or extensions of igraph
objects.
is(ig)
The following vertex attributes are expected at a minimum.
name
- Unique node labelssymbol
- Node symbols corresponding to the genesets you use community
- Pre-detected community labels color
- Community-specific colors head(igraph::as_data_frame(ig, what="vertices"))
set.seed(1) layout <- igraph::layout_with_graphopt(ig, start=NULL, niter=1000, charge=0.005, mass=30, spring.length=0, spring.constant=1, max.sa.movement=5) par(mar=c(0,0,0,0)) plot(ig, vertex.size=4, vertex.color="grey", vertex.frame.color="black", vertex.label=NA, edge.width=1, layout=layout)
library(hypeR) genesets <- hypeR::msigdb_gsets("Homo sapiens", "H", clean=TRUE)
ig.e <- enrich_communities_static(ig, genesets, restart=0.5, fdr=0.01, top=1)
par(mar=c(0,0,0,0)) set.seed(1234) plot(ig.e, vertex.size=5, vertex.label=V(ig.e)$enrichment, vertex.color=adjustcolor(V(ig.e)$color, alpha.f=0.6), vertex.frame.color=adjustcolor("#000000", alpha.f=0), vertex.label.family="Helvetica", vertex.label.color="black", vertex.label.font=2, vertex.label.cex=0.8, vertex.label.dist=runif(vcount(ig.e), -0.25, 0.25), edge.color=adjustcolor("#000000", alpha.f=0.2), layout=layout)
Please read the documentation for a comprehensive overview of functionality.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.