Package 'hypeR'

Title: An R Package For Geneset Enrichment Workflows
Description: An R Package for Geneset Enrichment Workflows.
Authors: Anthony Federico [aut, cre], Andrew Chen [aut], Stefano Monti [aut]
Maintainer: Anthony Federico <[email protected]>
License: GPL-3 + file LICENSE
Version: 2.3.0
Built: 2024-07-03 04:18:10 UTC
Source: https://github.com/bioc/hypeR

Help Index


Clean labels of genesets

Description

Clean labels of genesets

Usage

clean_genesets(x)

Arguments

x

A vector of labels

Examples

HALLMARK <- msigdb_download("Homo sapiens", "H", "")
names(HALLMARK) <- clean_genesets(names(HALLMARK))
head(names(HALLMARK))

Get enrichr available genesets

Description

Get enrichr available genesets

Usage

enrichr_available(
  db = c("Enrichr", "YeastEnrichr", "FlyEnrichr", "WormEnrichr", "FishEnrichr")
)

Arguments

db

A species

Value

A dataframe of available genesets

Examples

enrichr_available()

Download data from enrichr in the form of a named list

Description

Download data from enrichr in the form of a named list

Usage

enrichr_download(
  genesets,
  db = c("Enrichr", "YeastEnrichr", "FlyEnrichr", "WormEnrichr", "FishEnrichr")
)

Arguments

genesets

A name corresponding to available genesets

db

A species

Value

A list of genesets

Examples

ATLAS <- enrichr_download("Human_Gene_Atlas")

Download data from enrichr in the form of a gsets object

Description

Download data from enrichr in the form of a gsets object

Usage

enrichr_gsets(
  genesets,
  db = c("Enrichr", "YeastEnrichr", "FlyEnrichr", "WormEnrichr", "FishEnrichr"),
  clean = FALSE
)

Arguments

genesets

A name corresponding to available genesets

db

A species

clean

Use true to clean labels of genesets

Value

A gsets object

Examples

ATLAS <- enrichr_gsets("Human_Gene_Atlas")

Shiny server module for geneset selection

Description

Shiny server module for geneset selection

Usage

genesets_Server(id, clean = FALSE)

Arguments

id

A unique namespace identifier matching to interface

clean

Use true to clean geneset names

Value

Shiny server code


Shiny interface module for geneset selection

Description

Shiny interface module for geneset selection

Usage

genesets_UI(id)

Arguments

id

A unique namespace identifier

Value

Shiny ui elements


An empty ggplot

Description

An empty ggplot

Usage

ggempty()

Value

A ggplot object


Enrichment plot implemented in ggplot

Description

Enrichment plot implemented in ggplot

Usage

ggeplot(n, positions, x_axis, y_axis, title = "")

Arguments

n

The length of a ranked list

positions

A vector of positions in the ranked list

x_axis

The x-axis of a running enrichment score

y_axis

The y-axis of a running enrichment score

title

Plot title

Value

A ggplot object


Venn diagram implemented in ggplot

Description

Venn diagram implemented in ggplot

Usage

ggvenn(a, b, ga, gb, title = "")

Arguments

a

A vector for group a

b

A vector for group b

ga

A string label for group a

gb

A string label for group b

title

Plot title

Value

A ggplot object


A genesets object

Description

A genesets object

A genesets object

See Also

rgsets

Public fields

genesets

A named list of genesets

name

A character vector describing source of genesets

version

A character vector describing versioning

Methods

Public methods


Method new()

Create a gsets object

Usage
gsets$new(
  genesets,
  name = "Custom",
  version = "",
  clean = FALSE,
  quiet = FALSE
)
Arguments
genesets

A named list of genesets

name

A character vector describing source of genesets

version

A character vector describing versioning

clean

Use true to clean labels of genesets

quiet

Use true to silence warnings

Returns

A new gsets object


Method print()

Print genesets information

Usage
gsets$print()
Returns

NULL


Method list()

Return genesets as a list

Usage
gsets$list()
Returns

