cellink.tl.external.compute_celltype_programs#
- cellink.tl.external.compute_celltype_programs(adata, celltype_col, *, min_cells_per_type=10, use_raw=False, method='wilcoxon', prefix='celltype', out_dir=None, save=True)#
Compute cell-type gene programs by differential expression (one vs rest).
Each gene receives a probabilistic score in [0, 1] derived from the Wilcoxon rank-sum test p-value, following the sc-linker paper:
X = -2 * log(p_adj) [chi2_2 distributed] score = (X - min(X)) / (max(X) - min(X))
- Parameters:
adata (
AnnData) – AnnData with log-normalised expression inadata.X.celltype_col (
str) – Column inadata.obswith cell-type labels.min_cells_per_type (
int(default:10)) – Cell types with fewer cells are skipped.use_raw (
bool(default:False)) – Passed tosc.tl.rank_genes_groups.method (
str(default:'wilcoxon')) – DE method;"wilcoxon"is recommended.prefix (
str(default:'celltype')) – Prefix for the DE key stored inadata.uns.out_dir (
str|Path|None(default:None)) – If provided andsave=True, saves CSV files here.save (
bool(default:True)) – Whether to write output CSV files.
- Return type:
- Returns:
dict ``{“pval”: DataFrame, “logfold”: DataFrame, “score”: DataFrame,
”genescores”: DataFrame}``
All DataFrames are (genes x cell_types).