Fast Algorithm for the Log P-value of Fisher's Exact Test or Hypergeometric Distribution

Can be applied to relatively very large numbers (Total<100000)
283 Downloads
Updated 20 Jun 2012

View License

example: after identifying a list of 30 genes from the entire genome of
20000 genes, 5 genes are related to cycle, while there are totally 200
cell cylce gene in the genome, then the log p-value will be:
ln_p=log_hypergeometric(5,30,200,20000);
% or, in 10 based log p-value
lg_p=log_hypergeometric(5,30,200,20000)/log(10);
% or, the decimal p-value
p=exp(log_hypergeometric(5,30,200,20000));

This is to say, 5 genes are in gene list,
and related to cell cycle; 25 genes are in the gene list but not related
to cell cycle; 195 genes are related to cell cycle but not in the gene
list; 19775 genes are not in the gene list and not related to cell cycle.
then the log p-value will be:
% ln_p=log_fisher_test(5,25,195,19775)
or, in 10 based log p-value
% lg_p=log_fisher_test(5,25,195,19775)/log(10);
or, the decimal p-value
% p=exp(log_fisher_test(5,25,195,19775));

Reference:
Meng, J., Gao, S. & Huang, Y. Enrichment constrained time-dependent clustering analysis for finding meaningful temporal transcription modules. Bioinformatics 25, 1521-1527, doi:10.1093/bioinformatics/btp235 (2009)

Cite As

Jia Meng (2024). Fast Algorithm for the Log P-value of Fisher's Exact Test or Hypergeometric Distribution (https://www.mathworks.com/matlabcentral/fileexchange/34846-fast-algorithm-for-the-log-p-value-of-fisher-s-exact-test-or-hypergeometric-distribution), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Genomics and Next Generation Sequencing in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

attached with examples and derivation, improved notations.

1.0.0.0