-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Report
I'm following the tutorial from the CosMX NSCLC dataset, but I'm instead using two tissue array slides of Xenium data. There are 48 tissue punches in the array, and I'm using these for the scvi batch_key and downstream library_key in spatial_neighbors and aggregate_neighbors.
Everything seems fine until I call cc.gr.aggregate_neighbors(), where I make it 12% of the way through when i receive an error message about converting integer scalar.
cc.gr.aggregate_neighbors(adata, n_layers=3, use_rep='X_scVI', out_key='X_cellcharter', sample_key='TMApunch')
12%|███████████████ | 6/48 [00:50<05:56, 8.50s/it]
Traceback (most recent call last):
File "", line 1, in
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/site-packages/cellcharter/gr/_aggr.py", line 170, in aggregate_neighbors
adj=adata[idxs].obsp[connectivity_key],
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 164, in getitem
_subset(self.parent_mapping[key], self.subset_idx),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/functools.py", line 912, in wrapper
return dispatch(args[0].class)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/site-packages/anndata/_core/index.py", line 200, in _subset_sparse
return a[subset_idx]
~^^^^^^^^^^^^
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/site-packages/scipy/sparse/_index.py", line 104, in getitem
res = self._get_arrayXarray(row, col)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tsa27/.conda/envs/cellcharter-env/lib/python3.12/site-packages/scipy/sparse/_compressed.py", line 565, in _get_arrayXarray
csr_sample_values(M, N, self.indptr, self.indices, self.data,
ValueError: could not convert integer scalar
I've looked at the delauney graph layouts for TMAs 5-8 (where it seemingly fails?) and there's nothing particularly strange about them, though there are sometimes parts of the graphs where one or two cells are disconnected from the rest of the graph.
Converting the connectivity matrix into integer class does not change the outcome.
Reducing n_layers=2 does not change the outcome.
This was run with an RTX A5000, I can try other GPUs if that's a factor.
my adata object looks like this:
AnnData object with n_obs × n_vars = 831791 × 479
obs: 'fov', 'AspectRatio', 'CenterX_global_px', 'CenterY_global_px', 'nCount_Xenium', 'nFeature_Xenium', 'TMApunch', 'SampleID', 'PatientID', 'Cohort', 'HistoSlide', 'Disease', 'cellTypeFibrosis', 'cell_ID', 'slide', '_scvi_batch', '_scvi_labels'
var: 'n_counts'
uns: 'spatial_fov', 'log1p', '_scvi_uuid', '_scvi_manager_uuid', 'spatial_neighbors', 'TMApunch_colors'
obsm: 'spatial', 'spatial_fov', 'X_scVI'
layers: 'counts'
obsp: 'spatial_connectivities', 'spatial_distances'
here is my session info:
anndata 0.12.7
cellcharter 0.3.5
lightning 2.6.0
matplotlib 3.10.8
numpy 2.3.5
pandas 2.3.3
scanpy 1.11.5
scvi 1.4.1
session_info v1.0.1
squidpy 1.7.0PIL 12.1.0
absl 2.3.1
affine 2.4.0
attr 25.4.0
backports NA
certifi 2026.01.04
charset_normalizer 3.4.4
click 8.3.1
cloudpickle 3.1.2
cuda 12.9.4
cycler 0.12.1
cython_runtime NA
dask 2024.11.2
dask_image NA
datashader 0.18.2
dateutil 2.9.0.post0
docrep 0.3.2
donfig 0.8.1.post1
fsspec 2026.1.0
geopandas 1.1.2
google_crc32c NA
h5py 3.15.1
idna 3.11
imagecodecs 2025.11.11
imageio 2.37.2
jaraco NA
jinja2 3.1.6
joblib 1.5.3
kiwisolver 1.4.9
lazy_loader 0.4
legacy_api_wrap NA
lightning_fabric 2.6.0
lightning_utilities 0.15.2
llvmlite 0.46.0
markupsafe 3.0.3
matplotlib_scalebar 0.9.0
ml_collections 1.1.0
more_itertools 10.8.0
mpl_toolkits NA
mpmath 1.3.0
mudata 0.3.2
multipledispatch 0.6.0
multiscale_spatial_image 2.0.3
natsort 8.4.0
networkx 3.6.1
numba 0.63.1
numcodecs 0.16.5
ome_zarr NA
opt_einsum 3.4.0
packaging 25.0
pathlib_abc NA
patsy 1.0.2
pkg_resources NA
platformdirs 4.5.1
pooch v1.8.2
pyarrow 23.0.0
pyct 0.6.0
pygments 2.19.2
pyparsing 3.3.2
pyproj 3.7.2
pyro 1.9.1
pytorch_lightning 2.6.0
pytz 2025.2
rasterio 1.5.0
requests 2.32.5
rich NA
scipy 1.17.0
seaborn 0.13.2
shapely 2.1.2
six 1.17.0
skimage 0.26.0
sklearn 1.8.0
sknw 0.1
sparse 0.17.0
spatial_image 1.2.3
spatialdata 0.6.1
spatialdata_plot 0.2.13
statsmodels 0.14.6
sympy 1.14.0
testing NA
threadpoolctl 3.6.0
tifffile 2026.1.14
tlz 1.1.0
toolz 1.1.0
torch 2.10.0+cu128
torchgen NA
torchgmm NA
torchmetrics 1.8.2
tqdm 4.67.1
triton 3.6.0
typing_extensions NA
upath 0.3.8
urllib3 2.6.3
validators 0.35.0
xarray 2025.12.0
xarray_dataclass 3.0.0
xarray_schema 0.0.3
xrspatial 0.5.2
yaml 6.0.3
zarr 3.1.5
zoneinfo NAPython 3.12.12 | packaged by conda-forge | (main, Oct 22 2025, 23:25:55) [GCC 14.3.0]
Linux-4.18.0-553.87.1.el8_10.x86_64-x86_64-with-glibc2.28Session information updated at 2026-01-21 20:43
Thank you for your time!
Version information
No response