Skip to main content

Single-cell Commitment Scores with radial star embedding for k-furcation fate decisions

Project description

scCS — Single-Cell Commitment Scores

PyPI PyPI Downloads Documentation Status License: MIT CI

scCS quantifies RNA velocity-based commitment scores for single-cell data, generalizing the 2-state (homeostatic/activated) framework from Kriukov et al. (2025) to arbitrary k-furcations — branching points where a progenitor population splits into k ≥ 2 terminal fates.


What it does

Classical RNA velocity tools (scVelo, CellRank) describe where cells are going. scCS answers a complementary question: how strongly committed is each cell to a given fate, relative to the alternatives?

Given RNA velocity vectors projected into a radial star embedding, scCS computes:

  • unCS / nCS — unnormalized and cell-count-corrected pairwise commitment scores
  • Per-cell fate affinities — cosine similarity of each cell's velocity to each fate direction
  • Population entropy — how evenly velocity mass is distributed across fates
  • Per-fate cell entropy — how individually decisive cells are toward each fate specifically
  • NN-smoothed entropy — spatially local commitment uncertainty, noise-robust

Installation

pip install scCS-py

Or from source:

pip install git+https://github.com/mcrewcow/scCS.git

Quickstart

import scCS

scorer = scCS.CommitmentScorer(
    adata,
    bifurcation_cluster="17",           # leiden cluster at the branching point
    terminal_cell_types=["homeostatic", "activated"],
    cluster_key="leiden",
)
scorer.build_embedding(differentiation_metric="pseudotime")
scorer.fit()
result = scorer.score(compute_cell_level=True)

print(result.summary())
scorer.plot_star(result)
scorer.plot_commitment_bar(result)

Key features

Feature Description
k-furcation support Works for any number of fate branches (k ≥ 2)
Radial star embedding Progenitor at origin, each fate on its own arm, cells ordered by pseudotime / CytoTRACE2
unCS / nCS Pairwise commitment scores, unnormalized and cell-count-corrected
Per-fate entropy Binary cell entropy per fate — how decisive cells are toward each fate individually
NN-smoothed entropy Nearest-neighbor smoothed per-cell entropy in the scCS embedding; elbow plots to choose k
Driver genes Velocity-based and DEG-based driver genes per fate arm
Pathway enrichment Enrichr ORA (KEGG, GO BP, Reactome) per fate, up and down
Color map support Pass your original scanpy/Seurat cluster colors to all plots

Entropy metrics

scCS provides three complementary entropy metrics:

# 1. Population entropy — single scalar, aggregate velocity-mass balance
result.population_entropy

# 2. Per-fate cell entropy — shape (k,), one value per fate
#    Binary entropy of each cell's affinity toward fate j, averaged over cells
result.per_fate_entropy   # e.g. array([0.31, 0.28]) for k=2

# 3. NN-smoothed per-cell entropy — shape (n_cells,)
#    Average cell_scores over k nearest neighbors in X_sccs, then compute entropy
result = scorer.score(compute_cell_level=True, k_nn=15)
result.nn_cell_entropy    # also stored in adata_sub.obs["cs_nn_entropy"]

# Find the optimal k_nn with elbow plots
fig = scorer.plot_nn_entropy_elbow(k_nn_range=range(5, 51, 5))

Full workflow

import scCS

# 1. Initialize
scorer = scCS.CommitmentScorer(
    adata,
    bifurcation_cluster="17",
    terminal_cell_types=["homeostatic", "activated"],
    cluster_key="leiden",
)

# 2. Build radial star embedding
scorer.build_embedding(differentiation_metric="pseudotime")

# 3. Fit (builds FateMap, projects velocity)
scorer.fit()

# 4. Score
result = scorer.score(compute_cell_level=True, k_nn=15)
print(result.summary())

# 5. Plots
scorer.plot_star(result)
scorer.plot_commitment_bar(result)
scorer.plot_rose(result)
scorer.plot_pairwise_cs(result)
scorer.plot_nn_entropy_elbow(k_nn_range=range(5, 51, 5))

# 6. Driver genes
vel_drivers = scorer.get_velocity_drivers(n_top=50)
deg_drivers = scorer.get_deg_drivers(n_top=50)

# 7. Pathway enrichment
enrichment = scorer.get_enrichment(deg_drivers, organism="mouse")

# 8. Compare across conditions
subset_results = scorer.score_per_subset("condition")
scorer.plot_subset_comparison(subset_results)

Manuscript values

Reproducing the k=2 microglia bifurcation from Kriukov et al. (2025) (GEO: GSE285564):

scorer = scCS.CommitmentScorer(
    adata,
    bifurcation_cluster="17",
    terminal_cell_types=["homeostatic", "activated"],
    cluster_key="leiden",
)
scorer.build_embedding(differentiation_metric="pseudotime")
scorer.fit()
result = scorer.score()

result.pairwise_unCS[0, 1]  # → 9.335
result.pairwise_nCS[0, 1]   # → 8.066

Citation

If you use scCS in your research, please cite:

Kriukov et al. (2025) Single-cell transcriptome of myeloid cells in response to transplantation of human retinal neurons reveals reversibility of microglial activation. DOI: 10.XXXX

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

sccs_py-0.5.0.tar.gz (67.9 kB view details)

Uploaded Source

Built Distribution

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

sccs_py-0.5.0-py3-none-any.whl (62.2 kB view details)

Uploaded Python 3

File details

Details for the file sccs_py-0.5.0.tar.gz.

File metadata

  • Download URL: sccs_py-0.5.0.tar.gz
  • Upload date:
  • Size: 67.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for sccs_py-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2ca361d128f8919af0c4336877b76db64d75e1363719adb7a335a407b7643056
MD5 52165f0b4ad9875a07c2f5480be565e7
BLAKE2b-256 40acb120d472d197e0bce3016549a2b906f79194ffc9b6290a4c367840cebf00

See more details on using hashes here.

File details

Details for the file sccs_py-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: sccs_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 62.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for sccs_py-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ddd50308ace43d40a3977871c11ceeb9dbb6802daa0568a7b73d1264852cf95
MD5 649ae87b73df013696f34f4e884fca6d
BLAKE2b-256 78449f6e8a54cf530b0311222e7c0119660e540ba85fd05843de4ca3cd3941b2

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