-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't working
Description
- I have confirmed this bug exists on the latest version of cell2location. See https://github.com/BayraktarLab/cell2location#installation
- I follow the instructions from the scvi-tools tutorial.
The latest pypi version is 0.1.5, while on github release it is 0.1.4.
$ pixi list -x
Environment: th
Package Version Build Size Kind Source
cell2location 0.1.5 440.1 KiB pypi cell2location-0.1.5-py3-none-any.whl
cuda-toolkit 12.9.1 ha804496_0 20 KiB conda https://conda.anaconda.org/conda-forge/
cuda-version 12.9 h4f385c5_3 21.1 KiB conda https://conda.anaconda.org/conda-forge/
ipykernel 7.0.1 pyha191276_0 128.9 KiB conda https://conda.anaconda.org/conda-forge/
ipywidgets 8.1.7 pyhd8ed1ab_0 111.9 KiB conda https://conda.anaconda.org/conda-forge/
jax 0.7.2 pyhd8ed1ab_0 1.8 MiB conda https://conda.anaconda.org/conda-forge/
jaxlib 0.7.2 cuda129_py311h6669c4c_200 165.6 MiB conda https://conda.anaconda.org/conda-forge/
jupyterlab 4.4.9 pyhd8ed1ab_0 8.1 MiB conda https://conda.anaconda.org/conda-forge/
leidenalg 0.10.2 py311h1ddb823_1 86 KiB conda https://conda.anaconda.org/conda-forge/
marimo 0.16.5 py311hf8ae3fa_0 28.6 MiB conda https://conda.anaconda.org/conda-forge/
pip 25.2 pyh8b19718_0 1.1 MiB conda https://conda.anaconda.org/conda-forge/
pixi-kernel 0.6.7 pyhbbac1ac_0 39.1 KiB conda https://conda.anaconda.org/conda-forge/
py-opencv 4.12.0 qt6_py311h44848da_604 1.1 MiB conda https://conda.anaconda.org/conda-forge/
pyro-ppl 1.9.1 pyhd8ed1ab_1 452.9 KiB conda https://conda.anaconda.org/conda-forge/
python 3.11.14 hfe2f287_1_cpython 29.4 MiB conda https://conda.anaconda.org/conda-forge/
python-igraph 0.11.9 py311hc282e73_1 1.5 MiB conda https://conda.anaconda.org/conda-forge/
pytorch-gpu 2.8.0 cuda129_mkl_h43a4b0b_301 46.2 KiB conda https://conda.anaconda.org/conda-forge/
scanpy 1.11.5 pyhd8ed1ab_0 1.9 MiB conda https://conda.anaconda.org/conda-forge/
scikit-misc 0.5.1 py311h262f814_3 163.4 KiB conda https://conda.anaconda.org/conda-forge/
scvi-tools 1.4.0.post1 pyhd8ed1ab_0 340 KiB conda https://conda.anaconda.org/conda-forge/
squidpy 1.6.5 pyhd8ed1ab_0 120.2 KiB conda https://conda.anaconda.org/conda-forge/
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)
# list cell types and genes for plotting
ctypes = ['T_CD4+_TfH_GC', 'T_CD4+_naive', 'B_GC_LZ']
genes = ['CD3D', 'CR2']
with mpl.rc_context({'axes.facecolor': 'black'}):
# select one slide
slide = select_slide(adata_vis, 'V1_Human_Lymph_Node')
from tutorial_utils import plot_genes_per_cell_type
plot_genes_per_cell_type(slide, genes, ctypes);---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[/tmp/ipykernel_64763/2598101914.py](http://127.0.0.1:8000/tmp/ipykernel_64763/2598101914.py) in ?()
6 # select one slide
7 slide = select_slide(adata_vis, 'V1_Human_Lymph_Node')
8
9 from tutorial_utils import plot_genes_per_cell_type
---> 10 plot_genes_per_cell_type(slide, genes, ctypes);
[~/git/pixi-envs/cell2loc/tutorial_utils.py](http://127.0.0.1:8000/lab/tree/~/git/pixi-envs/cell2loc/tutorial_utils.py) in ?(slide, genes, ctypes)
14 # plots of every gene
15 for j in range(n_genes):
16 # limit color scale at 99.2% quantile of gene expression (computed across cell types)
17 quantile_across_ct = np.array(
---> 18 [
19 np.quantile(slide.layers[n][:, slide.var["SYMBOL"] == genes[j]].toarray(), 0.992)
20 for n in slide.uns["mod"]["factor_names"]
21 ]
[~/git/pixi-envs/cell2loc/tutorial_utils.py](http://127.0.0.1:8000/lab/tree/~/git/pixi-envs/cell2loc/tutorial_utils.py) in ?(.0)
18 def plot_genes_per_cell_type(slide, genes, ctypes):
---> 19 n_genes = len(genes)
20 n_ctypes = len(ctypes)
21 fig, axs = plt.subplots(
22 nrows=n_genes, ncols=n_ctypes + 1, figsize=(4.5 * (n_ctypes + 1) + 2, 5 * n_genes + 1), squeeze=False
[~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/scipy/sparse/_index.py](http://127.0.0.1:8000/lab/tree/~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/scipy/sparse/_index.py) in ?(self, key)
29 def __getitem__(self, key):
---> 30 index, new_shape = self._validate_indices(key)
31
32 # 1D array
33 if len(index) == 1:
[~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/scipy/sparse/_index.py](http://127.0.0.1:8000/lab/tree/~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/scipy/sparse/_index.py) in ?(self, key)
279 if ix.shape != mid_shape:
280 raise IndexError(
281 f"bool index {i} has shape {mid_shape} instead of {ix.shape}"
282 )
--> 283 index.extend(ix.nonzero())
284 array_indices.extend(range(index_ndim, tmp_ndim))
285 index_ndim = tmp_ndim
286 else: # dense array
[~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/pandas/core/generic.py](http://127.0.0.1:8000/lab/tree/~/git/pixi-envs/cell2loc/.pixi/envs/th/lib/python3.11/site-packages/pandas/core/generic.py) in ?(self, name)
6317 and name not in self._accessors
6318 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6319 ):
6320 return self[name]
-> 6321 return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'nonzero'Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working