A list of genesets


Method info()

Returns versioning information

Usage
gsets$info()
Returns

A character vector with name and version


Method reduce()

Reduces genesets to a background distribution of symbols

Usage
gsets$reduce(background)
Arguments
background

A character vector of symbols

Returns

A gsets object


Method clone()

The objects of this class are cloneable with this method.

Usage
gsets$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

genesets <- list("GSET1" = c("GENE1", "GENE2", "GENE3"),
                 "GSET2" = c("GENE4", "GENE5", "GENE6"),
                 "GSET3" = c("GENE7", "GENE8", "GENE9"))

gsets_obj <- gsets$new(genesets, name="example", version="v1.0")
print(gsets_obj)

A hyp object

Description

A hyp object

A hyp object

See Also

multihyp

Public fields

data

A dataframe returned by hypeR()

plots

A list of plots returned by hypeR()

args

A list of arguments passed to hypeR()

info

Exported information for reproducibility

Methods

Public methods


Method new()

Create a hyp object

Usage
hyp$new(data, plots = NULL, args = NULL, info = NULL)
Arguments
data

A dataframe returned by hypeR()

plots

A list of plots returned by hypeR()

args

A list of arguments passed to hypeR()

info

Exported information for reproducibility

Returns

A new hyp object


Method print()

Print hyp obect

Usage
hyp$print()
Returns

NULL


Method as.data.frame()

Extract dataframe from hyp obect

Usage
hyp$as.data.frame()
Returns

NULL


Method clone()

The objects of this class are cloneable with this method.

Usage
hyp$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

data <- data.frame(replicate(5,sample(0:1,10,rep=TRUE)))
args <- list("arg_1"=1, "arg_2"=2, "arg_3"=3)
hyp_obj <- hyp$new(data, args=args)

Visualize hyp/multihyp objects as a dots plot

Description

Visualize hyp/multihyp objects as a dots plot

Usage

hyp_dots(
  hyp_obj,
  top = 20,
  abrv = 50,
  size_by = c("genesets", "significance", "none"),
  pval = 1,
  fdr = 1,
  val = c("fdr", "pval"),
  title = "",
  merge = FALSE
)

Arguments

hyp_obj

A hyp or multihyp object

top

Limit number of genesets shown

abrv

Abbreviation length of geneset labels

size_by

Size dots by e.g. c("genesets", "significance", "none")

pval

Filter results to be less than pval cutoff

fdr

Filter results to be less than fdr cutoff

val

Choose significance value for plot e.g. c("fdr", "pval")

title

Plot title

merge

Use true to merge a multihyp object into one plot

Value

A ggplot object

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_dots(hyp_obj, val="fdr")

Visualize hyp/multihyp objects as an enrichment map

Description

Visualize hyp/multihyp objects as an enrichment map

Usage

hyp_emap(
  hyp_obj,
  similarity_metric = c("jaccard_similarity", "overlap_similarity"),
  similarity_cutoff = 0.2,
  pval = 1,
  fdr = 1,
  val = c("fdr", "pval"),
  top = NULL,
  title = ""
)

Arguments

hyp_obj

A hyp or multihyp object

similarity_metric

Metric to calculate geneset similarity

similarity_cutoff

Geneset similarity cutoff

pval

Filter results to be less than pval cutoff

fdr

Filter results to be less than fdr cutoff

val

Choose significance value shown above nodes e.g. c("fdr", "pval")

top

Limit number of pathways shown

title

Plot title

Value

A visNetwork object

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_emap(hyp_obj, top=30, val="fdr")

Visualize hyp/multihyp objects as a hiearchy map

Description

Visualize hyp/multihyp objects as a hiearchy map

Usage

hyp_hmap(
  hyp_obj,
  pval = 1,
  fdr = 1,
  val = c("fdr", "pval"),
  top = NULL,
  title = "",
  graph = FALSE
)

Arguments

hyp_obj

A hyp or multihyp object

pval

Filter results to be less than pval cutoff

fdr

Filter results to be less than fdr cutoff

