Skip to main content

zmap-tools

Documentation PyPI version Python 3.10+

Python API for the Zebrafish Multi-Atlas Project (ZMAP) — a curated single-cell RNA-seq reference atlas for zebrafish development.

zmap-tools provides a simple load → annotate → visualize workflow for transferring cell-type labels from the ZMAP reference to your own datasets.

Installation

pip install zmap-tools

Or from GitHub:

pip install git+https://github.com/WagnerLabUCSF/zmap-tools.git

Quick start

1. Load the reference

import zmap

# Download and cache the ZMAP reference (persists on Google Drive in Colab)
adata_ref = zmap.ref.load_zmap_h5ad()

Available presets: "processed_slim_tpm" (default, best for plotting), "symphony" (required for label transfer), "processed", "processed_slim", "raw".

2. Annotate a query dataset

zmap.predict.annotate_with_zmap(
    adata_query,
    query_raw_counts_source="counts",   # where your raw counts live
    cluster_col="leiden",               # your cluster column
)

This runs the full pipeline — TPM normalization, Symphony embedding, kNN label transfer, QC filtering, and plotting — in one call. Results land in adata_query.obs:

Column Description
ZMAP_CellType_predicted Transferred cell-type label
ZMAP_CellType_predicted_prob kNN vote probability (0–1)
ZMAP_time_id Predicted developmental time (hpf)

3. Visualize

# Two-panel dotplot: gene expression across cell types × timepoints and studies
zmap.dotplot.gene_view(adata_ref, "sox2")

# Sibling comparison: a focal cell type vs. its relatives and tissues
zmap.dotplot.group_view(adata_ref, "hepatocyte")

4. Access consensus markers

# Top markers per cell type as a dict
markers = zmap.ref.load_consensus_markers()

# As a panel DataFrame for dotplot input
panel = zmap.ref.load_consensus_markers(level="Tissue", n_per_group=10, format="panel")

Available levels: "GermLayer", "Tissue", "CellType", "CellTypeFine", "Cluster", "Leiden100".

API overview

Module Purpose Key functions
zmap.ref Reference data load_zmap_h5ad(), load_consensus_markers()
zmap.predict Label transfer annotate_with_zmap(), predict_labels_kNN(), predict_label_tissue_kNN(), aggregate_by_cluster()
zmap.dotplot Visualization gene_view(), group_view(), group_descendants_vs_markers()

Workflow details

Label transfer pipeline

annotate_with_zmap chains these steps (each also callable individually):

  1. Preprocesspreprocess_adata_query(): TPM normalization + log1p
  2. Embed — Symphony mapping into the ZMAP PCA/Harmony space
  3. Transferpredict_labels_kNN(): distance-weighted kNN voting with per-cell confidence scores
  4. Filter — probability and distance thresholds flag low-confidence assignments
  5. Summarizeaggregate_by_cluster(): cluster-level consensus calls with margin statistics
  6. Plot — UMAP overlay with on-data labels + label-overlap heatmaps

Dotplot modules

Gene-centric (gene_view): visualize one gene across all cell types, split by developmental timepoint (left panel) and study (right panel). Assesses both temporal dynamics and cross-study reproducibility.

Group-centric (group_view): given a focal cell type, fetches its consensus markers and plots a two-block dotplot — siblings sharing the same parent in the ZMAP hierarchy (top) and all tissues (bottom). Rows sorted by mean expression; support rings encode cross-study reproducibility.

Descendant drilldown (group_descendants_vs_markers): zoom into a parent group (e.g. a tissue) and show all child clusters with their own marker genes, optionally ordered by dendrogram.

Data access

Reference H5ADs and consensus marker tables are hosted on Cloudflare R2 and downloaded on first use. Files are cached to Google Drive when mounted (/content/drive/MyDrive/zmap/h5ad), so they persist across Colab sessions. On local machines, caching falls back to <cwd>/zmap/h5ad and ~/.cache/zmap_tools.

Dependencies

Core: anndata, scanpy, numpy, pandas, matplotlib, scipy, scikit-learn, seaborn, tqdm, adjustText, symphonypy

Requires Python ≥ 3.10.

Documentation

Full API reference: zmap-tools.readthedocs.io

Citation

If you use zmap-tools in your work, please cite the ZMAP project (citation forthcoming).

License

See LICENSE.

Download files

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

Source Distribution

zmap_tools-0.2.2.2.tar.gz (100.3 kB view details)

Uploaded Source

Built Distribution

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

zmap_tools-0.2.2.2-py3-none-any.whl (102.1 kB view details)

Uploaded Python 3

File details

Details for the file zmap_tools-0.2.2.2.tar.gz.

File metadata

  • Download URL: zmap_tools-0.2.2.2.tar.gz
  • Upload date:
  • Size: 100.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zmap_tools-0.2.2.2.tar.gz
Algorithm Hash digest
SHA256 1f12cf64dc6c5b54d4fd43de44e458ed532d037e52d7ccdfcfbb3258856807f5
MD5 3fd86832e680e1c2e3b5958525a79da4
BLAKE2b-256 6f5ec4dfd3a5fc7302e6cfc49e7f51f97180dba2fb75a8d5776f64f99b5f2e05

See more details on using hashes here.

Provenance

The following attestation bundles were made for zmap_tools-0.2.2.2.tar.gz:

Publisher: pip-publish.yml on WagnerLabUCSF/zmap-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zmap_tools-0.2.2.2-py3-none-any.whl.

File metadata

  • Download URL: zmap_tools-0.2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 102.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zmap_tools-0.2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 572ff43be9dc473a35a7ed708cd789b9a6c4aaa8c033e3a89e5f0c54775b4b93
MD5 f71ec68bfa9e856fdb4171b776da6c49
BLAKE2b-256 ec450b8ccd702e02cd0ab1504c9e8bbed24319e7a4af54ee5f76c31d8dc61e02

See more details on using hashes here.

Provenance

The following attestation bundles were made for zmap_tools-0.2.2.2-py3-none-any.whl:

Publisher: pip-publish.yml on WagnerLabUCSF/zmap-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.2.2 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

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