Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: Can't instantiate abstract class SCGEN with abstract methods setup_anndata #91

Open
GGboy-Zzz opened this issue Nov 20, 2023 · 2 comments

Comments

@GGboy-Zzz
Copy link

I have been trying to merge multiple single cell data using scgen recently, but when I tried to run the tutorial, an error occurred,as follows,

TypeError Traceback (most recent call last)
in
1 scgen.SCGEN.setup_anndata(train, batch_key="batch", labels_key="cell_type")
----> 2 model = scgen.SCGEN(train)
3 model.save("/home/zhuyong/test_scgen/saved_models/model_batch_removal.pt", overwrite=True)

TypeError: Can't instantiate abstract class SCGEN with abstract methods setup_anndata
I referred to issue #53 #54 etc and confirmed that my scvi-tools version is 0.14.0. I even reinstalled version 0.13.0, but it still doesn't work. Do you have any good suggestions? @adamgayoso @M0hammadL

@Tigerrr07
Copy link

Hello, I encountered the same issue as you. I was able to solve it by following these steps:

  1. Install scgen from the repo using the following commands:
conda create -n scgen-dev python=3.8 -y
pip install torch==1.12.0+cu102 torchvision==0.13.0+cu102 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu102  # a given version of pytorch, here I use torch1.12.0+cu102
pip install git+https://github.com/theislab/scgen.git  # or git clone the repo and run pip install .
  1. Modify train_new in the python code as follows::
train_new = train[~((train.obs["cell_type"] == "CD4T") &
                    (train.obs["condition"] == "stimulated"))].copy()

This solution worked for me and the tutorial. I hope it is helpful for you too!

@JeanRadig
Copy link

Instead of scgen.SCGEN.setup_anndata(train, batch_key="batch", labels_key="cell_type") write scgen.setup_anndata(train, batch_key="batch", labels_key="cell_type"). Remove SCGEN

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants