Review of old/#
Main Problems Found#
Package import is fragile:
old/__init__.pyimports R-related modules whenrpy2is present, andold/utils/rtools.pyimportsrpy2,muon, Seurat helpers, and R packages at module import time.R environment configuration is hard to reproduce because Python functions directly call
importr()and inline R code without a central dependency check.Argument names are inconsistent:
counts_key,layer,condition_key,treatment_key,control_key,cell_type_key,group_key,key, andunssometimes mean related concepts.Several functions mutate
.Xtemporarily, for example pseudobulk and memento workflows. This can silently corrupt downstream analysis state.decoupler usage is based on older helpers such as
get_ora_dfandget_gsea_df. Current decoupler exposes methods underdc.mt.*and pseudobulk underdc.pp.pseudobulk.utilsmixes unrelated domains: gene conversion, R bridge, memento, ORA/GSEA, generic file prompts, and survival analysis.__pycache__files are stored inold/, adding noise and making review harder.Some implementations duplicate Scanpy/scverse behavior that should be wrapped instead of reimplemented, especially pseudobulk aggregation.
Module Decisions#
Keep and rewrite: preprocessing, clustering, pseudobulk differential expression, enrichment, marker utilities, cell-cycle gene loading, and core plotting helpers.
Keep but isolate now: R-backed scDblFinder and SoupX.
Defer heavy R wrappers: clustree, CellChat, NicheNet, inferCNV, clusterProfiler, AUCell/UCell. A lightweight, optional LIANA workflow now covers the core ligand–receptor use case without restoring those wrappers.
Extract from core: survival analysis.
Revisit later: large plotting classes and geneNMF. They can be ported after the data APIs are stable.
References Checked#
decoupler latest API lists enrichment methods under
decoupler.mt.*, includingmt.oraandmt.gsea.decoupler latest API provides
decoupler.pp.pseudobulk(adata, sample_col, groups_col, layer=None, mode="sum", ...)and records pseudobulk QC metrics.