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: BenchmarkSVC

Single-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.

_adata_processing_impute()[source]

Process data with transcript count filtering.

local_refinement(*args, **kwargs)[source]

Reconstruct expression profiles using gene imputation.

  1. Evaluates gene uncertainty comparing in-panel vs all-panel strategies

  2. Generates subclustered single-cell data for both strategies

  3. Performs local imputation for each cell type using optimal transport

  4. 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

  1. Processes each cell type separately

  2. Computes subcluster profiles and distances

  3. Uses optimal transport to find spot-subcluster mappings

  4. Imputes gene expressions using OT coupling weights