Perform a Fisher's exact test. This formula is from https://www.pathwaycommons.org/guide/primers/statistics/fishers_exact_test/
Usage
fisher_test(set1_genes, set2_genes, all_genes, verbose = 0)
Arguments
- set1_genes
A vector of characters of your resulting gene list
- set2_genes
A vector of characters of a gene list you are comparing against
- all_genes
A vector of characters of all the genes in your "universe". This should include all the genes in set1_genes and set2_genes.
- verbose
Numeric
Value
A list of: pvalue for the p-value,
set_bg_len for the number of genes in all_genes but not in set2_genes,
set_overlap_len for the number of genes in both set1_genes and set2_genes,
set1_len for number of genes in set1_genes, and
set2_len for number of genes in set2_genes.
Examples
all_genes <- paste0("gene", 1:1000)
set1_genes <- paste0("gene", 1:50)
set2_genes <- paste0("gene", c(1:20, 501:530))
res <- fisher_test(set1_genes = set1_genes,
set2_genes = set2_genes,
all_genes = all_genes)
res$pvalue
#> [1] 2.661076e-15
res$set_overlap_len
#> [1] 20