nichesphere.coloc.OvsE_coloc_test_adjPval#
- nichesphere.coloc.OvsE_coloc_test_adjPval(observedColocProbs, expectedColocProbs, testDistribution_df, cell_types, oneCTinteractions, p=0.05, MTcorrection='fdr_bh', pseudocount=1e-10)#
Observed vs Expected log2 ratios filtered by adjusted p-value from a per-pair background distribution.
- Parameters:
observedColocProbs (pd.Series) – Observed cell type pair co-localization probabilities in a sample/condition.
expectedColocProbs (pd.Series) – Expected cell type pair co-localization probabilities in the same sample/condition.
testDistribution_df (pd.DataFrame) – Background distribution of O/E ratios: rows are bootstrap iterations, columns are cell type pairs (as returned by
nichesphere.tl.get_PIC_BG_OEratios_DF).cell_types (list) – List of cell types in the same order as
observedColocProbs.oneCTinteractions (list) – List of same-cell-type interactions (
cellType-cellType) to exclude from scoring.p (float, default 0.05) – Adjusted p-value threshold; pairs above this are set to 0.
MTcorrection (str, default 'fdr_bh') – Multiple-testing correction method passed to
statsmodels.multipletests.pseudocount (float, default 1e-10) – Small value added to numerator and denominator before computing O/E ratios to avoid division by zero or log(0).
- Returns:
OvsE_HMdf (pd.DataFrame) – Cell types × cell types matrix of log2(O/E) scores; non-significant and same-cell-type values are set to 0.
statsDF (pd.DataFrame) – Per-pair statistics with columns
statistic(log2 O/E),pvalue, andadjusted_pvalue.