Skip to main content

Interactive single-cell and spatial omics visualization library

Project description

Cellestial

GitHub PyPI codecov License: Apache 2.0 Powered by Polars Graphics: Lets-Plot

Cellestial Logo

The Grammar of Graphics for single-cell omics.

Cellestial is an interactive and a highly customizable Single-Cell & Spatial omics data visualization library. Built on top Lets-Plot, it offers a ggplot-like layered and modular approach offering high customizability and publication-ready figures.

Cellestial is highly integrated with scverse's AnnData with room for integration with any upcoming single-cell omics data type in the Python single-cell omics ecosystem.

Cellestial leverages the performance of Polars ensuring speed and scalability.

Installation

pip install cellestial
uv add cellestial
poetry add cellestial

Quickstart

Cellestial accepts a standard AnnData directly. The same function plots a categorical column or a gene, and everything composes through + like ggplot.

from lets_plot import *
import cellestial as cl

data = cl.datasets.pbmc3k(cache_directory="data")

cl.umap(
    data,
    key="cell_type_lvl1",
    axis_type="arrow",
    legend_ondata=True,
) + scale_color_hue()

UMAP coloured by cell type

Examples

Spatial omics

Overlay categorical labels or gene expression on tissue coordinates.

Show code
import squidpy as sq

lymph_node = cl.datasets.human_lymph_node(cache_directory="data")
hne = sq.datasets.visium_hne_adata()

gggrid(
    [
        cl.spatial(lymph_node, key="clusters"),
        cl.spatial(hne, key="leiden"),
    ],
    ncol=2,
) + ggsize(1000, 400)

Spatial categorical overlay

Dimensionality reduction with layers

Cellestial ships single-cell-specific layers (cluster_outlines, stream, arrow_axis, ondata_legend) that compose with + like any geom.

Show code
velocity_data = cl.datasets.pancreas(cache_directory="data")

outlined = cl.umap(
    data,
    key="cell_type_lvl1",
    axis_type="arrow",
    size=1.5,
    legend_ondata=True,
) + scale_color_hue() + cl.cluster_outlines(groups=["Lymphocytes", "B Cells"])

streamed = cl.umap(
    velocity_data,
    key="clusters_coarse",
    axis_type="arrow",
    size=4,
    alpha=0.4,
    legend_ondata=True,
    ondata_color="black",
) + cl.stream()

gggrid([outlined, streamed])

UMAP with cluster outlines and velocity stream

Marker genes

Heatmaps, dotplots, matrixplots and stacked violins share the same call shape and ship with built-in dendrograms and group bars.

Show code
markers = [
    "PSAP", "LYZ", "CST3",          # Monocytes
    "CD79A", "CD79B",                # B cells
    "IL7R", "CD3D", "CD3E", "CD4",   # T cells (CD4+)
    "CD8A", "CD8B",                  # T cells (CD8+)
    "NKG7", "GNLY", "KLRD1",         # NK cells
    "HLA-DRA", "FCER1A",             # Dendritic cells
]

cl.heatmap(
    data,
    group_by="cell_type_lvl1",
    keys=markers,
    geom="raster",
    group_lines_size=0.5,
    group_lines_color="white",
    group_bars=True,
    group_bars_labels=True,
    dendrogram=True,
    dendrogram_size=1,
) + scale_fill_viridis()

Marker gene heatmap

Statistical comparisons

cl.bracket runs pairwise tests on a cl.boxplot or cl.violin and draws annotated significance brackets.

Show code
cl.boxplot(
    data,
    key="CD3D",
    fill="cell_type_lvl1",
    threshold=0.1,
) + scale_fill_hue() + cl.bracket(
    y_padding=0.2,
    label="pvalue",
    prefix="p",
    prefix_style="<",
    comparisons=[
        ("Lymphocytes", "Monocytes"),
        ("Monocytes", "Erythroid"),
        ("Monocytes", "B Cells"),
    ],
)

Boxplot with significance brackets

Ridge plots

Quick exploratory views of expression distributions across groups.

Show code
cl.ridge(
    data,
    key="B2M",
    alpha=0.6,
    group_by="cell_type_lvl1",
) + scale_fill_hue()

Ridge plot of B2M expression

Migrating from Scanpy

Cellestial mirrors most of scanpy.pl with a few naming shifts:

  • color= becomes key=.
  • Multi-panel calls use a plural function (cl.umaps, cl.violins, ...).
  • groupby becomes group_by, var_names becomes keys.
  • Saving is a separate cl.save(plot, "umap.png") call.

See the migration guide for a side-by-side mapping.

Documentation

License

Apache 2.0. See LICENSE.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cellestial-0.49.3.tar.gz (97.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cellestial-0.49.3-py3-none-any.whl (142.8 kB view details)

Uploaded Python 3

File details

Details for the file cellestial-0.49.3.tar.gz.

File metadata

  • Download URL: cellestial-0.49.3.tar.gz
  • Upload date:
  • Size: 97.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.5 Darwin/25.4.0

File hashes

Hashes for cellestial-0.49.3.tar.gz
Algorithm Hash digest
SHA256 ed54acf1ea25f477d1d8ab62b05546eb1a1e7f7ad462c75ffd8e3ab8bcd2f725
MD5 ff4ff85c3d55014a5be7b10a034a1274
BLAKE2b-256 3fabbe00e97749c16dcd89f0fb2ef8add0a5fb602ea37ecdc47adea3d0c370a8

See more details on using hashes here.

File details

Details for the file cellestial-0.49.3-py3-none-any.whl.

File metadata

  • Download URL: cellestial-0.49.3-py3-none-any.whl
  • Upload date:
  • Size: 142.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.5 Darwin/25.4.0

File hashes

Hashes for cellestial-0.49.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b0765c115252d35c94277374bab52c126c79220f0e0f78ad95908bbc2b45e06c
MD5 870bda6b5e9885c626a2d8a3d3337915
BLAKE2b-256 7a8f15a36f3a80eed83c13ef962e953e6f2938006f60f8e806851513c1779ff9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page