phyper
Hypergeometric tail calculations in C++
Loading...
Searching...
No Matches
phyper Namespace Reference

Compute hypergeometric tail probabilities. More...

Classes

struct  Options
 Options for compute(). More...
 

Functions

template<typename Count_ >
double compute (Count_ drawn_inside, Count_ num_inside, Count_ num_outside, const Count_ num_drawn, const Options &options)
 

Detailed Description

Compute hypergeometric tail probabilities.

Function Documentation

◆ compute()

template<typename Count_ >
double phyper::compute ( Count_ drawn_inside,
Count_ num_inside,
Count_ num_outside,
const Count_ num_drawn,
const Options & options )

Compute the tail probabilities for the hypergeometric distribution. It is intended for use in quantifying gene set enrichment in a list of top marker genes. The "successes" are the genes in the set, the "failures" are all other genes, and the drawing process typically involves selecting the top markers; our aim is to compute the p-value for enrichment of genes in the set among the top markers.

Template Parameters
Count_Integer type of the number of genes.
Parameters
drawn_insideNumber of genes in the gene set that were selected as markers.
num_insideTotal number of genes in the gene set.
num_outsideTotal number of genes outside the gene set.
num_drawnNumber of genes that were selected as top markers.
optionsFurther options for the calculation.
Returns
Probability of randomly selecting at least drawn_inside genes from the gene set, if Options::upper_tail = true. Otherwise, the probability of randomly selecting no more than drawn_inside genes from the gene set. These probabilities are log-transformed when Options::log = true.