skm_tools.stats =============== .. py:module:: skm_tools.stats .. autoapi-nested-parse:: Small statistics helpers (no scipy): hypergeometric tail and Benjamini-Hochberg FDR. Functions --------- .. autoapisummary:: skm_tools.stats.hypergeom_sf skm_tools.stats.bh_fdr Module Contents --------------- .. py:function:: 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). :param k: :type k: int :param population: :type population: int :param successes: :type successes: int :param draws: :type draws: int :rtype: float .. rubric:: Examples >>> round(hypergeom_sf(3, 20, 5, 4), 5) 0.03199 .. py:function:: bh_fdr(p) Benjamini-Hochberg adjusted p-values (FDR), in the order of `p`. .. rubric:: Examples >>> bh_fdr([0.01, 0.04, 0.03, 0.2]).round(3).tolist() [0.04, 0.053, 0.053, 0.2]