scvi.external.stereoscope.SpatialDeconv#
- class scvi.external.stereoscope.SpatialDeconv(n_spots, sc_params, prior_weight='n_obs')[source]#
Bases:
BaseModuleClass
Model of single-cell RNA-sequencing data for deconvolution of spatial transriptomics.
Reimplementation of the STModel module of Stereoscope [Andersson et al., 2020]: https://github.com/almaan/stereoscope/blob/master/stsc/models.py.
- Parameters:
n_spots (
int
) – Number of input spotssc_params (
Tuple
[ndarray
]) – Tuple of ndarray of shapes [(n_genes, n_labels), (n_genes)] containing the dictionnary and log dispersion parametersprior_weight (
Literal
[‘n_obs’, ‘minibatch’] (default:'n_obs'
)) – Whether to sample the minibatch by the number of total observations or the monibatch size
Attributes table#
Methods table#
|
Build the deconvolution model for every cell in the minibatch. |
Returns cell type specific gene expression at the queried spots. |
|
|
Returns the loadings. |
Inference. |
|
|
Loss computation. |
|
Sample from the model. |
Attributes#
training
Methods#
generative
- SpatialDeconv.generative(x, ind_x)[source]#
Build the deconvolution model for every cell in the minibatch.
get_ct_specific_expression
- SpatialDeconv.get_ct_specific_expression(y)[source]#
Returns cell type specific gene expression at the queried spots.
- Parameters:
y – cell types
get_proportions
inference
loss
- SpatialDeconv.loss(tensors, inference_outputs, generative_outputs, kl_weight=1.0, n_obs=1.0)[source]#
Loss computation.
sample