sfaira.ui.UserInterface¶
- class sfaira.ui.UserInterface(custom_repo: Optional[Union[list, str]] = None, sfaira_repo: bool = False, cache_path: str = 'cache/')¶
This class performs data set handling and coordinates estimators for the different model types. Example code to obtain a UMAP embedding plot of the embedding created from your data with cell-type labels:
import sfaira import anndata import scanpy # initialise your sfaira instance with a model lookuptable. ui = sfaira.ui.UserInterface(custom_repo="/path/to/local/repo/folder/or/zenodo/repo/URL", sfaira_repo=False) ui.zoo_embedding.model_id = 'embedding_human-blood-ae-0.2-0.1_theislab' # pick desired model here ui.zoo_celltype.model_id = 'celltype_human-blood-mlp-0.1.3-0.1_theislab' # pick desired model here ui.load_data(anndata.read("/path/to/file.h5ad"), gene_symbol_col='index', gene_ens_col='gene_ids') ui.load_model_embedding() ui.load_model_celltype() ui.predict_all() adata = ui.data.adata scanpy.pp.neighbors(adata, use_rep="X_sfaira") scanpy.tl.umap(adata) scanpy.pl.umap(adata, color="celltypes_sfaira", show=True, save="UMAP_sfaira.png")
Attributes
Methods
Return type with frequencies of predicted cell types.
Run local embedding prediction model and add denoised expression to new adata layer.
deposit_zenodo
(zenodo_access_token, title, ...)Deposit all models in model lookup table on Zenodo.
load_data
(data[, gene_symbol_col, ...])Loads the provided AnnData object into sfaira.
Initialise cell type model and load parameters from public parameter repository.
Initialise embedding model and load parameters from public parameter repository.
Run local cell type prediction and embedding models and add results of both to adata.
Run local cell type prediction model and add predictions to adata.obs.
Run local embedding prediction model and add embedding to adata.obsm.
write_lookuptable
(repo_path)- param repo_path