Identification of High Curl, High Elongation, Low Elongation, High Linearity and Low Linearity cell types - DLPFC 151508
!pip install cellcharter
!pip install squidpy
!pip install scanpy
Collecting cellcharter
Downloading cellcharter-0.3.7-py3-none-any.whl.metadata (9.8 kB)
Collecting anndata (from cellcharter)
Downloading anndata-0.12.16-py3-none-any.whl.metadata (9.9 kB)
Requirement already satisfied: rasterio in /usr/local/lib/python3.12/dist-packages (from cellcharter) (1.5.0)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.12/dist-packages (from cellcharter) (1.6.1)
Collecting session-info (from cellcharter)
Downloading session_info-1.0.1-py3-none-any.whl.metadata (5.1 kB)
Collecting sknw (from cellcharter)
Downloading sknw-0.15-py3-none-any.whl.metadata (367 bytes)
Collecting spatialdata (from cellcharter)
Downloading spatialdata-0.7.3-py3-none-any.whl.metadata (9.8 kB)
Collecting spatialdata-plot (from cellcharter)
Downloading spatialdata_plot-0.3.4-py3-none-any.whl.metadata (7.4 kB)
Collecting squidpy>=1.6.3 (from cellcharter)
Downloading squidpy-1.8.1-py3-none-any.whl.metadata (8.2 kB)
Collecting torchgmm>=0.1.4 (from cellcharter)
Downloading torchgmm-0.1.4-py3-none-any.whl.metadata (7.8 kB)
Requirement already satisfied: aiohttp>=3.8.1 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (3.13.5)
Requirement already satisfied: cycler>=0.11 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (0.12.1)
Collecting dask-image>=0.5 (from squidpy>=1.6.3->cellcharter)
Downloading dask_image-2025.11.0-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: dask>=2021.2 in /usr/local/lib/python3.12/dist-packages (from dask[array]>=2021.2->squidpy>=1.6.3->cellcharter) (2026.3.0)
Collecting docrep>=0.3.1 (from squidpy>=1.6.3->cellcharter)
Downloading docrep-0.3.2.tar.gz (33 kB)
Preparing metadata (setup.py) ... ?25l?25hdone
Collecting fast-array-utils (from squidpy>=1.6.3->cellcharter)
Downloading fast_array_utils-1.4.1-py3-none-any.whl.metadata (2.7 kB)
Requirement already satisfied: fsspec>=2021.11 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (2025.3.0)
Collecting imagecodecs<2026,>=2025.8.2 (from squidpy>=1.6.3->cellcharter)
Downloading imagecodecs-2025.11.11-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (20 kB)
Collecting matplotlib-scalebar>=0.8 (from squidpy>=1.6.3->cellcharter)
Downloading matplotlib_scalebar-0.9.0-py3-none-any.whl.metadata (18 kB)
Requirement already satisfied: matplotlib>=3.3 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (3.10.0)
Requirement already satisfied: networkx>=2.6 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (3.6.1)
Requirement already satisfied: numba>=0.56.4 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (0.60.0)
Requirement already satisfied: numpy>=1.23 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (2.0.2)
Collecting omnipath>=1.0.7 (from squidpy>=1.6.3->cellcharter)
Downloading omnipath-1.0.12-py3-none-any.whl.metadata (7.0 kB)
Requirement already satisfied: pandas>=2.1 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (2.2.2)
Requirement already satisfied: pillow>=8 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (11.3.0)
Requirement already satisfied: pooch>=1.6 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (1.9.0)
Requirement already satisfied: pyyaml>=6 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (6.0.3)
Collecting scanpy>=1.9.3 (from squidpy>=1.6.3->cellcharter)
Downloading scanpy-1.12.1-py3-none-any.whl.metadata (8.4 kB)
Requirement already satisfied: scikit-image>=0.25 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (0.25.2)
Requirement already satisfied: statsmodels>=0.12 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (0.14.6)
Requirement already satisfied: tifffile!=2022.4.22 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (2026.4.11)
Requirement already satisfied: tqdm>=4.50.2 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (4.67.3)
Collecting validators>=0.18.2 (from squidpy>=1.6.3->cellcharter)
Downloading validators-0.35.0-py3-none-any.whl.metadata (3.9 kB)
Requirement already satisfied: xarray>=2024.10 in /usr/local/lib/python3.12/dist-packages (from squidpy>=1.6.3->cellcharter) (2025.12.0)
Collecting zarr>=3 (from squidpy>=1.6.3->cellcharter)
Downloading zarr-3.2.1-py3-none-any.whl.metadata (8.7 kB)
Collecting array-api-compat>=1.7.1 (from anndata->cellcharter)
Downloading array_api_compat-1.14.0-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: h5py>=3.8 in /usr/local/lib/python3.12/dist-packages (from anndata->cellcharter) (3.16.0)
Collecting legacy-api-wrap (from anndata->cellcharter)
Downloading legacy_api_wrap-1.5-py3-none-any.whl.metadata (2.2 kB)
Requirement already satisfied: natsort in /usr/local/lib/python3.12/dist-packages (from anndata->cellcharter) (8.4.0)
Requirement already satisfied: packaging>=24.2 in /usr/local/lib/python3.12/dist-packages (from anndata->cellcharter) (26.1)
Requirement already satisfied: scipy!=1.17.0,>=1.12 in /usr/local/lib/python3.12/dist-packages (from anndata->cellcharter) (1.16.3)
Collecting scverse-misc>=0.0.3 (from anndata->cellcharter)
Downloading scverse_misc-0.0.7-py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->cellcharter) (1.5.3)
Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->cellcharter) (3.6.0)
Collecting annsel>=0.1.2 (from spatialdata->cellcharter)
Downloading annsel-0.1.2-py3-none-any.whl.metadata (19 kB)
Requirement already satisfied: click in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (8.3.3)
Collecting dask>=2021.2 (from dask[array]>=2021.2->squidpy>=1.6.3->cellcharter)
Downloading dask-2026.1.1-py3-none-any.whl.metadata (3.8 kB)
Collecting datashader (from spatialdata->cellcharter)
Downloading datashader-0.19.1-py3-none-any.whl.metadata (8.0 kB)
Collecting distributed<2026.1.2 (from spatialdata->cellcharter)
Downloading distributed-2026.1.1-py3-none-any.whl.metadata (3.4 kB)
Requirement already satisfied: geopandas>=0.14 in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (1.1.3)
Collecting multiscale-spatial-image==2.0.3 (from spatialdata->cellcharter)
Downloading multiscale_spatial_image-2.0.3-py3-none-any.whl.metadata (25 kB)
Collecting ome-zarr>=0.14.0 (from spatialdata->cellcharter)
Downloading ome_zarr-0.16.0-py3-none-any.whl.metadata (2.9 kB)
Requirement already satisfied: pyarrow in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (18.1.0)
Requirement already satisfied: rich in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (13.9.4)
Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (75.2.0)
Requirement already satisfied: shapely>=2.0.1 in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (2.1.2)
Collecting spatial-image>=1.2.3 (from spatialdata->cellcharter)
Downloading spatial_image-1.2.3-py3-none-any.whl.metadata (7.0 kB)
Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.12/dist-packages (from spatialdata->cellcharter) (4.15.0)
Collecting universal-pathlib>=0.2.6 (from spatialdata->cellcharter)
Downloading universal_pathlib-0.3.10-py3-none-any.whl.metadata (39 kB)
Collecting xarray-spatial>=0.3.5 (from spatialdata->cellcharter)
Downloading xarray_spatial-0.9.9-py3-none-any.whl.metadata (54 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 kB 1.9 MB/s eta 0:00:00
?25hRequirement already satisfied: python-dateutil in /usr/local/lib/python3.12/dist-packages (from multiscale-spatial-image==2.0.3->spatialdata->cellcharter) (2.9.0.post0)
Collecting xarray-dataclass>=3.0.0 (from multiscale-spatial-image==2.0.3->spatialdata->cellcharter)
Downloading xarray_dataclass-3.0.0-py3-none-any.whl.metadata (14 kB)
Collecting pytorch-lightning>=2.0.0 (from torchgmm>=0.1.4->cellcharter)
Downloading pytorch_lightning-2.6.4-py3-none-any.whl.metadata (21 kB)
Requirement already satisfied: torch>1.11.0 in /usr/local/lib/python3.12/dist-packages (from torchgmm>=0.1.4->cellcharter) (2.10.0+cpu)
Collecting torchmetrics>=0.6 (from torchgmm>=0.1.4->cellcharter)
Downloading torchmetrics-1.9.0-py3-none-any.whl.metadata (23 kB)
Requirement already satisfied: affine in /usr/local/lib/python3.12/dist-packages (from rasterio->cellcharter) (2.4.0)
Requirement already satisfied: attrs in /usr/local/lib/python3.12/dist-packages (from rasterio->cellcharter) (26.1.0)
Requirement already satisfied: certifi in /usr/local/lib/python3.12/dist-packages (from rasterio->cellcharter) (2026.4.22)
Requirement already satisfied: cligj>=0.5 in /usr/local/lib/python3.12/dist-packages (from rasterio->cellcharter) (0.7.2)
Requirement already satisfied: pyparsing in /usr/local/lib/python3.12/dist-packages (from rasterio->cellcharter) (3.3.2)
Collecting stdlib_list (from session-info->cellcharter)
Downloading stdlib_list-0.12.0-py3-none-any.whl.metadata (3.3 kB)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (2.6.1)
Requirement already satisfied: aiosignal>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (1.4.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (1.8.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (6.7.1)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (0.4.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.12/dist-packages (from aiohttp>=3.8.1->squidpy>=1.6.3->cellcharter) (1.23.0)
Requirement already satisfied: more-itertools>=10.7 in /usr/local/lib/python3.12/dist-packages (from annsel>=0.1.2->spatialdata->cellcharter) (10.8.0)
Requirement already satisfied: narwhals>=2.14 in /usr/local/lib/python3.12/dist-packages (from narwhals[pandas]>=2.14->annsel>=0.1.2->spatialdata->cellcharter) (2.20.0)
Collecting session-info2 (from annsel>=0.1.2->spatialdata->cellcharter)
Downloading session_info2-0.4.1-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: cloudpickle>=3.0.0 in /usr/local/lib/python3.12/dist-packages (from dask>=2021.2->dask[array]>=2021.2->squidpy>=1.6.3->cellcharter) (3.1.2)
Requirement already satisfied: partd>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from dask>=2021.2->dask[array]>=2021.2->squidpy>=1.6.3->cellcharter) (1.4.2)
Requirement already satisfied: toolz>=0.12.0 in /usr/local/lib/python3.12/dist-packages (from dask>=2021.2->dask[array]>=2021.2->squidpy>=1.6.3->cellcharter) (0.12.1)
Collecting pims>=0.4.1 (from dask-image>=0.5->squidpy>=1.6.3->cellcharter)
Downloading pims-0.7.tar.gz (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.8/87.8 kB 3.1 MB/s eta 0:00:00
?25h Preparing metadata (setup.py) ... ?25l?25hdone
INFO: pip is looking at multiple versions of dask[array] to determine which version is compatible with other requirements. This could take a while.
Collecting dask[array]>=2021.2 (from squidpy>=1.6.3->cellcharter)
Downloading dask-2026.1.2-py3-none-any.whl.metadata (3.8 kB)
Requirement already satisfied: jinja2>=2.10.3 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (3.1.6)
Requirement already satisfied: locket>=1.0.0 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (1.0.0)
Requirement already satisfied: msgpack>=1.0.2 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (1.1.2)
Requirement already satisfied: psutil>=5.8.0 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (5.9.5)
Collecting sortedcontainers>=2.0.5 (from distributed<2026.1.2->spatialdata->cellcharter)
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting tblib!=3.2.0,!=3.2.1,>=1.6.0 (from distributed<2026.1.2->spatialdata->cellcharter)
Downloading tblib-3.2.2-py3-none-any.whl.metadata (27 kB)
Requirement already satisfied: tornado>=6.2.0 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (6.5.1)
Requirement already satisfied: urllib3>=1.26.5 in /usr/local/lib/python3.12/dist-packages (from distributed<2026.1.2->spatialdata->cellcharter) (2.5.0)
Collecting zict>=3.0.0 (from distributed<2026.1.2->spatialdata->cellcharter)
Downloading zict-3.0.0-py2.py3-none-any.whl.metadata (899 bytes)
Requirement already satisfied: six in /usr/local/lib/python3.12/dist-packages (from docrep>=0.3.1->squidpy>=1.6.3->cellcharter) (1.17.0)
Requirement already satisfied: pyogrio>=0.7.2 in /usr/local/lib/python3.12/dist-packages (from geopandas>=0.14->spatialdata->cellcharter) (0.12.1)
Requirement already satisfied: pyproj>=3.5.0 in /usr/local/lib/python3.12/dist-packages (from geopandas>=0.14->spatialdata->cellcharter) (3.7.2)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.3->squidpy>=1.6.3->cellcharter) (1.3.3)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.3->squidpy>=1.6.3->cellcharter) (4.62.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.3->squidpy>=1.6.3->cellcharter) (1.5.0)
Requirement already satisfied: llvmlite<0.44,>=0.43.0dev0 in /usr/local/lib/python3.12/dist-packages (from numba>=0.56.4->squidpy>=1.6.3->cellcharter) (0.43.0)
INFO: pip is looking at multiple versions of ome-zarr to determine which version is compatible with other requirements. This could take a while.
Collecting ome-zarr>=0.14.0 (from spatialdata->cellcharter)
Downloading ome_zarr-0.15.0-py3-none-any.whl.metadata (2.9 kB)
Requirement already satisfied: requests in /usr/local/lib/python3.12/dist-packages (from ome-zarr>=0.14.0->spatialdata->cellcharter) (2.32.4)
Collecting rangehttpserver (from ome-zarr>=0.14.0->spatialdata->cellcharter)
Downloading rangehttpserver-1.4.0-py2.py3-none-any.whl.metadata (769 bytes)
Collecting Deprecated (from ome-zarr>=0.14.0->spatialdata->cellcharter)
Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB)
Requirement already satisfied: inflect>=4.1.0 in /usr/local/lib/python3.12/dist-packages (from omnipath>=1.0.7->squidpy>=1.6.3->cellcharter) (7.5.0)
Requirement already satisfied: wrapt>=1.12.0 in /usr/local/lib/python3.12/dist-packages (from omnipath>=1.0.7->squidpy>=1.6.3->cellcharter) (2.1.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas>=2.1->squidpy>=1.6.3->cellcharter) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas>=2.1->squidpy>=1.6.3->cellcharter) (2026.1)
Requirement already satisfied: platformdirs>=2.5.0 in /usr/local/lib/python3.12/dist-packages (from pooch>=1.6->squidpy>=1.6.3->cellcharter) (4.9.6)
Collecting lightning-utilities>=0.10.0 (from pytorch-lightning>=2.0.0->torchgmm>=0.1.4->cellcharter)
Downloading lightning_utilities-0.15.3-py3-none-any.whl.metadata (5.5 kB)
Collecting pandas>=2.1 (from squidpy>=1.6.3->cellcharter)
Downloading pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.metadata (91 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.2/91.2 kB 6.1 MB/s eta 0:00:00
?25hRequirement already satisfied: patsy in /usr/local/lib/python3.12/dist-packages (from scanpy>=1.9.3->squidpy>=1.6.3->cellcharter) (1.0.2)
Requirement already satisfied: pynndescent>=0.5.13 in /usr/local/lib/python3.12/dist-packages (from scanpy>=1.9.3->squidpy>=1.6.3->cellcharter) (0.6.0)
Requirement already satisfied: seaborn>=0.13.2 in /usr/local/lib/python3.12/dist-packages (from scanpy>=1.9.3->squidpy>=1.6.3->cellcharter) (0.13.2)
Requirement already satisfied: umap-learn>=0.5.12 in /usr/local/lib/python3.12/dist-packages (from scanpy>=1.9.3->squidpy>=1.6.3->cellcharter) (0.5.12)
Requirement already satisfied: imageio!=2.35.0,>=2.33 in /usr/local/lib/python3.12/dist-packages (from scikit-image>=0.25->squidpy>=1.6.3->cellcharter) (2.37.3)
Requirement already satisfied: lazy-loader>=0.4 in /usr/local/lib/python3.12/dist-packages (from scikit-image>=0.25->squidpy>=1.6.3->cellcharter) (0.5)
Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from torch>1.11.0->torchgmm>=0.1.4->cellcharter) (3.29.0)
Requirement already satisfied: sympy>=1.13.3 in /usr/local/lib/python3.12/dist-packages (from torch>1.11.0->torchgmm>=0.1.4->cellcharter) (1.14.0)
Collecting pathlib-abc<0.6.0,>=0.5.1 (from universal-pathlib>=0.2.6->spatialdata->cellcharter)
Downloading pathlib_abc-0.5.2-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: zstandard in /usr/local/lib/python3.12/dist-packages (from xarray-spatial>=0.3.5->spatialdata->cellcharter) (0.25.0)
Collecting donfig>=0.8 (from zarr>=3->squidpy>=1.6.3->cellcharter)
Downloading donfig-0.8.1.post1-py3-none-any.whl.metadata (5.0 kB)
Requirement already satisfied: google-crc32c>=1.5 in /usr/local/lib/python3.12/dist-packages (from zarr>=3->squidpy>=1.6.3->cellcharter) (1.8.0)
Collecting numcodecs>=0.14 (from zarr>=3->squidpy>=1.6.3->cellcharter)
Downloading numcodecs-0.16.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (3.4 kB)
Requirement already satisfied: colorcet in /usr/local/lib/python3.12/dist-packages (from datashader->spatialdata->cellcharter) (3.1.0)
Requirement already satisfied: multipledispatch in /usr/local/lib/python3.12/dist-packages (from datashader->spatialdata->cellcharter) (1.0.0)
Requirement already satisfied: param in /usr/local/lib/python3.12/dist-packages (from datashader->spatialdata->cellcharter) (2.3.3)
Collecting pyct (from datashader->spatialdata->cellcharter)
Downloading pyct-0.6.0-py3-none-any.whl.metadata (7.2 kB)
Collecting s3fs (from fsspec[http,s3]->spatialdata->cellcharter)
Downloading s3fs-2026.4.0-py3-none-any.whl.metadata (1.2 kB)
Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from rich->spatialdata->cellcharter) (4.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.12/dist-packages (from rich->spatialdata->cellcharter) (2.20.0)
Requirement already satisfied: typeguard>=4.0.1 in /usr/local/lib/python3.12/dist-packages (from inflect>=4.1.0->omnipath>=1.0.7->squidpy>=1.6.3->cellcharter) (4.5.1)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.12/dist-packages (from jinja2>=2.10.3->distributed<2026.1.2->spatialdata->cellcharter) (3.0.3)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.12/dist-packages (from markdown-it-py>=2.2.0->rich->spatialdata->cellcharter) (0.1.2)
Collecting slicerator>=0.9.8 (from pims>=0.4.1->dask-image>=0.5->squidpy>=1.6.3->cellcharter)
Downloading slicerator-1.1.0-py3-none-any.whl.metadata (1.9 kB)
Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests->ome-zarr>=0.14.0->spatialdata->cellcharter) (3.4.7)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests->ome-zarr>=0.14.0->spatialdata->cellcharter) (3.13)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy>=1.13.3->torch>1.11.0->torchgmm>=0.1.4->cellcharter) (1.3.0)
Collecting aiobotocore<4.0.0,>=2.19.0 (from s3fs->fsspec[http,s3]->spatialdata->cellcharter)
Downloading aiobotocore-3.7.0-py3-none-any.whl.metadata (28 kB)
INFO: pip is looking at multiple versions of s3fs to determine which version is compatible with other requirements. This could take a while.
Collecting s3fs (from fsspec[http,s3]->spatialdata->cellcharter)
Downloading s3fs-2026.3.0-py3-none-any.whl.metadata (1.2 kB)
Downloading s3fs-2026.2.0-py3-none-any.whl.metadata (1.2 kB)
Downloading s3fs-2026.1.0-py3-none-any.whl.metadata (1.2 kB)
Downloading s3fs-2025.12.0-py3-none-any.whl.metadata (1.2 kB)
Collecting aiobotocore<3.0.0,>=2.5.4 (from s3fs->fsspec[http,s3]->spatialdata->cellcharter)
Downloading aiobotocore-2.26.0-py3-none-any.whl.metadata (25 kB)
Collecting s3fs (from fsspec[http,s3]->spatialdata->cellcharter)
Downloading s3fs-2025.10.0-py3-none-any.whl.metadata (1.4 kB)
Downloading s3fs-2025.9.0-py3-none-any.whl.metadata (1.4 kB)
Downloading s3fs-2025.7.0-py3-none-any.whl.metadata (1.4 kB)
INFO: pip is still looking at multiple versions of s3fs to determine which version is compatible with other requirements. This could take a while.
Downloading s3fs-2025.5.1-py3-none-any.whl.metadata (1.9 kB)
Downloading s3fs-2025.5.0-py3-none-any.whl.metadata (1.9 kB)
Downloading s3fs-2025.3.2-py3-none-any.whl.metadata (1.9 kB)
Downloading s3fs-2025.3.1-py3-none-any.whl.metadata (1.9 kB)
Downloading s3fs-2025.3.0-py3-none-any.whl.metadata (1.9 kB)
Collecting aioitertools<1.0.0,>=0.5.1 (from aiobotocore<3.0.0,>=2.5.4->s3fs->fsspec[http,s3]->spatialdata->cellcharter)
Downloading aioitertools-0.13.0-py3-none-any.whl.metadata (3.3 kB)
Collecting botocore<1.41.6,>=1.41.0 (from aiobotocore<3.0.0,>=2.5.4->s3fs->fsspec[http,s3]->spatialdata->cellcharter)
Downloading botocore-1.41.5-py3-none-any.whl.metadata (5.9 kB)
Collecting jmespath<2.0.0,>=0.7.1 (from aiobotocore<3.0.0,>=2.5.4->s3fs->fsspec[http,s3]->spatialdata->cellcharter)
Downloading jmespath-1.1.0-py3-none-any.whl.metadata (7.6 kB)
Collecting wrapt>=1.12.0 (from omnipath>=1.0.7->squidpy>=1.6.3->cellcharter)
Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB)
Downloading cellcharter-0.3.7-py3-none-any.whl (51 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.3/51.3 kB 3.4 MB/s eta 0:00:00
?25hDownloading squidpy-1.8.1-py3-none-any.whl (193 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 193.9/193.9 kB 8.6 MB/s eta 0:00:00
?25hDownloading anndata-0.12.16-py3-none-any.whl (175 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.3/175.3 kB 12.5 MB/s eta 0:00:00
?25hDownloading spatialdata-0.7.3-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.2/199.2 kB 13.8 MB/s eta 0:00:00
?25hDownloading multiscale_spatial_image-2.0.3-py3-none-any.whl (29 kB)
Downloading torchgmm-0.1.4-py3-none-any.whl (46 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.1/46.1 kB 3.2 MB/s eta 0:00:00
?25hDownloading session_info-1.0.1-py3-none-any.whl (9.1 kB)
Downloading sknw-0.15-py3-none-any.whl (4.6 kB)
Downloading spatialdata_plot-0.3.4-py3-none-any.whl (93 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.3/93.3 kB 4.2 MB/s eta 0:00:00
?25hDownloading annsel-0.1.2-py3-none-any.whl (19 kB)
Downloading array_api_compat-1.14.0-py3-none-any.whl (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.1/60.1 kB 2.6 MB/s eta 0:00:00
?25hDownloading dask-2026.1.1-py3-none-any.whl (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 44.7 MB/s eta 0:00:00
?25hDownloading dask_image-2025.11.0-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.9/61.9 kB 4.1 MB/s eta 0:00:00
?25hDownloading distributed-2026.1.1-py3-none-any.whl (1.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 41.4 MB/s eta 0:00:00
?25hDownloading imagecodecs-2025.11.11-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (23.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.2/23.2 MB 42.8 MB/s eta 0:00:00
?25hDownloading matplotlib_scalebar-0.9.0-py3-none-any.whl (16 kB)
Downloading ome_zarr-0.15.0-py3-none-any.whl (45 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.2/45.2 kB 2.5 MB/s eta 0:00:00
?25hDownloading omnipath-1.0.12-py3-none-any.whl (51 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.6/51.6 kB 4.0 MB/s eta 0:00:00
?25hDownloading pytorch_lightning-2.6.4-py3-none-any.whl (852 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 852.2/852.2 kB 37.0 MB/s eta 0:00:00
?25hDownloading scanpy-1.12.1-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 52.6 MB/s eta 0:00:00
?25hDownloading fast_array_utils-1.4.1-py3-none-any.whl (39 kB)
Downloading legacy_api_wrap-1.5-py3-none-any.whl (10 kB)
Downloading pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (12.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 57.4 MB/s eta 0:00:00
?25hDownloading scverse_misc-0.0.7-py3-none-any.whl (13 kB)
Downloading spatial_image-1.2.3-py3-none-any.whl (8.7 kB)
Downloading torchmetrics-1.9.0-py3-none-any.whl (983 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 983.4/983.4 kB 34.4 MB/s eta 0:00:00
?25hDownloading universal_pathlib-0.3.10-py3-none-any.whl (83 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.5/83.5 kB 5.8 MB/s eta 0:00:00
?25hDownloading validators-0.35.0-py3-none-any.whl (44 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.7/44.7 kB 2.9 MB/s eta 0:00:00
?25hDownloading xarray_spatial-0.9.9-py3-none-any.whl (13.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.3/13.3 MB 33.0 MB/s eta 0:00:00
?25hDownloading zarr-3.2.1-py3-none-any.whl (319 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 319.6/319.6 kB 13.1 MB/s eta 0:00:00
?25hDownloading datashader-0.19.1-py3-none-any.whl (10.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 32.4 MB/s eta 0:00:00
?25hDownloading stdlib_list-0.12.0-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.6/87.6 kB 5.9 MB/s eta 0:00:00
?25hDownloading donfig-0.8.1.post1-py3-none-any.whl (21 kB)
Downloading lightning_utilities-0.15.3-py3-none-any.whl (31 kB)
Downloading numcodecs-0.16.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.2/9.2 MB 54.8 MB/s eta 0:00:00
?25hDownloading pathlib_abc-0.5.2-py3-none-any.whl (19 kB)
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Downloading tblib-3.2.2-py3-none-any.whl (12 kB)
Downloading xarray_dataclass-3.0.0-py3-none-any.whl (16 kB)
Downloading zict-3.0.0-py2.py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.3/43.3 kB 1.9 MB/s eta 0:00:00
?25hDownloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB)
Downloading pyct-0.6.0-py3-none-any.whl (16 kB)
Downloading rangehttpserver-1.4.0-py2.py3-none-any.whl (7.8 kB)
Downloading s3fs-2025.3.0-py3-none-any.whl (30 kB)
Downloading session_info2-0.4.1-py3-none-any.whl (17 kB)
Downloading aiobotocore-2.26.0-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.3/87.3 kB 3.5 MB/s eta 0:00:00
?25hDownloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 2.9 MB/s eta 0:00:00
?25hDownloading slicerator-1.1.0-py3-none-any.whl (10 kB)
Downloading aioitertools-0.13.0-py3-none-any.whl (24 kB)
Downloading botocore-1.41.5-py3-none-any.whl (14.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.3/14.3 MB 56.4 MB/s eta 0:00:00
?25hDownloading jmespath-1.1.0-py3-none-any.whl (20 kB)
Building wheels for collected packages: docrep, pims
Building wheel for docrep (setup.py) ... ?25l?25hdone
Created wheel for docrep: filename=docrep-0.3.2-py3-none-any.whl size=19876 sha256=ce85806312bcfa7ef7d2679d6a69238fb323ee512d88106fac566ea013da6f81
Stored in directory: /root/.cache/pip/wheels/d6/19/ee/0a6a1793d91c449563b49ccab57ce52da3e6fab7614836bd8c
Building wheel for pims (setup.py) ... ?25l?25hdone
Created wheel for pims: filename=PIMS-0.7-py3-none-any.whl size=84590 sha256=9845009da27c50089849569edf21c466c25c6f8334201f7e02d140e083350e10
Stored in directory: /root/.cache/pip/wheels/be/9c/72/7cb84823aaa980c2e44064caae0ba869239270fac14f7129aa
Successfully built docrep pims
Installing collected packages: sortedcontainers, slicerator, rangehttpserver, zict, wrapt, validators, tblib, stdlib_list, session-info2, pyct, pathlib-abc, numcodecs, lightning-utilities, legacy-api-wrap, jmespath, imagecodecs, fast-array-utils, donfig, docrep, array-api-compat, aioitertools, zarr, universal-pathlib, sknw, session-info, scverse-misc, pims, pandas, Deprecated, dask, botocore, torchmetrics, omnipath, matplotlib-scalebar, distributed, anndata, aiobotocore, xarray-spatial, xarray-dataclass, s3fs, pytorch-lightning, datashader, annsel, torchgmm, spatial-image, scanpy, dask-image, ome-zarr, multiscale-spatial-image, spatialdata, spatialdata-plot, squidpy, cellcharter
Attempting uninstall: wrapt
Found existing installation: wrapt 2.1.2
Uninstalling wrapt-2.1.2:
Successfully uninstalled wrapt-2.1.2
Attempting uninstall: pandas
Found existing installation: pandas 2.2.2
Uninstalling pandas-2.2.2:
Successfully uninstalled pandas-2.2.2
Attempting uninstall: dask
Found existing installation: dask 2026.3.0
Uninstalling dask-2026.3.0:
Successfully uninstalled dask-2026.3.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-colab 1.0.0 requires pandas==2.2.2, but you have pandas 2.3.3 which is incompatible.
Successfully installed Deprecated-1.3.1 aiobotocore-2.26.0 aioitertools-0.13.0 anndata-0.12.16 annsel-0.1.2 array-api-compat-1.14.0 botocore-1.41.5 cellcharter-0.3.7 dask-2026.1.1 dask-image-2025.11.0 datashader-0.19.1 distributed-2026.1.1 docrep-0.3.2 donfig-0.8.1.post1 fast-array-utils-1.4.1 imagecodecs-2025.11.11 jmespath-1.1.0 legacy-api-wrap-1.5 lightning-utilities-0.15.3 matplotlib-scalebar-0.9.0 multiscale-spatial-image-2.0.3 numcodecs-0.16.5 ome-zarr-0.15.0 omnipath-1.0.12 pandas-2.3.3 pathlib-abc-0.5.2 pims-0.7 pyct-0.6.0 pytorch-lightning-2.6.4 rangehttpserver-1.4.0 s3fs-2025.3.0 scanpy-1.12.1 scverse-misc-0.0.7 session-info-1.0.1 session-info2-0.4.1 sknw-0.15 slicerator-1.1.0 sortedcontainers-2.4.0 spatial-image-1.2.3 spatialdata-0.7.3 spatialdata-plot-0.3.4 squidpy-1.8.1 stdlib_list-0.12.0 tblib-3.2.2 torchgmm-0.1.4 torchmetrics-1.9.0 universal-pathlib-0.3.10 validators-0.35.0 wrapt-1.17.3 xarray-dataclass-3.0.0 xarray-spatial-0.9.9 zarr-3.2.1 zict-3.0.0
import squidpy as sq
import cellcharter as cc
import scanpy as sc
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
flag = True
df_val = pd.DataFrame()
Mounting google drive to accessing input data
from google.colab import drive
drive.mount('/content/drive')
Mounted at /content/drive
Shape Characterization
def cellcharter_metrics(data_name, category, data_path, ctp_path):
global flag, df_val
adata = sc.read_h5ad(data_path)
ctp = pd.read_csv(ctp_path)
print ("ctp shape", ctp.shape, "and", ctp.columns)
if (adata.shape[0] != ctp.shape[0]):
adata = adata[adata.obs_names.isin(ctp[ctp.columns[0]])]
print ("adata shape", adata.shape)
for c in ctp.columns[1:]:
threshold = np.median(ctp[c].values)
adata.obs[c + "_spatial_cluster"] = (ctp[c] > threshold).astype(int).values
sq.gr.spatial_neighbors(adata, coord_type = 'generic', delaunay = True) # library_key='sample',
for c in ctp.columns[1:]:
cc.gr.connected_components(adata, cluster_key = c + '_spatial_cluster')
cc.tl.boundaries(adata, min_hole_area_ratio = 0.1)
cc.tl.linearity(adata)
cc.tl.curl(adata)
cc.tl.elongation(adata)
adata.obs.rename(columns = {'component': c +'_component'}, inplace = True)
#print (adata)
mapping = pd.DataFrame({"Act" : adata.obs[c + "_spatial_cluster"].values, "Pred" : adata.obs[c + "_component"].values})
mapping = mapping.drop_duplicates()
#adata.uns[c + '_shape_component'] = adata.uns.pop('shape_component')
t = mapping.drop_duplicates()
t = t[t["Act"] == 1]
t.dropna(inplace = True)
comp_itr = 1
for comp in t["Pred"].values:
linearity = adata.uns["shape_component"]["linearity"][comp]
curl = adata.uns["shape_component"]["curl"][comp]
elongation = adata.uns["shape_component"]["elongation"][comp]
if (flag):
df_val["Category"] = [category]
df_val["Dataset"] = [data_name]
df_val["cell_type"] = [c + "_" + str(comp_itr)]
df_val["linearity"] = [linearity]
df_val["curl"] = [curl]
df_val["elongation"] = [elongation]
#print (df_val)
comp_itr += 1
flag = False
else:
new_row = {"Category" : category, "Dataset" : data_name, "cell_type": c + "_" + str(comp_itr), "linearity" : linearity, "curl" : curl, "elongation" : elongation}
comp_itr += 1
#df_val = df_val.append(new_row, ignore_index = True)
df_val = pd.concat([df_val, pd.DataFrame([new_row])], ignore_index=True)
#print (df_val)
lst = {
"Brain" : ["151508"], # "151673", "151508", "151509", "151669", "151670"
"Cancer": [],
"Development" : []
}
path = "/content/drive/MyDrive/Major_project/Benchmarking_Shared/spDDB_tutorials/"
for l in lst["Brain"]:
data_path = path + "1_data/synthetic_spatial_gene_exp/simulated_spatial_gene_expression.h5ad"
ctp_path = path + "4_data/Simulated_cell_type_proportion_DLPFC_151508.csv"
cellcharter_metrics(l, "Brain", data_path, ctp_path)
ctp shape (4382, 18) and Index(['Unnamed: 0', 'AST_FB', 'AST_PP', 'Endothelial', 'IN_PV', 'IN_SST',
'IN_SV2C', 'IN_VIP', 'L2_3', 'L4', 'L5_6', 'L5_6_CC', 'Microglia',
'Neu_NRGN_I', 'Neu_NRGN_II', 'Neu_mat', 'OPC', 'Oligodendrocytes'],
dtype='object')
adata shape (4382, 11403)
INFO Creating graph using `generic` coordinates and `None` transform and `1` libraries.
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
/tmp/ipykernel_3161/929752537.py:24: FutureWarning: linearity is deprecated and will be removed in the next release. Please use `linearity_metric` instead.
cc.tl.linearity(adata)
/tmp/ipykernel_3161/929752537.py:25: FutureWarning: curl is deprecated and will be removed in the next release. Please use `curl_metric` instead.
cc.tl.curl(adata)
/tmp/ipykernel_3161/929752537.py:26: FutureWarning: elongation is deprecated and will be removed in the next release. Please use `elongation_metric` instead.
cc.tl.elongation(adata)
Specify metrics
metric = "linearity" # "elongation" # "curl"
def consider_all_comps(ct_lst):
new_ct_lst = []
for b in ct_lst:
b_clip = b[:-1]
new_ct_lst += [b]
last_char = b[-1]
new_ct_lst += [b_clip + str(d) for d in range(1, int(last_char))]
return new_ct_lst
def get_top_bottom_25(df_subset, per, m):
df_subset = df_subset[["cell_type", m]]
df_subset = df_subset.groupby('cell_type')[m].median().reset_index()
# Rename the columns for clarity (optional)
df_subset.columns = ['cell_type', m]
sorted_df = df_subset.sort_values(by = m).reset_index(drop = True)
bottom_cts = sorted_df[: round(per*len(sorted_df))][["cell_type", m]]
per_neg = 1 - per
top_cts = sorted_df[round(per_neg*len(sorted_df)) : ][["cell_type", m]]
#print (bottom_cts, top_cts)
new_bottom_cts = consider_all_comps(bottom_cts["cell_type"].values)
new_top_cts = consider_all_comps(top_cts["cell_type"].values)
return new_bottom_cts, new_top_cts
Top and Bottom cell types with chosen shape metrics for Brain datasets
print (df_val)
Category Dataset cell_type linearity curl elongation
0 Brain 151508 AST_FB_1 0.763348 0.110810 0.110016
1 Brain 151508 AST_FB_1 0.763348 0.110810 0.110016
2 Brain 151508 AST_PP_1 1.000000 0.000000 0.345660
3 Brain 151508 AST_PP_2 1.000000 0.101009 0.653668
4 Brain 151508 Endothelial_1 0.941555 0.556208 0.052118
5 Brain 151508 IN_PV_1 0.576744 0.343922 0.000154
6 Brain 151508 IN_SST_1 0.726808 0.000000 0.052081
7 Brain 151508 IN_SV2C_1 0.913603 0.000000 0.345682
8 Brain 151508 IN_VIP_1 1.000000 0.000000 0.331758
9 Brain 151508 L2_3_1 0.798326 0.032302 0.150539
10 Brain 151508 L4_1 1.000000 0.000000 0.414979
11 Brain 151508 L5_6_1 1.000000 0.000000 0.471710
12 Brain 151508 L5_6_CC_1 1.000000 0.000000 0.492478
13 Brain 151508 Microglia_1 0.795943 0.000000 0.396660
14 Brain 151508 Microglia_2 0.927239 0.000000 0.658984
15 Brain 151508 Neu_NRGN_I_1 0.816390 0.326698 0.052081
16 Brain 151508 Neu_NRGN_II_1 1.000000 0.000000 0.462463
17 Brain 151508 Neu_mat_1 0.747737 0.000000 0.144467
18 Brain 151508 OPC_1 1.000000 0.170473 0.365133
19 Brain 151508 OPC_2 0.875739 0.000000 0.655748
20 Brain 151508 Oligodendrocytes_1 1.000000 0.006502 0.427947
### Linearity
df_brain = df_val[df_val["Category"] == "Brain"]
dfs = []
Organs = {
"DLPFC" : ['151508'] # '151674', '151508', '151509', '151669', '151670'
#"Mouse_brain" : ['Mouse_brain_ST48', 'Mouse_brain_ST52']
}
for key in Organs.keys():
data = Organs[key]
#print (data)
df_subset = df_brain[df_brain["Dataset"].isin(data)].reset_index(drop = True)
#print (df_subset.shape)
bottom_cts, top_cts = get_top_bottom_25(df_subset, 0.25, metric)
print ("Bottom", bottom_cts, "\n Top", top_cts, "\n\n\n")
df_bottom = df_subset[df_subset["cell_type"].isin(bottom_cts)].reset_index(drop = True)
df_bottom["type"] = "bottom"
dfs += [df_bottom]
df_top = df_subset[df_subset["cell_type"].isin(top_cts)].reset_index(drop = True)
df_top["type"] = "top"
dfs += [df_top]
df_shape_brain = pd.concat(dfs, axis = 0).reset_index(drop = True)
Bottom ['IN_PV_1', 'IN_SST_1', 'Neu_mat_1', 'AST_FB_1', 'Microglia_1']
Top ['AST_PP_2', 'AST_PP_1', 'Neu_NRGN_II_1', 'L4_1', 'OPC_1', 'Oligodendrocytes_1']
print (df_shape_brain)
Category Dataset cell_type linearity curl elongation \
0 Brain 151508 AST_FB_1 0.763348 0.110810 0.110016
1 Brain 151508 AST_FB_1 0.763348 0.110810 0.110016
2 Brain 151508 IN_PV_1 0.576744 0.343922 0.000154
3 Brain 151508 IN_SST_1 0.726808 0.000000 0.052081
4 Brain 151508 Microglia_1 0.795943 0.000000 0.396660
5 Brain 151508 Neu_mat_1 0.747737 0.000000 0.144467
6 Brain 151508 AST_PP_1 1.000000 0.000000 0.345660
7 Brain 151508 AST_PP_2 1.000000 0.101009 0.653668
8 Brain 151508 L4_1 1.000000 0.000000 0.414979
9 Brain 151508 Neu_NRGN_II_1 1.000000 0.000000 0.462463
10 Brain 151508 OPC_1 1.000000 0.170473 0.365133
11 Brain 151508 Oligodendrocytes_1 1.000000 0.006502 0.427947
type
0 bottom
1 bottom
2 bottom
3 bottom
4 bottom
5 bottom
6 top
7 top
8 top
9 top
10 top
11 top