cellink.tl.external.get_disease_relevant_cells#
- cellink.tl.external.get_disease_relevant_cells(weights_df, adata, top_percentile=85.0, fdr_threshold=0.1, cell_type_col=None)#
Identify disease-relevant cells from scPRS model weights.
Adaptation of
util/analysis.py(szhang1112/scPRS):For each repeat, compute the
top_percentile-th percentile of all cell weights as a scalar reference value.For each cell, one-sided t-test comparing its weight distribution across repeats against the per-repeat percentile values.
Benjamini-Hochberg FDR correction (
method='n'as in the paper).
- Parameters:
weights_df (pd.DataFrame) – Cell weight matrix (n_repeats c n_cells) from
run_scprs().adata (AnnData) – Original scATAC-seq AnnData whose
obs_namescorrespond to cell indices inweights_df.columns.top_percentile (float, default=85.0) – Percentile used to define the reference distribution per repeat. The paper uses the 85th percentile (top 15%).
fdr_threshold (float, default=0.1) – Adjusted p-value threshold (BY correction, as in analysis.py).
cell_type_col (str, optional) –
adata.obscolumn with cell-type labels for enrichment analysis.
- Return type:
DataFrame|tuple[DataFrame,DataFrame]- Returns:
pd.DataFrame or tuple If
cell_type_colis None: DataFrame with per-cell results. Ifcell_type_colis provided: tuple of (cell_results, ct_results).