Skip to main content

kDomainBench

Benchmark of methods that estimate the number of spatial domains (k) in spatial transcriptomics, behind one interface.

Documentation and tutorials: https://pyanglab.github.io/domainNumber/

Many spatial clustering methods choose the number of domains themselves, but each needs its own software, input format and settings, which makes them hard to run and to compare. kDomainBench runs ten such methods from one Python call or one command, each in the environment it needs, and compares the k each one estimates with the number of domains in a manual reference annotation. It is for researchers who want to estimate k for their own 10x Visium samples, or to compare k-estimation methods. It does not add a method of its own.

import kdomainbench as kdb
clusters = kdb.run("SpaGCN", "data/D3_151509_5k.h5ad")
kdb.evaluate(clusters, "data/D3_151509_5k.h5ad")       # k error, ARI and NMI against the annotation
  • 10 methods: PRECAST, SC.MEB, BayesSpace, BNPSpace, DR.SC and iSC.MEB in R, and CellCharter, DeepST, SpaGCN and SpatialDE2 in Python. CellCharter, DeepST and SpatialDE2 can use a GPU.
  • 2 version-locked conda environments for the Python methods, the same on CPU-only and GPU machines. The R methods use your own R.
  • Results: kdb.load_results, kdb.evaluate, kdb.k_accuracy. Plots: kdb.pl.
  • kdb.metrics: the twelve metrics of the paper, computed by the paper's own R and Python code (R ≥ 4.5 with Bioconductor ≥ 3.22).
  • The kdomainbench command does the same from the shell.

Installation

The methods run on Linux (x86-64) and need conda or mamba, R ≥ 4.4, a C++ compiler, cmake and git:

git clone https://github.com/PYangLab/domainNumber.git && cd domainNumber
bash envs/install_envs.sh                 # the two Python environments, with kdomainbench in kdb_py
conda activate kdb_py
kdomainbench install r                    # the R packages, into your R
kdomainbench check                        # checks that every environment starts

To score and plot finished runs on macOS or Windows, pip install -e . in the cloned folder, with Python 3.10 or later, is enough. Installation has the details.

Layout

src/kdomainbench/                 package (run, results, plotting, CLI)
src/kdomainbench/methods/         one script per method (device is a flag, no CPU/GPU copies)
src/kdomainbench/metric_scripts/  the paper's metric code (metrics.R, scs.py), unchanged
src/kdomainbench/envs/            the two environment files and the R package installer
envs/                             install_envs.sh and the scripts that export the environment files
docs/, mkdocs.yml, snippets/      documentation site (mkdocs-material)
scripts/                          make_results_page.py, make_logo.py, check_docs.py
tests/                            unit tests and their small test files

Metadata

Release files for kdomainbench 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kdomainbench 0.1.0
File Size Uploaded Provenance Actions
kdomainbench-0.1.0.tar.gz 74.8 kB Without provenance Details for kdomainbench-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kdomainbench 0.1.0
File Interpreter ABI Platform Actions
kdomainbench-0.1.0-py3-none-any.whl Python 3 none any Details for kdomainbench-0.1.0-py3-none-any.whl

Total release size: 160.5 kB

Release files / kdomainbench-0.1.0.tar.gz

Download URL kdomainbench-0.1.0.tar.gz
Size 74.8 kB
Tags Source
SHA-256 checksum
How to use checksums
23426138bf44172de78d3a4e220c0063084f5f01ac302e933033a8597662a4e1
BLAKE2b-256 checksum
How to use checksums
1b269c453fa69230274f5aa7a4d87ba2c1923c62b987d11bd4b7233ae13f35a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / kdomainbench-0.1.0-py3-none-any.whl

Download URL kdomainbench-0.1.0-py3-none-any.whl
Size 85.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4f7b1e6a5a7a8ce7cff9bce117b63edfd0db1fe3280f42cee685ee7ba5fab4b
BLAKE2b-256 checksum
How to use checksums
1095c7973d994266a0b3bfa2155d93d8762cbff678c5540ed2bcd9371dde8331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for kdomainbench 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page