Skip to main content

genetrek

Python client and command line for GeneTrek: curated gene lists for neurodevelopmental disorders (NDD) and per-gene annotations (constraint, brain expression, rare-variant results) in one versioned table.

pip install genetrek            # or: uv add genetrek
pip install "genetrek[pandas]"  # to call .to_pandas() on the tables

Python 3.10 or newer. GeneTrek is for research use only, not for diagnostic use.

From Python

from genetrek import GeneTrek, Set

gt = GeneTrek()                                   # the public instance

hc = gt.gene_list("hc_ndd")                       # a gene list's members
table = gt.genes(["SHANK3", "KIAA1650", "85358"],  # any identifiers, any mix
                 columns=["loeuf", "hc_ndd"])       # -> polars DataFrame
gt.convert(["SHANK3", "ENSG00000100888"], to=["hgnc", "ncbi"])
gt.search("chr22:50,674,408-50,733,212")          # what the search box does

result = gt.compare([
    Set.field("hc_ndd"),
    Set.genes(["SHANK3", "CHD8", "SCN2A"], label="my genes"),
    Set.file("candidates.txt"),
])
result.pairs        # overlap, odds ratio with exact 95% CI, Fisher p, FDR, adjusted
result.methods      # the methods paragraph, with the database release
result.to_request_json("request.json")   # gt.replay("request.json") later

# Within the genes expressed in brain, adjusted for constraint and gene length
gt.compare(["autism_genes", "epilepsy_genes"],
           background="Brain-expressed protein-coding genes",
           adjust_for=["LOEUF decile", "Gene length decile"])
# Within a gene list, or within your own genes (at least 200)
gt.compare(["autism_genes", "epilepsy_genes"], background=Set.field("hc_ndd"))
gt.compare(["autism_genes", Set.file("hits.txt")], background=Set.file("panel.txt"))

gt.backgrounds() lists the preset backgrounds, the covariates and the pairs that can be combined. A list cut from a covariate (a LOEUF threshold adjusted for LOEUF) gets no adjusted result: result.pairs["adjusted_unavailable"] says why, and adjusted_caveat flags a set the covariate largely determines.

Tables are polars DataFrames; with the pandas extra, table.to_pandas(). A null means "not measured" and is never turned into False.

Errors are exceptions you can catch: UnknownGene, AmbiguousGene, UnknownField, NotAGeneList, and ApiError (with the server's .code) for the rest. Identifiers that match no gene, or several, are reported in an UnresolvedWarning rather than dropped silently.

From the shell

genetrek list hc_ndd > hc_ndd.txt                    # one gene per line
genetrek genes my_genes.txt --columns loeuf,hc_ndd   # TSV to stdout
genetrek convert - --to hgnc,ensg < ids.txt
genetrek search SHANK3 chr22:50674408-50733212
genetrek compare hc_ndd my_genes.txt:mine --out results/
genetrek compare autism_genes epilepsy_genes --background-set hc_ndd \
    --adjust "LOEUF decile" --adjust "Gene length decile"
genetrek replay results/request.json
genetrek download -o genetrek.parquet
genetrek --help

Tables go to stdout as TSV (NA for null), messages to stderr; --json prints JSON.

Which server

The public instance, https://genetrek.pasteur.fr, is the default. To use another one, name it once:

genetrek config add local http://localhost:8000
genetrek config add dev https://genetrek.dev.example.org --default
genetrek info          # says which server answered, and why it was chosen

The names live in a small TOML file in your configuration directory (genetrek config list prints where; $GENETREK_CONFIG moves it). The first of these that is set wins: GeneTrek(base_url=...) or --url; GeneTrek(server="dev") or --server dev; $GENETREK_URL; $GENETREK_SERVER; the file's default; the public instance.

Your genes

Your identifiers travel in request bodies only, never in a URL, so they are not written to any server's access log, and nothing you send is cached to disk. A My lists share link is read locally: only its token is sent.

Versions

Every result carries the database release it was computed on (result.release, gt.release()). The client checks the server's API version: genes(), search() and the error codes need API 1.1, and gene-set backgrounds and two covariates need 1.2; genetrek.pasteur.fr serves both from GeneTrek v8. Against an older server those calls raise ServerTooOld, and everything else works.

Citing and licences

How to cite GeneTrek: https://genetrek.pasteur.fr/cite. The code is MIT-licensed; the data keep each source's terms, listed per column on https://genetrek.pasteur.fr/columns.

Metadata

Release files for genetrek 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 genetrek 0.2.0
File Size Uploaded Provenance Actions
genetrek-0.2.0.tar.gz 31.4 kB With provenance Details for genetrek-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 63.4 kB

Release files / genetrek-0.2.0.tar.gz

Download URL genetrek-0.2.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
603f0430a25e781585b1c8bb9b378ec88884b510b2562c8f59f07a4b156bcefc
BLAKE2b-256 checksum
How to use checksums
2f2cf262115861e98b70d0a9b4c97eeca6f36fd455c4014ca0cf580e2568626c
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 4, 2026.

Transparency log

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

Download URL genetrek-0.2.0-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be4a14c9ee54c7e603b8d52d2e05bad66d998a44c21621d717c74ba95e027b55
BLAKE2b-256 checksum
How to use checksums
3d6e180a765730760926910e2a5e2a6346b92d5615070336e655be59bddf469f
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 4, 2026.

Transparency log

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

Full provenance

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

Select from 2 files

Attestation for genetrek-0.2.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 4, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full 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