Utils functions
- vega.utils.setup_anndata(adata, batch_key=None, categorical_covariate_keys=None, copy=False)[source]
Creates VEGA fields in input Anndata object for mask. Also creates SCVI field which will be used for batch and covariates.
- Parameters
adata (
AnnData
) – Scanpy single-cell objectcopy (
bool
) – Whether to return a copy or change in placebatch_key (
Optional
[str
]) – Observation to be used as batchcategorical_covariate_keys (
Union
[str
,list
,None
]) – Observation to use as covariate keys
- Returns
updated object if copy is True
- Return type
adata
- vega.utils.create_mask(adata, gmt_paths=None, add_nodes=1, min_genes=0, max_genes=1000, copy=False)[source]
Initialize mask M for GMV from one or multiple .gmt files.
- Parameters
adata (
AnnData
) – Scanpy single-cell object.gmt_paths (
Union
[str
,list
,None
]) – One or several paths to .gmt files.add_nodes (
int
) – Additional latent nodes for capturing additional variance.min_genes (
int
) – Minimum number of genes per GMV.max_genes (
int
) – Maximum number of genes per GMV.copy (
bool
) – Whether to return a copy of the updated Anndata object.
- Returns
Scanpy single-cell object.
- Return type
adata
- vega.utils.preprocess_anndata(adata, n_top_genes=5000, copy=False)[source]
Simple (default) Scanpy preprocessing function before autoencoders.
- Parameters
adata (
AnnData
) – Scanpy single-cell objectn_top_genes (
int
) – Number of highly variable genes to retaincopy (
bool
) – Return a copy or in place
- Returns
Preprocessed Anndata object
- Return type
adata