Repository navigation
Fix UniProt TrEMBL parsing, fetcher error chaining and id_mapping - #102
Merged
Merged
Conversation
- fetch_uniprot: parse unreviewed (TrEMBL) entries that only carry
submissionNames; fall back to the first submission name for name, id
and EC number. Optional model fields now have real defaults.
- fetch_uniprot: report 4xx responses as ValueError (invalid/unknown ID)
instead of ConnectionError, give a clear message for inactive
(deleted/merged) entries, and strip surrounding whitespace.
- compose: chain the last fetcher exception so the real cause shows up
in the traceback.
- compose: id_mapping now also updates species_id in reaction
reactants/products/modifiers, so mapped reactions no longer refer to
undeclared species.
- compose: id_mapping keys match whole IDs, case-insensitively
("CHEBI:1" no longer renames CHEBI:15377), and mappings that give two
species the same ID raise a ValueError.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The lint workflow installed the latest ruff, which reports hundreds of pre-existing issues across the codebase. Pin it to 0.15.22, the version .pre-commit-config.yaml already uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UniProt fetcher
fetch_uniprot("Q7DDU0")failed withrecommendedName Field required: unreviewed (TrEMBL) entries only havesubmissionNames. The name, ID and EC number now fall back to the first submission name. TheOptionalmodel fields had no default, so Pydantic v2 still required them; they now default toNone.ValueError("invalid or not found"), not a misleadingConnectionError. Inactive (deleted/merged) entries get a clear message instead of a parse error. Surrounding whitespace in the ID is stripped.Composer
_fetch_with_fetcherschains the last fetcher exception (raise ... from), so the real cause shows up in the traceback.id_mappingnow also renamesspecies_idin reaction reactants/products/modifiers. Before,compose(reactions=["RHEA:19273"], id_mapping={"CHEBI:63153": "ManNAc"})produced a reaction referring to an undeclared species.id_mappingkeys match whole IDs, case-insensitively, instead of by substring:"CHEBI:1"used to rename water (CHEBI:15377)."CHEBI:63153","chebi:63153","63153"and"OBO:CHEBI_63153"all work.ValueErrorinstead of producing duplicate IDs.Behaviour change: a mapping key that only matched as a substring of an ID no longer matches.
Tests
tests/unit/test_uniprot.pyandtests/unit/test_composer.py; each fails against the previous code.Q7DDU0and the RHEA:19273 mapping intests/integration/.-m remotefetcher/composer tests pass locally.🤖 Generated with Claude Code
This change is