def runScGen(adata, batch, cell_type, epochs=100, hvg=None, model_path='/localscratch'): """ Parametrization taken from the tutorial notebook at: https://nbviewer.jupyter.org/github/M0hammadL/scGen_notebooks/blob/master/notebooks/scgen_batch_removal.ipynb """ import scgen checkSanity(adata, batch, hvg) # Fit the model network = scgen.VAEArith(x_dimension=adata.shape[1], model_path=model_path) network.train(train_data=adata, n_epochs=epochs, save=False) corrected_adata = scgen.batch_removal(network, adata, batch_key=batch, cell_label_key=cell_type) network.sess.close() return corrected_adata
def test_batch_removal(): train = sc.read("./tests/data/pancreas.h5ad", backup_url="https://goo.gl/V29FNk") train.obs["cell_type"] = train.obs["celltype"].tolist() network = scgen.VAEArith(x_dimension=train.shape[1], model_path="./models/batch") network.train(train_data=train, n_epochs=0) corrected_adata = scgen.batch_removal(network, train) network.sess.close()
def test_batch_removal(): train = sc.read( "./data/pancreas.h5ad", backup_url= "https://www.dropbox.com/s/qj1jlm9w10wmt0u/pancreas.h5ad?dl=1") train.obs["cell_type"] = train.obs["celltype"].tolist() network = scgen.VAEArith(x_dimension=train.shape[1], model_path="./models/batch") network.train(train_data=train, n_epochs=1, verbose=1) corrected_adata = scgen.batch_removal(network, train) print(corrected_adata.obs) network.sess.close()