feat(reactome): add gget reactome module to query the Reactome pathway database (#114)#236
feat(reactome): add gget reactome module to query the Reactome pathway database (#114)#236Elarwei001 wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #236 +/- ##
==========================================
+ Coverage 56.70% 57.56% +0.85%
==========================================
Files 29 30 +1
Lines 9392 9560 +168
==========================================
+ Hits 5326 5503 +177
+ Misses 4066 4057 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…y database (scverse#114) New module `gget reactome` (Python API + CLI) querying the Reactome ContentService REST API (https://reactome.org/). Supports three query types via the `resource` argument: - pathways (default): the Reactome pathways an identifier (e.g. a UniProt accession) participates in - search: full-text search of the Reactome knowledgebase - entity: details for a Reactome stable ID Returns a pandas DataFrame (or JSON with json=True / --csv on the CLI). Reuses the shared http_json helper for retries/error handling, strips HTML highlight tags from search results, and maps Reactome 404s to empty results (pathways/search) or a clear ValueError (entity). Adds unit tests (offline argument validation via fixture + release-robust network smoke tests that skip when Reactome is unreachable), docs page docs/src/en/reactome.md, a SUMMARY.md entry, and an updates.md note. Resolves scverse#114. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Add a network-free TestReactomeOffline class that mocks http_json to cover _strip_html passthrough, the pathways/search/entity parsing, verbose logging, 404 and non-404 error branches, the entity name fallback/summation, and resource/query validation. gget_reactome.py now 98% (only the import-time PackageNotFoundError version fallback, lines 16-17, remains, which is un-coverable in an installed environment). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
400a044 to
3ef868a
Compare
Bilingual (ZH/EN) analysis of scverse/gget#236 (new gget reactome module: pathways/search/entity queries over Reactome's ContentService REST API). Verified all three endpoints live; covers platform fit (strong, query-type, maintainer-requested), the good invariant-based live-test design, and the pre-commit.ci red root cause (a single mypy annotation at main.py:3923). Updated README index + index.html card. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…xes (scverse#114) New resource query types for gget reactome, plus the review follow-ups: - resource="interactors": molecular interactors of an identifier (IntAct static), columns [interactor_acc, interactor_name, score, evidences]. - resource="orthology": project a Reactome stable ID to its ortholog in another species (requires species; resolves the species name/taxId to Reactome's dbId). - resource="event-hierarchy": the full pathway/reaction hierarchy for a species, flattened to one row per event with parent_id and nesting level. Review fixes: - Fix the CLI type annotation that failed pre-commit.ci (main.py: cast the reactome() result, which is a DataFrame in the CLI path). - Structured 404 detection: http_json now raises HTTPStatusError (a RuntimeError subclass carrying .status_code), and reactome checks the code instead of string-matching the message. Backward-compatible for existing http_json callers. - Record the Reactome release in df.attrs["reactome_release"] for reproducibility. - Add a network test that passes species as a name (not just a taxon ID). Tests: offline mocks for the three new resources (+ species resolution and error branches) and network invariant tests that skip when Reactome is unreachable. Docs: reactome.md resource list, --resource/--species, examples; changelog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- References: list the Reactome (data source) citation before gget's own. - Remove the "Resolves issue 114" text from the changelog entry (doc pages don't need the issue link). - Add docs/src/es/reactome.md (Spanish translation) and its SUMMARY entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Hi @lauraluebbert — this adds the gget reactome module that querying Reactome's ContentService REST API. Key points:
would appreciate a review whenever you have a moment. Thanks |
Resolves #114
What this adds
A new
gget reactomemodule that queries the Reactome pathway knowledgebase via its ContentService REST API, returning gget-ified data frames (or list-of-dicts withjson=True). The query type is selected with theresourceargument:resourcequeryispathways(default)P04637)searchTP53)entityR-HSA-6804754)interactorsorthology--species)event-hierarchysourceselects the identifier database forpathways(UniProtdefault,Ensembl,ChEBI,NCBI);species/typesfilter where applicable..attrs["reactome_release"]for reproducibility.--csvfor CSV.Robustness
http_jsonnow raisesHTTPStatusError(aRuntimeErrorsubclass carrying.status_code), soreactomebranches on the status code (e.g. 404 → empty result / clearValueError) instead of string-matching the error message. Backward-compatible: existingexcept RuntimeErrorcallers are unaffected.Testing
TestReactomeOffline): parsing and error branches for everyresource, HTML stripping, name/summation fallbacks, species resolution, and argument validation.TestReactome) that assert structural invariants (columns, identifier shape, species honored, a stable well-known entry) rather than drift-prone exact lists, and skip when Reactome is unreachable. Includes a species-by-name case.