TOTALVI.get_protein_foreground_probability(adata=None, indices=None, transform_batch=None, protein_list=None, n_samples=1, batch_size=None, return_mean=True, return_numpy=None)[source]

Returns the foreground probability for proteins.

This is denoted as \((1 - \pi_{nt})\) in the totalVI paper.

adata : AnnData | NoneOptional[AnnData] (default: None)

AnnData object with equivalent structure to initial AnnData. If None, defaults to the AnnData object used to initialize the model.

indices : Sequence[int] | NoneOptional[Sequence[int]] (default: None)

Indices of cells in adata to use. If None, all cells are used.

transform_batch : Sequence[Union[~Number, str]] | NoneOptional[Sequence[Union[~Number, str]]] (default: None)

Batch to condition on. If transform_batch is:

  • None, then real observed batch is used

  • int, then batch transform_batch is used

  • List[int], then average over batches in list

protein_list : Sequence[str] | NoneOptional[Sequence[str]] (default: None)

Return protein expression for a subset of genes. This can save memory when working with large datasets and few genes are of interest.

n_samples : intint (default: 1)

Number of posterior samples to use for estimation.

batch_size : int | NoneOptional[int] (default: None)

Minibatch size for data loading into model. Defaults to scvi.settings.batch_size.

return_mean : boolbool (default: True)

Whether to return the mean of the samples.

return_numpy : bool | NoneOptional[bool] (default: None)

Return a ndarray instead of a DataFrame. DataFrame includes gene names as columns. If either n_samples=1 or return_mean=True, defaults to False. Otherwise, it defaults to True.


  • foreground_probability - probability foreground for each protein

If n_samples > 1 and return_mean is False, then the shape is (samples, cells, genes). Otherwise, shape is (cells, genes). In this case, return type is DataFrame unless return_numpy is True.