Novartis / scar

scAR (single-cell Ambient Remover) is a deep learning model for removal of the ambient signals in droplet-based single cell omics
https://scar-tutorials.readthedocs.io/en/main/
50 stars 5 forks source link

AttributeError: 'SparseCSRView' object has no attribute 'A' #77

Closed speed090 closed 4 months ago

speed090 commented 4 months ago

I download scar through this command : micromamba create -n scar micromamba activate scar git clone https://github.com/Novartis/scar.git cd scar micromamba env create -f scar-gpu.yml micromamba activate scar

I can import scar, however

a1a9c9d2d576316084ef14ee7f872cc 2024-07-03 13:48:52|INFO|setup_anndata|Use all 199666 droplets. 2024-07-03 13:48:53|INFO|setup_anndata|Estimating ambient profile for ['Gene Expression']...

AttributeError Traceback (most recent call last) Cell In[35], line 3 1 from scar import setup_anndata ----> 3 setup_anndata( 4 adata = hgmm_20k, 5 raw_adata = hgmm_20k_raw, 6 prob = 0.995, 7 kneeplot = True 8 )

File ~/micromamba/envs/scar/lib/python3.11/site-packages/scar/main/_setup.py:145, in setup_anndata(adata, raw_adata, feature_type, prob, min_raw_counts, iterations, n_batch, sample, kneeplot, verbose, figsize) 143 for b in range(n_batch): 144 try: --> 145 count_batch = raw_adata[batch_idx == b].X.astype(int).A 146 except MemoryError: 147 raise MemoryError("use more batches by setting a higher n_batch")

AttributeError: 'SparseCSRView' object has no attribute 'A'

yalayoubi commented 4 months ago

Hi, I am also getting this error, is there a plan to fix this soon?

speed090 commented 4 months ago

c12bb59bd03577df58f5686202f8a40 you should download the specific version python packages. check the packags version!

CaibinSh commented 4 months ago

Thank both of you @yalayoubi @speed090 for reporting and identifying the issue. We have refactored the code to reflect the new changes in scipy. The main branch should work for both scipy 1.13.x and scipy 1.14.x. We will push new release 0.6.1 so that conda install will also work. Best, Caibin