<jupyter_start><jupyter_text>pbmc._load_purified_pbmc_dataset()<jupyter_code>import anndata as ad
%config Completer.use_jedi = False
scadata = ad.read_h5ad('data/PurifiedPBMCDataset.h5ad')
import pickle
stdata = pickle.load(open('sample-adata.pk','rb'))
common_genes = set(scadata.var.index).intersection(set(stdata.var.index))
scdata = scadata[:,[i for i,x in enumerate(scadata.var.index) if x in common_genes]]
stdata.var_names_make_unique()
stdata = stdata[:,[i for i,x in enumerate(stdata.var.index) if x in common_genes]]
scdata=scdata.copy()
scvi.data.setup_anndata(scdata, labels_key="cell_types")
sc_model = scvi.model.CondSCVI(scdata, weight_obs=True)
sc_model.train(max_epochs=0)<jupyter_output>GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
/home/hosein.toosi/spatial-scvi/conda/lib/python3.8/site-packages/pytorch_lightning/core/datamodule.py:423: LightningDeprecationWarning: DataModule.setup has already been called, so it will not be called again. In v1.6 this behavior will change to always call DataModule.setup.
  rank_zero_deprecation(<jupyter_text>sc_model.history["elbo_train"].plot()<jupyter_code>stdata=stdata.copy()
scvi.data.setup_anndata(stdata)
st_model = scvi.model.DestVI.from_rna_model(stdata, sc_model)
st_model.train(max_epochs=2)
a = scvi.dataloaders._anntorchdataset.AnnTorchDataset(adata = stdata)
type(a.__getitem__([0])['Image_path'])
stdata.uns
a = 3
type(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1261744966442953, 'fraction_numerical': 0.010067114093959731, 'mean_word_length': 7.822485207100592, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '92557', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 588, 'n_tokens_neox': 574, 'n_words': 98, 'path': 'maintest.ipynb', 'repo_name': 'mrmohaghegh/scvi-tools', 'size': '1490'}