pylimma.decide_tests
- pylimma.decide_tests(data, method='separate', adjust_method='BH', p_value=0.05, lfc=0.0, coefficients=None, cor_matrix=None, tstat=None, df=inf, genewise_p_value=None, *, key='pylimma')[source]
Classify genes as differentially expressed.
Applies multiple testing correction and classifies each gene-coefficient combination as up-regulated (1), down-regulated (-1), or not significant (0).
- Parameters:
data (AnnData, dict, or ndarray) – Fit object from e_bayes(), or a matrix of p-values. If AnnData, reads from adata.uns[key].
method (str, default "separate") –
Method for multiple testing correction:
”separate”: adjust p-values for each coefficient separately
”global”: adjust all p-values together
”hierarchical”: first test overall significance (F-test), then adjust within significant genes
”nestedF”: use nested F-tests for multiple contrasts
adjust_method (str, default "BH") – P-value adjustment method: “BH”, “bonferroni”, “holm”, “BY”, “none”.
p_value (float, default 0.05) – Significance threshold for adjusted p-values.
lfc (float, default 0.0) – Log fold-change threshold. Genes with |logFC| < lfc are set to 0.
key (str, default "pylimma") – Key for fit results in adata.uns (AnnData input only).
coefficients (ndarray | None)
cor_matrix (ndarray | None)
tstat (ndarray | None)
genewise_p_value (ndarray | None)
- Returns:
Matrix of test results with values -1 (down), 0 (not significant), 1 (up). Shape is (n_genes, n_coefficients).
- Return type:
ndarray
Notes
The “separate” method is the default and most commonly used. It adjusts p-values within each coefficient independently.
The “hierarchical” and “nestedF” methods first perform an overall F-test for each gene, then test individual contrasts only for genes that pass the F-test. This can increase power when there are many contrasts.
Examples
>>> fit = e_bayes(lm_fit(expr, design)) >>> results = decide_tests(fit, p_value=0.05, lfc=1) >>> np.sum(results == 1, axis=0) # count up-regulated per coefficient