Code Monkey home page Code Monkey logo

hyper-next's Introduction

hypeR Network Extension

hypeR

An extension of hypeR for network enrichment through random walks.

Installation

devtools::install_github("montilab/hypeR-next")
library(hypeR.next)

Data

data(ig)

This package works with undirected igraph objects or extensions of igraph objects.

is(ig)
[1] "igraph"

The following vertex attributes are expected at a minimum.

  • name - Unique node labels
  • symbol - 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"))
       community   color symbol   name
GMPS           8 #3E134F   GMPS   GMPS
PDLIM1        15 #9A9800 PDLIM1 PDLIM1
JUNB          15 #9A9800   JUNB   JUNB
RER1          17 #50E2BB   RER1   RER1
ICAM1         14 #A96C00  ICAM1  ICAM1
NPFFR2        14 #A96C00 NPFFR2 NPFFR2
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)

Network characterization through random walks

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.