I am new to python for scRNAseq. My collaborator shared a h5ad file with “processed data”. They did integration and UMAP etc with scvi.
I wonder if it is possible to get the trained model out from the h5ad file. I tried to google but with no luck and many tutorials are start with raw data. I do not want to rerun the integration but to get the normalized count from the file. Would it be possible (i.e. whether the model was not saved in h5ad)?
I have tried these:
import scanpy as sc
import scvi
adata = sc.read_h5ad('shared.h5ad')
model = scvi.model.SCVI(adata)
However, I got the following error which guide me to rerun the model training etc.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/miniconda3/envs/pythonsc/lib/python3.10/site-packages/scvi/model/_scvi.py", line 112, in __init__
super().__init__(adata)
File "/miniconda3/envs/pythonsc/lib/python3.10/site-packages/scvi/model/base/_base_model.py", line 92, in __init__
self._adata_manager = self._get_most_recent_anndata_manager(
File "/miniconda3/envs/pythonsc/lib/python3.10/site-packages/scvi/model/base/_base_model.py", line 289, in _get_most_recent_anndata_manager
raise ValueError(
ValueError: Please set up your AnnData with SCVI.setup_anndata first.
I have also tried the method mentioned here, but seems I do not have the “model.pt” file.