val

Choose significance value displayed when hovering nodes e.g. c("fdr", "pval")

top

Limit number of pathways shown

title

Plot title

graph

Return an igraph object instead

Value

A visNetwork object

Examples

genesets <- hyperdb_rgsets("REACTOME", "70.0")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_hmap(hyp_obj, top=60)

Convert a hyp object to a reactable table

Description

Convert a hyp object to a reactable table

Usage

hyp_show(hyp_obj, simple = FALSE)

Arguments

hyp_obj

A hyp object

simple

Use true to only include essential columns

Value

A reactable table

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_show(hyp_obj)

Export hyp/multihyp object to excel

Description

Export hyp/multihyp object to excel

Usage

hyp_to_excel(hyp_obj, file_path, cols = NULL, versioning = TRUE)

Arguments

hyp_obj

A hyp or multihyp object

file_path

A file path

cols

Dataframe columns to include

versioning

Add sheet with versioning information

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_to_excel(hyp_obj, file_path="pathways.xlsx")

Convert a hyp object to an igraph object

Description

Convert a hyp object to an igraph object

Usage

hyp_to_graph(hyp_obj)

Arguments

hyp_obj

A hyp object

Value

An igraph object

Examples

genesets <- hyperdb_rgsets("REACTOME", "70.0")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

ig <- hyp_to_graph(hyp_obj)

Export hyp object to rmarkdown

Description

Export hyp object to rmarkdown

Usage

hyp_to_rmd(
  hyp_obj,
  file_path,
  title = "Workflow Report",
  subtitle = "",
  author = "",
  header = "Results",
  versioning = TRUE,
  show_dots = TRUE,
  show_emaps = TRUE,
  show_hmaps = FALSE,
  show_tables = TRUE,
  hyp_dots_args = list(top = 15, val = "fdr"),
  hyp_emap_args = list(top = 25, val = "fdr", similarity_metric = "jaccard_similarity",
    similarity_cutoff = 0.2),
  hyp_hmap_args = list(top = 25, val = "fdr"),
  custom_rmd_config = NULL,
  custom_pre_content = NULL,
  custom_post_content = NULL,
  session_info = FALSE
)

Arguments

hyp_obj

A hyp object, multihyp object, or list of multihyp objects

file_path

A file path

title

Title of markdown report

subtitle

Subtitle of markdown report

author

Authors of markdown report

header

Header name of tabset section

versioning

Add versioning information

show_dots

Option to show dots plots in tabs

show_emaps

Option to show enrichment maps in tabs

show_hmaps

Option to show hiearchy maps in tabs

show_tables

Option to show table in tabs

hyp_dots_args

A list of keyword arguments passed to hyp_dots

hyp_emap_args

A list of keyword arguments passed to hyp_emap

hyp_hmap_args

A list of keyword arguments passed to hyp_hmap

custom_rmd_config

Replace configuration section of markdown report

custom_pre_content

Insert custom content before tabset section

custom_post_content

Insert custom content after tabset section

session_info

Use true to include session info


Export hyp/multihyp object to table

Description

Export hyp/multihyp object to table

Usage

hyp_to_table(hyp_obj, file_path, sep = "\t", cols = NULL, versioning = TRUE)

Arguments

hyp_obj

A hyp or multihyp object

file_path

A file path for hyp objects and directory for multihyp objects

sep

The field separator string

cols

Dataframe columns to include

versioning

Add header with versioning information

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

hyp_to_table(hyp_obj, file_path="pathways.txt")

Calculate enrichment of one or more signatures

Description

Calculate enrichment of one or more signatures

Usage

hypeR(
  signature,
  genesets,
  test = c("hypergeometric", "kstest"),
  background = 23467,
  power = 1,
  absolute = FALSE,
  pval = 1,
  fdr = 1,
  plotting = FALSE,
  quiet = TRUE
)

Arguments

signature

A vector of symbols

genesets

A gsets/rgsets object or a named list of genesets

test

