Genentech / gReLU

gReLU is a python library to train, interpret, and apply deep learning models to DNA sequences.
https://genentech.github.io/gReLU/
MIT License
228 stars 23 forks source link

'SparseCSCView' object has no attribute 'A' #23

Closed mhfzsharmin closed 3 months ago

mhfzsharmin commented 4 months ago

from grelu.data.dataset import AnnDataSeqDataset

train_dataset = AnnDataSeqDataset( adata=data_train, genome='hg38', rc=True, # reverse complement max_seq_shift=1, # Shift the sequence augment_mode="random", # Randomly select which augmentations to apply to each sequence )


AttributeError Traceback (most recent call last) Cell In[29], line 3 1 from grelu.data.dataset import AnnDataSeqDataset ----> 3 train_dataset = AnnDataSeqDataset( 4 adata=data_train, 5 genome='hg38', 6 rc=True, # reverse complement 7 max_seq_shift=1, # Shift the sequence 8 augment_mode="random", # Randomly select which augmentations to apply to each sequence 9 )

File ~/.conda/envs/grelu/lib/python3.11/site-packages/grelu/data/dataset.py:333, in AnnDataSeqDataset.init(self, adata, label_key, seq_len, genome, end, rc, max_seq_shift, seed, augment_mode) 331 if label_key is None: 332 if scipy.sparse.issparse(adata.X): --> 333 labels = adata.X.A.T 334 else: 335 labels = adata.X.T

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

gokceneraslan commented 4 months ago

Thanks for the report. Can you write which notebook triggered this?

mhfzsharmin commented 4 months ago

https://github.com/Genentech/gReLU/blob/main/docs/tutorials/2_finetune.ipynb and https://colab.research.google.com/drive/1lrVpN2xJmbqoXEPy3IpuwKOaS-WuhWlx?usp=sharing

avantikalal commented 3 months ago

@mhfzsharmin please check your scipy version and, if it is >=1.14, try downgrading to 1.13. This issue is discussed here: https://github.com/welch-lab/MultiVelo/issues/42

I will push a fix in the meantime.

avantikalal commented 3 months ago

Fixed in #37