## ----include=FALSE, messages=FALSE, warnings=FALSE---------------------------- knitr::opts_chunk$set(message=FALSE, fig.width=6.75) devtools::load_all(".") library(tidyverse) library(magrittr) library(dplyr) library(reactable) ## ---- eval=FALSE-------------------------------------------------------------- # # devtools::install_github("montilab/hypeR") # ## ---- eval=FALSE-------------------------------------------------------------- # # BiocManager::install("montilab/hypeR", version="devel") # ## ----eval=FALSE--------------------------------------------------------------- # conda create --name hyper # source activate hyper # conda install -c r r-devtools # R # library(devtools) # devtools::install_github("montilab/hypeR") ## ----eval=FALSE--------------------------------------------------------------- # git clone https://github.com/montilab/hypeR # nano hypeR/DESCRIPTION # # Change Line 8 # # Depends: R (>= 3.6.0) -> Depends: R (>= 3.5.0) # R # install.packages("path/to/hypeR", repos=NULL, type="source") ## ---- eval=FALSE-------------------------------------------------------------- # # library(hypeR) # ## ----------------------------------------------------------------------------- # Simply a character vector of symbols (hypergeometric) signature <- c("GENE1", "GENE2", "GENE3") # A ranked character vector of symbols (kstest) ranked.signature <- c("GENE2", "GENE1", "GENE3") # A ranked named numerical vector of symbols with ranking weights (gsea) weighted.signature <- c("GENE2"=1.22, "GENE1"=0.94, "GENE3"=0.77) ## ----------------------------------------------------------------------------- genesets <- list("GSET1" = c("GENE1", "GENE2", "GENE3"), "GSET2" = c("GENE4", "GENE5", "GENE6"), "GSET3" = c("GENE7", "GENE8", "GENE9")) ## ----------------------------------------------------------------------------- hypdat <- readRDS(file.path(system.file("extdata", package="hypeR"), "hypdat.rds")) ## ----------------------------------------------------------------------------- limma <- hypdat$limma reactable(limma) ## ----------------------------------------------------------------------------- genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG") ## ----------------------------------------------------------------------------- signature <- limma %>% filter(t > 0 & fdr < 0.001) %>% use_series(symbol) ## ----------------------------------------------------------------------------- length(signature) head(signature) ## ----------------------------------------------------------------------------- hyp_obj <- hypeR(signature, genesets, test="hypergeometric", background=50000, fdr=0.01, plotting=TRUE) hyp_obj$plots[[1]] ## ----------------------------------------------------------------------------- signature <- limma %>% arrange(desc(t)) %>% use_series(symbol) ## ----------------------------------------------------------------------------- length(signature) head(signature) ## ----------------------------------------------------------------------------- hyp_obj <- hypeR(signature, genesets, test="kstest", fdr=0.05, plotting=TRUE) hyp_obj$plots[[1]] ## ----------------------------------------------------------------------------- signature <- limma %>% arrange(desc(t)) %>% select(symbol, t) %>% deframe() ## ----------------------------------------------------------------------------- length(signature) head(signature) ## ----------------------------------------------------------------------------- hyp_obj <- hypeR(signature, genesets, test="kstest", fdr=0.05, plotting=TRUE) hyp_obj$plots[[1]] ## ----------------------------------------------------------------------------- print(hyp_obj) ## ---- eval=FALSE-------------------------------------------------------------- # # # Show interactive table # hyp_show(hyp_obj) # # # Plot dots plot # hyp_dots(hyp_obj) # # # Plot enrichment map # hyp_emap(hyp_obj) # # # Plot hiearchy map # hyp_hmap(hyp_obj) # # # Save to excel # hyp_to_excel(hyp_obj) # # # Save to table # hyp_to_table(hyp_obj) # # # Generate markdown report # hyp_to_rmd(hyp_obj) #