Skip to main content

Spatial isoform statistical modeling (SPLISOSM)

Project description

SPLISOSM — Spatial Isoform Statistical Modeling

PyPI version License: BSD-3-Clause Docs PyPI Downloads

SPLISOSM (SPatiaL ISOform Statistical Modeling, pronounced spliceosome) is a Python package for analyzing RNA-processing patterns in spatial transcriptomics (ST) data. It uses multivariate, kernel-based association tests to detect:

  1. Spatial variability (SV) of isoform usage, isoform expression, or gene expression across spatial locations; and
  2. Differential isoform usage (DU) against spatial covariates such as region annotations or RNA-binding-protein (RBP) expression, optionally conditioned on spatial autocorrelation.

overview

Built on the Hilbert–Schmidt Independence Criterion (HSIC), the tests are multivariate — each gene is summarized by a single p-value aggregated across all of its isoforms — and well-calibrated without permutation sampling.

Supported platforms & feature types

SPLISOSM is platform-agnostic. Confirmed-compatible data types include:

Data type Example platforms Feature
Long-read ST 10x Visium / Visium HD + ONT Full-length transcript isoform
Short-read 3′ ST 10x Visium / Visium HD (fresh-frozen), Slide-seqV2 TREND peak (alt. polyadenylation)
Short-read targeted ST 10x Visium (CytAssist) / Visium HD FFPE, Flex Exon/junction probe usage
In situ targeted ST 10x Xenium Prime 5K Codeword (exon/junction probe)

SPLISOSM does not perform isoform quantification itself. See the Feature Quantification guide for per-platform preprocessing recipes and loaders in splisosm.io.

Choosing a model class

SPLISOSM exposes three entry-point classes with a shared setup_data → test_* → get_formatted_test_results lifecycle:

Class Best for Input SV DU
SplisosmNP Any geometry (irregular spots, single cells, segmented) AnnData
SplisosmFFT Regular grids (Visium HD, Xenium binned) — fastest SpatialData
SplisosmGLMM Parametric effect sizes via multinomial GLM/GLMM AnnData ⚠️ *

*SplisosmGLMM is calibrated for DU testing only; its SV test is conservative.

Decision tree:

Is your data on a REGULAR GRID (Visium HD, Xenium binned, etc.)?
├── YES →  SplisosmFFT  (fastest; requires SpatialData input)
└── NO  →  Interested in parametric effect sizes?
          ├── YES →  SplisosmGLMM  (GLM/GLMM; DU only)
          └── NO  →  SplisosmNP    (recommended default)

Installation

# stable release from PyPI
pip install splisosm

# or latest from GitHub
pip install git+https://github.com/JiayuSuPKU/SPLISOSM.git#egg=splisosm

Optional extras:

# SpatialData input support for SplisosmFFT, + gpytorch GP backend for DU
pip install "splisosm[sdata,gp]"

Quick start

from splisosm import SplisosmNP

model = SplisosmNP()
model.setup_data(
    adata,                         # AnnData of shape (n_spots, n_isoforms)
    spatial_key="spatial",         # adata.obsm key for coordinates
    layer="counts",                # raw isoform counts
    group_iso_by="gene_symbol",    # adata.var column grouping isoforms → gene
)

# Spatial variability of isoform usage (SVP genes)
model.test_spatial_variability(method="hsic-ir")
df_sv = model.get_formatted_test_results("sv", with_gene_summary=True)

# Differential usage vs. a covariate matrix (e.g. RBP expression), conditioned on space
model.setup_data(
    adata, spatial_key="spatial", layer="counts", group_iso_by="gene_symbol",
    design_mtx=covariates, covariate_names=cov_names,
    skip_spatial_kernel=True,      # DU-only: no CAR kernel needed
)
model.test_differential_usage(method="hsic-gp")
df_du = model.get_formatted_test_results("du")

SPLISOSM works with non-spatial / single-cell data too: pass adj_key pointing to an adata.obsp[...] neighborhood graph (e.g. "connectivities" from scanpy.pp.neighbors) in place of spatial_key.

For gene-level spatial variability as a drop-in for SPARK-X or Moran's I:

from splisosm.utils import run_hsic_gc
res = run_hsic_gc(gene_counts, coordinates)     # or run_hsic_gc(adata=adata, spatial_key="spatial")

See the Quick Start for the full-defaults reference and Statistical Methods for the underlying HSIC framework, CAR kernel, low-rank and null-distribution approximations, and the GLMM parametric alternative.

Documentation & tutorials

Change log

See the changelog for detailed release notes.

Reporting issues

Please file bugs and feature requests on the GitHub Issues page.

References

SplisosmNP and SplisosmGLMM are described in

Su, Jiayu, et al. “Mapping isoforms and regulatory mechanisms from spatial transcriptomics data with SPLISOSM.” Nature Biotechnology (2026): 1–12.

link to paper

The FFT-based acceleration of SplisosmFFT is described in

Su, Jiayu, et al. "On the consistent and scalable detection of spatial patterns." arXiv preprint arXiv:2602.02825 (2026).

link to preprint

Project details


Download files

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

Source Distribution

splisosm-1.1.1.tar.gz (212.2 kB view details)

Uploaded Source

Built Distribution

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

splisosm-1.1.1-py3-none-any.whl (152.1 kB view details)

Uploaded Python 3

File details

Details for the file splisosm-1.1.1.tar.gz.

File metadata

  • Download URL: splisosm-1.1.1.tar.gz
  • Upload date:
  • Size: 212.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for splisosm-1.1.1.tar.gz
Algorithm Hash digest
SHA256 7419de92effb0a2c777b3a05131c3dd0afee6a0412fb9114eb07f7ed104db12a
MD5 d034e9d8f460f49df862851d0fde22ae
BLAKE2b-256 64cbf1eaf2b3299bfc346a28c6e8bcb925433c31d36c2b9c98b7d2a82f39025c

See more details on using hashes here.

File details

Details for the file splisosm-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: splisosm-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 152.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for splisosm-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73730dc3eb9c7576a0806d2a7747ea0c748fc094c0daefe69174d6cea96b851e
MD5 9c040651f2dafa682eef3234a0f47705
BLAKE2b-256 5877d201bfbf8cc35a71e203e8012e20c60c506e91f891c06355faec10a4e4ea

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