revise.backend.runners.sc_svc_impute_benchmark.ScSVCImpute
- class revise.backend.runners.sc_svc_impute_benchmark.ScSVCImpute(st_adata, sc_ref_adata, config, real_st_adata, logger)[source]
Bases:
BenchmarkSVCSingle-cell SVC imputation for benchmark CFs: gene panel/gene dropout.
This class performs gene imputation by comparing in-panel vs all-panel HVG selection strategies and using optimal transport for imputation.
- __init__(st_adata, sc_ref_adata, config, real_st_adata, logger)[source]
Initialize BaseSVCAnchor.
- Parameters:
st_adata – Spatial transcriptomics AnnData object
sc_ref_adata – Single-cell reference AnnData object
config – Configuration object containing method parameters
real_st_adata – Ground truth spatial data (for benchmarking, can be None)
logger – Logger instance for logging
Methods
__init__(st_adata, sc_ref_adata, config, ...)Initialize BaseSVCAnchor.
global_anchoring(*args, **kwargs)Annotate spatial spots using the configured annotation method.
local_impute(adata_sc, sc_subcluster)Perform local imputation for each cell type using subclustered reference.
local_refinement(*args, **kwargs)Reconstruct expression profiles using gene imputation.
- local_refinement(*args, **kwargs)[source]
Reconstruct expression profiles using gene imputation.
Evaluates gene uncertainty comparing in-panel vs all-panel strategies
Generates subclustered single-cell data for both strategies
Performs local imputation for each cell type using optimal transport
Optionally prunes imputed data
Results are stored in: - self.svc[“sc_svc_impute_all_panel”]: Imputation using all-panel strategy - self.svc[“sc_svc_impute_in_panel”]: Imputation using in-panel strategy
- _materialize_cached_gene_compare(target_file: str) None[source]
Optionally hydrate compare CSV from cache to avoid re-running uncertainty.
This path is only enabled when REVISE_GENE_COMPARE_CACHE is set and target_file does not already exist.
- _materialize_cached_subcluster(in_panel_file: str, all_panel_file: str) None[source]
Optionally hydrate subcluster AnnData files from the compare cache directory.
- local_impute(adata_sc, sc_subcluster)[source]
Perform local imputation for each cell type using subclustered reference.
- Parameters:
adata_sc – Subclustered single-cell reference AnnData
sc_subcluster – Column name in adata_sc.obs containing subcluster labels
- Returns:
Imputed spatial data with reconstructed expressions
- Return type:
AnnData
Processes each cell type separately
Computes subcluster profiles and distances
Uses optimal transport to find spot-subcluster mappings
Imputes gene expressions using OT coupling weights