scviva.tl.HarremanAnalysis

scviva.tl.HarremanAnalysis#

class scviva.tl.HarremanAnalysis(adata, model=None, layer_key=None)[source]#

Downstream spatial metabolic cell-cell communication analysis.

Parameters:
  • adata (AnnData) – Spatial AnnData. Must have neighbor coordinates in obsm.

  • model (BaseModelClass | None) –

    Optional trained scvi spatial model (RESOLVI, SCVIVA, DestVI).

    • DestVI: calls model.get_proportions() and attaches each cell-type proportion-weighted count matrix as adata.layers[cell_type].

    • RESOLVI: calls model.get_normalized_expression() and attaches as adata.layers[HARREMAN_DENOISED_LAYER].

    • SCVIVA: calls model.get_latent_representation() and attaches as adata.obsm[HARREMAN_LATENT_OBSM].

    Model reference is dropped after extraction.

  • layer_key (str | None) – Layer to use for counts. None uses adata.X.

Examples

Without model:

>>> ha = HarremanAnalysis(adata)
>>> ha.setup(compute_neighbors_on_key="spatial", species="human")
>>> ha.filter_genes()
>>> ha.compute_gene_pairs()
>>> ha.compute_cell_communication()
>>> ha.select_significant_interactions()
>>> results = ha.results

With DestVI model:

>>> ha = HarremanAnalysis(adata, model=destvi_model)
>>> ha.setup(compute_neighbors_on_key="spatial", cell_type_key="cell_type")
>>> ha.compute_gene_pairs()
>>> ha.compute_cell_communication(mode="cell_type")
__init__(adata, model=None, layer_key=None)[source]#

Methods

__init__(adata[, model, layer_key])

compute_cell_communication([mode, model, ...])

Compute ligand-receptor / metabolite CCC scores.

compute_gene_pairs([cell_type_pairs, ...])

Compute local correlations for gene pairs in the metabolite database.

compute_interacting_cell_scores([mode, ...])

Compute per-cell interaction scores.

filter_genes([model, feature_elimination, ...])

Filter genes before gene pair computation.

select_significant_interactions([...])

Filter to statistically significant interactions.

setup(compute_neighbors_on_key[, species, ...])

Register adata with HarremanDB and build the spatial proximity graph.

Attributes

adata

The working AnnData object.

is_deconvolved

True if model-extracted cell-type proportion layers are present.

is_set_up

True if setup() has been called.

results

Typed view over the analysis results stored in adata.uns.