scvi.external.stereoscope.SpatialDeconv

class scvi.external.stereoscope.SpatialDeconv(n_spots, sc_params, prior_weight='n_obs')[source]

Bases: scvi.module.base._base_module.BaseModuleClass

Model of single-cell RNA-sequencing data for deconvolution of spatial transriptomics.

Reimplementation of the STModel module of Stereoscope [Andersson20]: https://github.com/almaan/stereoscope/blob/master/stsc/models.py.

Parameters
n_spots : intint

Number of input spots

sc_params : Tuple[ndarray]Tuple[ndarray]

Tuple of ndarray of shapes [(n_genes, n_labels), (n_genes)] containing the dictionnary and log dispersion parameters

prior_weight : {‘n_obs’, ‘minibatch’}Literal[‘n_obs’, ‘minibatch’] (default: 'n_obs')

Whether to sample the minibatch by the number of total observations or the monibatch size

Methods

generative(x, ind_x)

Build the deconvolution model for every cell in the minibatch.

get_ct_specific_expression(y)

Returns cell type specific gene expression at the queried spots.

get_proportions([keep_noise])

Returns the loadings.

inference()

Run the inference (recognition) model.

loss(tensors, inference_outputs, …[, …])

Compute the loss for a minibatch of data.

sample(tensors[, n_samples, library_size])

Generate samples from the learned model.