The analysis task is to evaluate which terms the given items are enriched to.

dag_enrich_on_items(dag, items, min_hits = 5, min_items = 10)

dag_enrich_on_genes(dag, genes, min_hits = 5, min_genes = 10)

Arguments

dag

An ontology_DAG object.

items

A vector of item names.

min_hits

Minimal number of items in the term set.

min_items

Minimal size of the term set.

genes

A vector of gene IDs. The gene ID type can be found by directly printing the ontology_DAG object.

min_genes

Minimal number of genes.

Value

A data frame with the following columns:

  • term: Term names.

  • n_hits: Number of items in items intersecting to t's annotated items.

  • n_anno: Number of annotated items of t. Specifically for dag_enrich_on_genes(), this column is renamed to n_gs.

  • n_items: Number of items in items intersecting to all annotated items in the DAG. Specifically for dag_enrich_on_genes(), this column is renamed to n_genes.

  • n_all: Number of all annotated items in the DAG.

  • log2_fold_enrichment: Defined as log2(observation/expected).

  • z_score: Defined as (observed-expected)/sd.

  • p_value: P-values from hypergeometric test.

  • p_adjust: Adjusted p-values from the BH method.

The number of rows in the data frame is the same as the number of terms in the DAG.

Details

The function tests whether the list of items are enriched in terms on the DAG. The test is based on the hypergeometric distribution. In the following 2x2 contigency table, S is the set of items, for a term t in the DAG, T is the set of items annotated to t (by automatically merging from its offspring terms), the aim is to test whether S is over-represented in T.

The universal set all correspond to the full set of items annotated to the DAG.

+----------+------+----------+-----+
|          | in S | not in S | all |
+----------+------+----------+-----+
| in T     |  x11 |    x12   | x10 |
| not in T |  x21 |    x22   | x20 |
+----------+------+----------+-----+
| all      |  x01 |    x02   |  x  |
+----------+------+----------+-----+

dag_enrich_on_genes() is the same as dag_enrich_on_items() which only changes the argument item to gene.

Examples

# \dontrun{
dag = create_ontology_DAG_from_GO_db(org_db = "org.Hs.eg.db") 
#> relations: is_a, part_of
items = random_items(dag, 1000)
df = dag_enrich_on_items(dag, items)
# }
1
#> [1] 1