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 inobsm.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 asadata.layers[cell_type].RESOLVI: calls
model.get_normalized_expression()and attaches asadata.layers[HARREMAN_DENOISED_LAYER].SCVIVA: calls
model.get_latent_representation()and attaches asadata.obsm[HARREMAN_LATENT_OBSM].
Model reference is dropped after extraction.
layer_key (
str|None) – Layer to use for counts.Noneusesadata.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")
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
adataThe working AnnData object.
is_deconvolvedTrue if model-extracted cell-type proportion layers are present.
is_set_upTrue if setup() has been called.
resultsTyped view over the analysis results stored in
adata.uns.