skm_tools.stats

Small statistics helpers (no scipy): hypergeometric tail and Benjamini-Hochberg FDR.

Functions

hypergeom_sf(k, population, successes, draws)

P(X >= k) for X ~ Hypergeometric(population, successes, draws): the one-sided over-representation p-value

bh_fdr(p)

Benjamini-Hochberg adjusted p-values (FDR), in the order of p.

Module Contents

skm_tools.stats.hypergeom_sf(k, population, successes, draws)

P(X >= k) for X ~ Hypergeometric(population, successes, draws): the one-sided over-representation p-value of k hits (e.g. k of a TF’s successes targets among draws DEGs, out of population genes).

Parameters:
Return type:

float

Examples

>>> round(hypergeom_sf(3, 20, 5, 4), 5)
0.03199
skm_tools.stats.bh_fdr(p)

Benjamini-Hochberg adjusted p-values (FDR), in the order of p.

Examples

>>> bh_fdr([0.01, 0.04, 0.03, 0.2]).round(3).tolist()
[0.04, 0.053, 0.053, 0.2]