Skip to contents

One-sided Fisher's exact test (over-representation) per GO term, with multiple-testing adjustment over the terms tested in the aspect. Aspects BP (biological process), MF (molecular function), and CC (cellular component) are recognised under all common naming conventions (`BP`/`P`/`biological_process`, etc.). Note: candidate genes from GWAS intervals are not independent (LD clusters, overlapping genes), so treat the p-values as exploratory.

Usage

hbr_go_enrichment(
  genes_superior,
  genes_all,
  goslim_dt,
  aspect = c("BP", "MF", "CC", "all"),
  min_term_size = 5L,
  min_superior = 2L,
  p_adjust = "BH",
  top_n = 50L,
  restrict_to_annotated = FALSE,
  verbose = TRUE
)

Arguments

genes_superior

Character vector of genes of interest.

genes_all

Character vector of the full tested universe.

goslim_dt

GOSlim table with columns `Gene_ID`, `GO_ID`, `GO_Aspect`, `GO_Term`.

aspect

One of `"BP"`, `"MF"`, `"CC"`, `"all"`.

min_term_size

Minimum term size in the universe.

min_superior

Minimum superior carriers.

p_adjust

Multiple-testing method.

top_n

Return at most this many top-ranked terms.

restrict_to_annotated

Restrict the universe to genes with at least one GO term in the aspect.

verbose

Print progress.

Value

A `data.table` with columns `GO_ID`, `GO_Term`, `GO_Aspect`, `N_Superior`, `N_Universe`, `OR`, `P`, `Adjusted_P`.

Examples

goslim <- data.table::data.table(
  Gene_ID   = c("Os01g0100100", "Os01g0100200", "Os01g0100300"),
  GO_ID     = c("GO:0008150", "GO:0008150", "GO:0003674"),
  GO_Aspect = c("P", "P", "F"),
  GO_Term   = c("biological_process", "biological_process",
                "molecular_function"))
hbr_go_enrichment(
  genes_superior = c("Os01g0100100", "Os01g0100200"),
  genes_all      = c("Os01g0100100", "Os01g0100200", "Os01g0100300"),
  goslim_dt      = goslim,
  aspect         = "BP",
  min_term_size  = 1L,
  min_superior   = 1L)
#>   Enrichment: 2 superior / 3 universe genes | aspect = BP
#>     1 terms tested | 0 significant (FDR < 0.05)
#>         GO_ID            GO_Term GO_Aspect N_Superior N_Universe    OR
#>        <char>             <char>    <char>      <int>      <int> <num>
#> 1: GO:0008150 biological_process        BP          2          2   Inf
#>            P Adjusted_P
#>        <num>      <num>
#> 1: 0.3333333  0.3333333