feat(alliance): add gget alliance module for Alliance of Genome Resources (#162)#232
feat(alliance): add gget alliance module for Alliance of Genome Resources (#162)#232Elarwei001 wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #232 +/- ##
==========================================
+ Coverage 56.70% 57.21% +0.51%
==========================================
Files 29 30 +1
Lines 9392 9476 +84
==========================================
+ Hits 5326 5422 +96
+ Misses 4066 4054 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…rces (scverse#162) New module `gget alliance` queries the Alliance of Genome Resources REST API (https://www.alliancegenome.org/). Passing an Alliance gene ID (HGNC/MGI/RGD/ZFIN/FB/WB/SGD/...) returns that gene's details; any other input is used as a free-text search returning matching objects of a chosen category (gene/allele/disease/go/variant/model) across the member model-organism databases. Exposed via the Python API and the command line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add network-free mocked tests for empty search_term, _text passthrough, _alliance_get request-exception/404, gene-not-found, gene/search verbose logging, and save CSV/JSON branches. gget_alliance.py now 100%. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a45fbc6 to
7ae9690
Compare
…sts (scverse#162) - docs: put the Alliance (2024) citation before gget's, per convention - docs: drop the issue link from the updates.md changelog entry - docs: add Spanish page (es/alliance.md) + SUMMARY Espanol entry - gget_alliance: warn when 'category' is not a known value instead of silently passing it through (which returns no results) - tests: add live tests (skipped when offline) against the real Alliance API for both the gene-by-ID and free-text-search paths Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Hi @lauraluebbert — this PR is ready for review whenever you have time. Quick overview:
Happy to adjust anything — thanks! |
Resolves #162
Summary
gget alliance: new module to query the Alliance of Genome Resources — the consortium that integrates the major model-organism databases (human/HGNC, mouse/MGI, rat/RGD, zebrafish/ZFIN, fly/FlyBase, worm/WormBase, yeast/SGD, …). Two modes, chosen automatically from the input:HGNC:1101,MGI:109337,RGD:2219) → the gene's details.category.Available in the Python API and on the command line.
Example return values
Mode A — fetch a gene by its Alliance ID —
gget.alliance("HGNC:1101")(synonyms trimmed):Mode B — free-text search —
gget.alliance("brca2", category="gene", limit=5). Note it spans organisms in one call:Other categories work the same way — e.g.
category="disease"returns disease objects (whosesymbol/species/so_term_nameareNone, since the shared search schema is populated per object type). The counts differ by object type (forbrca2: gene 40, disease 25, allele 107, variant 24307), solimitmatters — a gene relates to a handful of diseases but tens of thousands of variants. First 2 of 25 disease hits:With
json=True(the command-line default) the same data comes back as a list of records — e.g. the gene fetch above (synonyms trimmed):[ { "id": "HGNC:1101", "symbol": "BRCA2", "name": "BRCA2 DNA repair associated", "species": "Homo sapiens", "taxon": "NCBITaxon:9606", "gene_type": "protein_coding_gene", "synonyms": ["FAD", "FACD", "FAD1", "BRCC2", "…"], "data_provider": "RGD" } ]Options:
category(gene/allele/disease/go/variant/model/all; defaultgene),limit(default 10), plusjson/save.Full example output — the gene detail (HGNC:1101), the full 40-row cross-organism gene search, and a disease search (CSV + JSON) are attached here: https://gist.github.com/Elarwei001/dde42935da5e9b09bf0ccb34e9176f4a
Testing
Unit tests in
tests/test_alliance.py(fixture intests/fixtures/) cover both modes, the friendly-category→ API-value mapping, the{displayText/formatText}display objects, and the error paths (404 → gene not found, 5xx, request failure, empty term). Two live tests (skipped when offline, so CI stays green) hit the real Alliance API: a truth-anchoredHGNC:1101gene fetch and abrca2gene search.