Skip to main content

ogquery

The light, read-only query package for OpenGWAS GWAS Stores. It is the Store Reader: the one read path that the OpenGWASDB builder and validator, the Data API (ogdb-api), opengwaspy and opengwasr all use.

  • Dependencies: numpy, zarr and numcodecs only. No pysam, no SQLite, no scipy or pandas, nothing to compile. It runs on Linux, macOS and Windows, on Python 3.12 to 3.14.
  • Reads Store Releases of format 0.3.0 on its own, and 0.2.x ones when given a reader for their Store Variant Table (below).
  • Contract: the Store Reader contract bundle (tests/contract/): nine small releases and what the Store Reader must answer on each, which any reader, including a future Rust core shipped inside the same wheels, must reproduce.

Most users never install ogquery by name. They install opengwaspy, whose Local Source reads through it, or opengwasr, which reaches it through opengwaspy.

Install

pip install ogquery

It installs numpy, zarr, numcodecs and their own dependencies, all as wheels.

Open a release

from ogquery.facade import query_release
from ogquery.release import open_release

release = open_release("tests/contract/releases/dense_ranges")
print(release.manifest.format_version, release.manifest.primary_layout)  # 0.3.0 dense

with query_release(release) as q:
    analyses = q.analyses_table()                      # {analysis_index: row}
    phewas = q.phewas("1:1000:A:G")                    # every Analysis, by ALID or rsID
    hits = q.top_hits(threshold=5e-8)                  # in genomic order
    in_range = q.variants_in_range("1", 1, 10_000)     # {variant_index: row}

An association answer is a mapping of numpy arrays (z, se, beta, pval, eaf, association_status, variant_index, analysis_index); lookup, analysis and range_phewas are the other shapes (ogquery.facade).

A 0.2.x or 0.1.0 release answers its variants from variants.tsv.gz, a BGZF/tabix file that needs pysam. ogquery refuses to query one alone, with an error (ogquery.release.VariantTableReaderRequired) naming the release's format_version and how to make it a 0.3.0 release: a 0.2.3 release is rewritten with ogdb rewrite-release (opengwasdb); an earlier one must be rebuilt from source, since the rewrite accepts 0.2.3 alone. opengwasdb passes a reader for the table, open_release(path, legacy=...), and reads both.

Develop

pixi run -e test test              # the whole suite
pixi run -e test contract          # the contract bundle alone
pixi run -e dev lint               # ruff; `typecheck` is mypy --strict
pixi run -e dev contract-check     # tests/contract is opengwasdb's bundle

Or, without pixi: pip install -e ".[test]" and pytest.

CONTRIBUTING.md is how to contribute, AGENTS.md how work moves, CONTEXT.md the vocabulary, and docs/adr/ the decisions.

Releases

Every pull request merged into main is a version: release.yml tags it from its changelog fragments, and publish.yml publishes it to PyPI by trusted publishing (ADR 0001; opengwasdb ADR 0083).

Merge with "Create a merge commit", never squash or rebase. A squash loses the history this package carries. A rebase puts each of the branch's commits on main, about 65 for the first merge, which is more than one release run publishes (MAX_PLANNED_RELEASES), so nothing is tagged. Only a merge commit keeps the history and makes the merge one version.

The first release. The first merge skips the repository's first commit (a8822a8, never released) and becomes v0.1.0, with a tag and a GitHub Release. It then dispatches publish.yml with index=pypi, which publishes straight to PyPI with no TestPyPI rehearsal (the owner's ruling). If the trusted publisher is not registered yet, the upload fails at OIDC before anything reaches PyPI, and the daily run (06:17 UTC) retries with the same archives. The GitHub environments pypi and testpypi, limited to main, are the owner's to create; pypi must exist before the upload.

Where it came from

ogquery is opengwasdb's Store Reader, opengwasdb.store_reader, moved into its own package by ogquery#1 (ADR 0001). It came with its history, extracted from opengwasdb 69c29452 with git filter-repo:

Here In opengwasdb
ogquery/ opengwasdb/store_reader/
ogquery/digests.py opengwasdb/store/query_digests.py
tests/contract/ tests/store_reader_contract/ (less generate.py)
tests/unit/ nine of tests/test_*.py, the Store Reader's own

The history starts at opengwasdb#464, where these files entered store_reader/. Their earlier history -- when the same code lived across opengwasdb/query/, opengwasdb/store/, opengwasdb/encoding/ and the rest -- is opengwasdb's, at c542111c, the commit before #464's first. A bare issue number (#464) or ADR number in code that came from opengwasdb is opengwasdb's.

Licence

GPL-3.0-only. See LICENSE. Copyright © University of Bristol. Contributions from outside the University of Bristol need a signed Contributor License Agreement.

Metadata

Release files for ogquery 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 ogquery 0.1.0
File Size Uploaded Provenance Actions
ogquery-0.1.0.tar.gz 181.8 kB With provenance Details for ogquery-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 388.8 kB

Release files / ogquery-0.1.0.tar.gz

Download URL ogquery-0.1.0.tar.gz
Size 181.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6b2d5b602f8151e385d3ebec3c686319383cf2782e566fc92d0637634c913e0a
BLAKE2b-256 checksum
How to use checksums
e716fb9f0bb03689403d030058ed89eb31f31dcc0b3b624e6575ea30b6dfa6e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 25, 2026.

Transparency log

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

Download URL ogquery-0.1.0-py3-none-any.whl
Size 207.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd549767549f0f302c5965d4ec3f9c51ff409522c5ce18ea7391627e1d01c014
BLAKE2b-256 checksum
How to use checksums
2a670a54a299d8d9abb33f0ffbe0480aeb9d0bef0aa81add219473292d0acb52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 25, 2026.

Transparency log

Security for ogquery 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.

Full provenance

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

Select from 2 files

Attestation for ogquery-0.1.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 25, 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