theislab / scgen

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

Error in network.batch_removal() due to missing positional argument in AnnData.concatenate() #83

Open macelik opened 1 year ago

macelik commented 1 year ago

Hello,

I'm encountering an issue while using scgen for batch correction. The training part works fine, but I'm facing an error when calling network.batch_removal(). The error message is as follows:

Traceback (most recent call last): File "/work/project/ladcol_011/polish/community-paper/src/data_preprocessing/vanGalen_Hourigan/./quick.py", line 281, in <module> adata_afterCorrection = network.batch_removal() File "/work/project/ladcol_011/conda_path/miniconda3/envs/scgen-env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/work/project/ladcol_011/conda_path/miniconda3/envs/scgen-env/lib/python3.10/site-packages/scgen/_scgen.py", line 268, in batch_removal all_shared_ann = AnnData.concatenate( TypeError: AnnData.concatenate() missing 1 required positional argument: 'self'

I have attempted to resolve this issue by trying different versions of Python (3.7 and 3.10) as well as different versions of anndata (0.8, 0.9, and 0.9.1). Additionally, I have tested solutions mentioned in previous issues, such as using pandas==1.5.2. I have also tried the pull request that aims to address this problem (#77), but unfortunately, none of these attempts have been successful.

I would greatly appreciate any assistance you can provide.

umahajanatlmu commented 11 months ago

Hi, any update with this issue? I am also encountering same issue. Your help would be greatly appreciated.

M0hammadL commented 11 months ago

@Koncopd

macelik commented 11 months ago

Hi, any update with this issue? I am also encountering same issue. Your help would be greatly appreciated.

Hi there, I got it working by installing the below libraries with the specified versions, and I have applied the changes in this PR #77.

anndata==0.9.1 pandas==1.5.3 scanpy==1.9.3 scgen==2.1.0 and python==3.8

umahajanatlmu commented 11 months ago

@macelik thank you. I tried it. however I am getting error `

corrected_adata = model.batch_removal() Traceback (most recent call last): File "", line 1, in File "/dss/dsshome1/lxc00/ru64waf2/miniconda3/envs/PYenv/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/dss/dsshome1/lxc00/ru64waf2/miniconda3/envs/PYenv/lib/python3.8/site-packages/scgen/_scgen.py", line 268, in batch_removal all_shared_ann = AnnData.concatenate( TypeError: concatenate() missing 1 required positional argument: 'self' `

Koncopd commented 11 months ago

@umahajanatlmu it seems that you need the packages versions listed here https://github.com/theislab/scgen/issues/82