Choose an enrichment type e.g. c("hypergeometric", "kstest")

background

Size or character vector of background population genes

power

Exponent for weights (kstest only)

absolute

Takes max-min score rather than the max deviation from null (kstest only)

pval

Filter results to be less than pval cutoff

fdr

Filter results to be less than fdr cutoff

plotting

Use true to generate plots for each geneset test (may slow performance)

quiet

Use true to suppress logs and warnings

Value

A hyp object

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
               "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
               "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

Check available data to download from hyperdb

Description

Check available data to download from hyperdb

Usage

hyperdb_available()

Examples

hyperdb_available()

Download data from hyperdb

Description

Download data from hyperdb

Usage

hyperdb_gsets(source, gsets)

Arguments

source

A source identifier

gsets

A genesets identifier

Value

A list

Examples

KEGG <- hyperdb_gsets("KEGG", "KEGG_v92.0.rds")

Download data from hyperdb in the form of a rgsets object

Description

Download data from hyperdb in the form of a rgsets object

Usage

hyperdb_rgsets(rgsets, version)

Arguments

rgsets

A name corresponding to an available relational genesets object

version

A version number

Value

An rgsets object

Examples

REACTOME <- hyperdb_rgsets("REACTOME", "70.0")

Differential Expression

Description

A differential expression table

Usage

limma

Format

A data frame


Get msigdbr available genesets

Description

Get msigdbr available genesets

Usage

msigdb_available(species = "Homo sapiens")

Arguments

species

A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)

Value

A dataframe of available genesets

Examples

msigdb_available("Homo sapiens")

Download data from msigdb in the form of a named list

Description

Download data from msigdb in the form of a named list

Usage

msigdb_download(species, category, subcategory = "")

Arguments

species

A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)

category

Geneset category (refer to ?msigdbr::msigdbr for avilable categories)

subcategory

Geneset subcategory (refer to ?msigdbr::msigdbr for avilable subcategories)

Value

A list of genesets

Examples

HALLMARK <- msigdb_download("Homo sapiens", "H", "")

Download data from msigdb in the form of a gsets object

Description

Download data from msigdb in the form of a gsets object

Usage

msigdb_gsets(species, category, subcategory = "", clean = FALSE)

Arguments

species

A species to determine gene symbols (refer to ?msigdbr::msigdbr for avilable species)

category

Geneset category (refer to ?msigdbr::msigdbr for avilable categories)

subcategory

Geneset subcategory (refer to ?msigdbr::msigdbr for avilable subcategories)

clean

Use true to clean labels of genesets

Value

A gsets object

Examples

HALLMARK <- msigdb_gsets("Homo sapiens", "H", "")

Print msigdb gsets information

Description

Print msigdb gsets information

Usage

msigdb_info()

Examples

msigdb_info()

Get msigdbr available species

Description

Get msigdbr available species

Usage

msigdb_species()

Value

A character vector of species

Examples

msigdb_species()

Get msigdbr package version number

Description

Get msigdbr package version number

Usage

msigdb_version()

Value

Version number

Examples

msigdb_version()

A multihyp object

Description

A multihyp object

A multihyp object

See Also

hyp

Public fields

data

A list of hyp objects

Methods

Public methods


Method new()

Create a multihyp object

Usage
multihyp$new(data)
Arguments
data

A list of hyp objects

Returns

A new multihyp object


Method print()

Print multihyp obect

Usage
multihyp$print()
Returns

NULL


Method as.list()

Print multihyp obect

Usage
multihyp$as.list()
Returns

A list of hyp objects as dataframes


Method clone()

The objects of this class are cloneable with this method.

Usage
multihyp$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

data <- data.frame(replicate(5,sample(0:1,10,rep=TRUE)))
args <- list("arg_1"=1, "arg_2"=2, "arg_3"=3)
hyp_obj <- hyp$new(data, args=args)
data <- list("hyp_1"=hyp_obj, "hyp_2"=hyp_obj,"hyp_3"=hyp_obj)
multihyp_obj <- multihyp$new(data)

Reactable builder for hyp or mhyp objects

Description

Reactable builder for hyp or mhyp objects

Usage

rctbl_build(obj, ...)

Arguments

obj

A hyp or multihyp object

...

Arguments passed to table generators

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]

experiment <- list("S1"=c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502"),
                   "S2"=c("PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC"))

mhyp_obj <- hypeR(experiment, genesets, background=2522)

rctbl_build(mhyp_obj)

Reactable table for hyp objects

Description

Reactable table for hyp objects

Usage

rctbl_hyp(
  hyp,
  type = c("inner", "outer"),
  show_emaps = FALSE,
  show_hmaps = FALSE,
  hyp_emap_args = list(top = 25, val = "fdr"),
  hyp_hmap_args = list(top = 25, val = "fdr")
)

Arguments

hyp

A hyp object

type

Use style class for outer or inner tables

show_emaps

Option to show enrichment maps in tabs

show_hmaps

Option to show hiearchy maps in tabs

hyp_emap_args

A list of keyword arguments passed to hyp_emap

hyp_hmap_args

A list of keyword arguments passed to hyp_hmap

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]

signature <- c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502",
              "PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC",
              "IDH2","IDH1","OGDHL","PC","SDHA","SUCLG1","SUCLA2","SUCLG2")

hyp_obj <- hypeR(signature, genesets, background=2522)

rctbl_hyp(hyp_obj)

Reactable table for multihyp objects

Description

Reactable table for multihyp objects

Usage

rctbl_mhyp(
  mhyp,
  show_emaps = FALSE,
  show_hmaps = FALSE,
  hyp_emap_args = list(top = 25, val = "fdr"),
  hyp_hmap_args = list(top = 25, val = "fdr")
)

Arguments

mhyp

A multihyp object

show_emaps

Option to show enrichment maps in tabs

show_hmaps

Option to show hiearchy maps in tabs

hyp_emap_args

A list of keyword arguments passed to hyp_emap

hyp_hmap_args

A list of keyword arguments passed to hyp_hmap

Examples

genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")$genesets[1:5]

experiment <- list("S1"=c("IDH3B","DLST","PCK2","CS","PDHB","PCK1","PDHA1","LOC642502"),
                   "S2"=c("PDHA2","LOC283398","FH","SDHD","OGDH","SDHB","IDH3A","SDHC"))

mhyp_obj <- hypeR(experiment, genesets, background=2522)

rctbl_mhyp(mhyp_obj)

A relational genesets object

Description

A relational genesets object

A relational genesets object

See Also

gsets

Public fields

genesets

A list of genesets where list names refers to geneset labels and values are geneset members represented as a vector

nodes

A data frame of labeled nodes

edges

A data frame of directed edges

name

A character vector describing source of genesets

version

A character vector describing versioning

Methods

Public methods


Method new()

Create a rgsets object

Usage
rgsets$new(
  genesets,
  nodes,
  edges,
  name = "Custom",
  version = "",
  quiet = FALSE
)
Arguments
genesets

A list of genesets where list names refers to geneset labels and values are geneset members represented as a vector

nodes

A data frame of labeled nodes

edges

A data frame of directed edges

name

A character vector describing source of genesets

version

A character vector describing versioning

quiet

Use true to silence warnings

Returns

A new rgsets object


Method print()

Print relational genesets information

Usage
rgsets$print()
Returns

NULL


Method info()

Returns versioning information

Usage
rgsets$info()
Returns

A character vector with name and version


Method reduce()

Reduces genesets to a background distribution of symbols

Usage
rgsets$reduce(background)
Arguments
background

A character vector of symbols

Returns

A rgsets object


Method subset()

Subsets genesets on a character vector of labels

Usage
rgsets$subset(labels)
Arguments
labels

A character vector of genesets

Returns

A rgsets object


Method clone()

The objects of this class are cloneable with this method.

Usage
rgsets$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Co-expression Modules

Description

A list of co-expression modules

Usage

wgcna

Format

A nested list of character vectors