Skip to contents

The standard over-representation (Fisher / hypergeometric) test against a set of pathway memberships. With a universe of N genes, a pathway containing m of them, a selected list of n genes and q of those in the pathway, the one-sided p-value is the upper hypergeometric tail. The tail sum is formed in log space through the log-gamma function; p-values across pathways are adjusted by the Benjamini-Hochberg step-up procedure. Membership is passed as indicator vectors over a fixed gene universe so that both language arms index genes identically.

Usage

Keggp(genes, kegg_pathways, alpha = 0.05)

Arguments

genes

Indicator over the gene universe: 1 if selected.

kegg_pathways

Membership matrix, one row per gene of the universe, one column per pathway, entries 0 or 1.

alpha

FDR level used for the reported decisions.

Value

List with estimate (smallest p-value), pvalue, qvalue, overlap, pathway_size, top_pathway, n_significant, significant, n_selected, n_pathways, alpha, n, method.

Details

Formula: P(X >= q) = sum_{j>=q} C(m,j) C(N-m, n-j) / C(N, n).

References

Kanehisa, Furumichi, Tanabe, Sato and Morishima (2017), KEGG: new perspectives on genomes, pathways, diseases and drugs, Nucleic Acids Research 45(D1):D353-D361, doi:10.1093/nar/gkw1092 ; Benjamini and Hochberg (1995), JRSS-B 57(1):289-300. doi:10.1111/j.2517-6161.1995.tb02031.x

Examples

genes <- c(1, 0, 1, 0, 1)
kegg_pathways <- matrix(c(1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0),
                        5, 3, byrow = TRUE)
Keggp(genes, kegg_pathways)
#> $estimate
#> [1] 0.1
#> 
#> $pvalue
#> [1] 0.7 0.1 0.9
#> 
#> $qvalue
#> [1] 0.9 0.3 0.9
#> 
#> $overlap
#> [1] 2 3 1
#> 
#> $pathway_size
#> [1] 3 3 2
#> 
#> $top_pathway
#> [1] 1
#> 
#> $n_significant
#> [1] 0
#> 
#> $significant
#> [1] 0 0 0
#> 
#> $n_selected
#> [1] 3
#> 
#> $n_pathways
#> [1] 3
#> 
#> $alpha
#> [1] 0.05
#> 
#> $n
#> [1] 5
#> 
#> $method
#> [1] "hypergeometric P(X >= q) per pathway with Benjamini-Hochberg FDR, Kanehisa et al (2017)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"