← Back

CellCounter — Visium Cell Counting for Spatial scDRS

Tags: Computer Vision · Spatial Transcriptomics · Python · StarDist · OpenCV · AnnData · BayesSpace · scDRS

CellCounter is a Python package that estimates the number of cells per spot in 10x Visium spatial transcriptomics data using the paired histology image. It runs a nuclei instance-segmentation pipeline built on StarDist and OpenCV, with additional preprocessing and analysis utilities.

Background

10x Visium is a spatial transcriptomics technique that measures gene expression across a tissue section while preserving spatial location. Expression is measured on a grid of spots overlaid on the tissue, allowing analysis of what genes are expressed where.

Each Visium spot typically captures RNA from multiple cells, so the data is observed at the spot level rather than at true single-cell resolution.

scDRS

scDRS (single-cell Disease Relevance Score) is a method developed for single-cell RNA-seq data. Given a trait- or disease-associated gene set (often derived from GWAS), scDRS assigns a score to each cell indicating how strongly that cell’s expression is associated with the trait.

This makes it possible to identify which cells or cell states are most associated with a given disease or phenotype.

Extending scDRS to spatial transcriptomics

Extending scDRS to Visium data allows trait association to be studied in spatial context. Instead of only identifying which cells are associated with a disease, spatial data makes it possible to see where those cells are located within the tissue.

This enables analyses such as identifying spatial neighborhoods enriched for disease-associated cells, detecting spatial gradients, and understanding how trait-associated cells are organized relative to tissue structure.

Approach

  1. Use histology images to estimate the number of cells per Visium spot (this package).
  2. Use BayesSpace to subdivide each spot into that many subspots and infer subspot-level expression. BayesSpace is a Bayesian method commonly used in Visium analysis for spatial clustering and resolution enhancement.
  3. Treat each subspot as an approximate single-cell unit and apply scDRS-style scoring to associate traits or diseases with spatially localized cells.

What CellCounter does

Applications

Repository Structure

Links