Skip to main content

HCA Schema Validator

Validates single-cell data files in h5ad format (the AnnData file format) against the Human Cell Atlas (HCA) Tier 1 metadata schema.

Installation

Requires Python 3.10 or later.

pip install hca-schema-validator

What it checks

  • Inherited CELLxGENE checks. Checks inherited from the CELLxGENE validator (cellxgene-schema 7.0.0) on the h5ad file's structure, obs and uns metadata, ontology terms, gene IDs, matrices and embeddings (Core CELLxGENE checks).
  • HCA Tier 1 schema. Required fields are present, strongly recommended fields are flagged when missing, and values have the right form. HCA replaces some CELLxGENE rules with its own (HCA overrides).
  • Expression matrices. X is a normalized, log-transformed version of the counts it was made from: layers['desouped_counts'] when ambient RNA was removed, otherwise raw.X (Expression matrices).
  • Cell metadata labels. Any label a team fills in, such as tissue, matches the ontology name of its term ID (Cell metadata labels).
  • Donors. One donor_id names one person, with one organism, sex and manner of death (Donor metadata).
  • Declared gene annotation version. gene_annotation_version fits the genes in var and reference_genome (Declared gene annotation).
  • Gene ID report. Human gene IDs missing from the allowed gene set (GENCODE v48, Ensembl 114, primary assembly only) are listed in one gene ID report, with a tag saying what to do about each (Gene IDs outside the allowed gene set).

The validator reports two kinds of finding:

  • Errors: the h5ad file does not meet the schema.
  • Warnings: something to review or fix. A missing strongly recommended field is a warning, not an error.

Usage

The validator runs from Python. It validates two kinds of h5ad file, and the two kinds have different validation requirements:

  • Source dataset (object_kind="source"): holds data from a single study.
  • Integrated object (object_kind="integrated"): holds data from several source datasets integrated into an atlas.
# Validate a source dataset.
from hca_schema_validator import HCAValidator

# object_kind is required: "source" or "integrated". Leaving it out raises a
# TypeError.
validator = HCAValidator(object_kind="source")

# Validate an h5ad file. The result is False when there are errors.
is_valid = validator.validate_adata("path/to/file.h5ad")

print("✅ No errors" if is_valid else "❌ Errors:")
for error in validator.errors:
    print(f"  - {error}")

# An h5ad file with no errors can still have warnings to review or fix,
# including the gene ID report.
for warning in validator.warnings:
    print(f"  ! {warning}")

Pass the object_kind that matches the h5ad file.

Validate a source dataset:

validator = HCAValidator(object_kind="source")
is_valid = validator.validate_adata("path/to/file.h5ad")

Validate an integrated object:

validator = HCAValidator(object_kind="integrated")
is_valid = validator.validate_adata("path/to/atlas.h5ad")

Developing

Instructions for working on this package are in DEVELOPMENT.md.

Acknowledgements

  • The CELLxGENE team at the Chan Zuckerberg Initiative (CZI). This package is built on their schema validator, cellxgene-schema, from chanzuckerberg/single-cell-curation. A copy of cellxgene-schema is included here under the MIT License and extended for HCA. Every CELLxGENE check in this validator, and the allowed gene set, comes from the CELLxGENE team's work. See NOTICE.
  • cellxgene-ontology-guide, also by the CZI CELLxGENE team, which supplies the ontology data the validator checks terms against, and the build pipeline the ontology overlay uses.
  • GENCODE, the human gene annotation behind the allowed gene set.
  • Ensembl at EMBL-EBI, whose public database the two gene tables in this package are built from.

License

MIT

Metadata

Release files for hca-schema-validator 0.16.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 hca-schema-validator 0.16.0
File Size Uploaded Provenance Actions
hca_schema_validator-0.16.0.tar.gz 6.8 MB With provenance Details for hca_schema_validator-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hca-schema-validator 0.16.0
File Interpreter ABI Platform Actions
hca_schema_validator-0.16.0-py3-none-any.whl Python 3 none any Details for hca_schema_validator-0.16.0-py3-none-any.whl

Total release size: 13.4 MB

Release files / hca_schema_validator-0.16.0.tar.gz

Download URL hca_schema_validator-0.16.0.tar.gz
Size 6.8 MB
Tags Source
SHA-256 checksum
How to use checksums
5c28665ef5a38d5ba09c644dd00f243402480883d6b170df16d4372dc0d054a6
BLAKE2b-256 checksum
How to use checksums
3249fbbb09a4e0d91e9cad323912bc1a44657346de9c987ff25b9b4d8eee3dd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / hca_schema_validator-0.16.0-py3-none-any.whl

Download URL hca_schema_validator-0.16.0-py3-none-any.whl
Size 6.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ca785db7ce256b486c9b8a3b1ed9eb856fc44ac7d33a8e6f66cb6a399da8ac90
BLAKE2b-256 checksum
How to use checksums
a32d8b2868b641ac28d70a7cdcb17d8e015f111cb434b6aa6583c9053a002a43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for hca-schema-validator 0.16.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hca_schema_validator-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

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