theislab / scgen

Single cell perturbation prediction
https://scgen.readthedocs.io
GNU General Public License v3.0
260 stars 52 forks source link

batch_removal() throws TypeError: concatenate() missing 1 argument: 'self' #30

Closed kleurless closed 3 years ago

kleurless commented 3 years ago

Hi!

I think that I have got a similar issue to #1 (which should be fixed), I have a merged object with 3 batches and 35 cell types. Training of the network works like a charm, but the batch_removal step throws the following error:

adata_sc = adata.copy()
network = scgen.VAEArith(x_dimension= adata_sc.shape[1], model_path="../../data/output/models/batch")
network.train(train_data=adata_sc, n_epochs=20)
corrected_adata = scgen.batch_removal(network, adata_sc, batch_key="orig.ident", cell_label_key="orig.celltype")   

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-9b3ce39d7217> in <module>
----> 1 corrected_adata = scgen.batch_removal(network, adata_sc, batch_key="orig.ident", cell_label_key="orig.celltype")

~\Anaconda3\envs\UMCU\lib\site-packages\scgen\models\util.py in batch_removal(network, adata, batch_key, cell_label_key)
    293             temp_cell[batch_ind[study]].X = batch_list[study].X
    294         shared_ct.append(temp_cell)
--> 295     all_shared_ann = anndata.AnnData.concatenate(*shared_ct, batch_key="concat_batch")
    296     if "concat_batch" in all_shared_ann.obs.columns:
    297         del all_shared_ann.obs["concat_batch"]

TypeError: concatenate() missing 1 required positional argument: 'self'

Any help would be much appreciated!

scanpy==1.4.6 anndata==0.7.1 umap==0.3.10 numpy==1.18.1 scipy==1.4.1 pandas==1.0.1 scikit-learn==0.22.1 statsmodels==0.11.1 python-igraph==0.8.0 louvain==0.6.1 scgen==1.1.4

M0hammadL commented 3 years ago

Hi

We have released a new PyTorch version of the code. Please use this version.

Best Mo

gauravsinghrathore commented 2 years ago

same problem. I have everything updated. I try to concatenate multiple adatas and then train model further going to batch correction. gdown==4.4.0 matplotlib==3.5.1 scgen==2.1.0 numpy==1.21.6 scanpy==1.9.1