Skip to main content

gotmap-benchmark

Benchmark pipeline for gotmap — compare query-to-reference atlas mapping methods on real and synthetic single-cell data and get quantitative results + plots out of the box.

Positioning: this benchmark evaluates query → reference mapping quality, not symmetric batch mixing. It is designed for the gotmap use case (map a query onto a fixed atlas), not to compete with integration-tool comparisons.


Install

pip install gotmap grassmann-ot scanpy
# optional, for more baselines:
pip install scvi-tools harmonypy bbknn

Quick start (Python)

import scanpy as sc
from gotmap_benchmark import BenchmarkPipeline

adata = sc.datasets.pbmc68k_reduced()
if "X_pca" not in adata.obsm:
    sc.pp.normalize_total(adata); sc.pp.log1p(adata); sc.pp.pca(adata, n_comps=30)

label_key = "bulk_labels" if "bulk_labels" in adata.obs.columns else "louvain"
if label_key not in adata.obs.columns:
    sc.tl.louvain(adata, resolution=0.8, key_added="louvain"); label_key = "louvain"

ref, query = sc.pp.train_test_split(adata, test_size=0.3, random_state=42,
                                    stratify=label_key)

bench = BenchmarkPipeline(ref, query, label_key=label_key, use_rep="X_pca",
                          methods=["gotmap_nn", "gotmap_knn", "direct_knn"])
bench.run()
bench.save_results("benchmark_metrics.csv")
bench.plot(save="benchmark_plot.png")

Quick start (CLI)

gotmap-benchmark --ref ref.h5ad --query query.h5ad --label cell_type \
    --use-rep X_pca --methods gotmap_nn direct_knn \
    --output ./results

Included methods

Key Method Notes
gotmap_nn gotmap, neural-network mapping uses anchors + gamma
gotmap_knn gotmap, kNN mapping non-parametric
scArches scVI + scArches needs scvi-tools
harmony_project Harmony project needs R harmony + rpy2
BBKNN_align BBKNN symmetric, then extracts query
direct_knn kNN (no correction) baseline

Metrics reported

  • Label Transfer Accuracy / Weighted F1 — ground-truth label recovery
  • kNN Preservation (kNP) — overlap of reference-neighbourhoods before/after mapping
  • Cell-type Silhouette — separation of types in mapped space
  • Mean Confidence / Mapping Rate — placement certainty
  • Runtime (s)

Output

  • benchmark_metrics.csv — one row per method
  • benchmark_plot.png — horizontal bar chart per metric
  • bench.results_ — full per-method outputs (mapped AnnData, labels, confidence)

Project layout

gotmap-benchmark/
├── pyproject.toml
├── README.md
├── gotmap_benchmark/
│   ├── __init__.py
│   ├── cli.py            # command-line entry point
│   ├── pipeline.py       # BenchmarkPipeline + plotting
│   ├── methods.py        # method wrappers
│   ├── metrics.py        # evaluation metrics
│   └── datasets.py       # dataset loaders + ref/query splitting
└── examples/
    └── run_pbmc_benchmark.py

License: MIT

Metadata

Release files for gotmap-benchmark 0.2.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 gotmap-benchmark 0.2.0
File Size Uploaded Provenance Actions
gotmap_benchmark-0.2.0.tar.gz 12.7 kB Without provenance Details for gotmap_benchmark-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gotmap-benchmark 0.2.0
File Interpreter ABI Platform Actions
gotmap_benchmark-0.2.0-py3-none-any.whl Python 3 none any Details for gotmap_benchmark-0.2.0-py3-none-any.whl

Total release size: 26.3 kB

Release files / gotmap_benchmark-0.2.0.tar.gz

Download URL gotmap_benchmark-0.2.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3201322320b1ae3d758860842865db4f8d2f72309e61717751afa23a0d1a4e2a
BLAKE2b-256 checksum
How to use checksums
617de267f65f9a8d306080f90dfd847f8efa565c85f4b21135af209b86e5a49a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Release files / gotmap_benchmark-0.2.0-py3-none-any.whl

Download URL gotmap_benchmark-0.2.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cdb4726856057142cd8b201d773cf5f45ffa7e4b37792f9bc99ab8a2964408d
BLAKE2b-256 checksum
How to use checksums
131fe9cf57b915e15d21f71cd5b9d16ad385053eded1eb93e5aee2a1891c28bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Security for gotmap-benchmark 0.2.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.

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