Repository navigation
fix(api): a protein's name, organism, length and review status come from its entry metadata - #1304
Merged
github-actions[bot] merged 1 commit intoNov 24, 2026
Conversation
…rom its entry metadata No operation fills the descriptive columns of protein in the clean store: entry_name, organism, taxonomy_id, length and reviewed are NULL for all 2,758,480 proteins, in the public store and in dev alike. resolve_protein_metadata writes them to protein_uniprot_metadata, which the detail endpoint already returned in a separate object. So the top-level fields read null, and /proteins/stats reported 0 reviewed proteins. The author chose that the API read the metadata (2026-11-24): - the detail and the listing show the protein's own field, else its canonical entry's metadata. An isoform never takes the entry's length; - the reviewed filter and the stats count a protein as reviewed when its row or its entry's metadata says so; - the search also matches the entry's name and organism. The listing reads the metadata of its page in one query. The search filter and that read are helpers, which keeps list_proteins under the smells limit.
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (83.90%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1304 +/- ##
===========================================
- Coverage 85.69% 85.64% -0.05%
===========================================
Files 471 471
Lines 37374 37421 +47
===========================================
+ Hits 32026 32050 +24
- Misses 5348 5371 +23
🚀 New features to boost your workflow:
|
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.
The gap
In the store now serving the public site, and in dev,
entry_name,organism,taxonomy_id,lengthandreviewedare NULL inproteinfor all 2,758,480 proteins. No operation fills them there;resolve_protein_metadatawrites them toprotein_uniprot_metadata. So a protein page showed empty top-level fields next to ametadataobject holding the values, and/proteins/statsreported 0 reviewed proteins.The change
The author chose that the API read the metadata (2026-11-24).
reviewedfilter and the stats: a protein counts as reviewed when its own row or its entry's metadata says so. On dev's data this counts 574,058 reviewed proteins, matching the 573,661 Swiss-Prot entries of cut 227 within the gap between the two releases._matchesand_metadata_ofkeeplist_proteinsunder the 60-line smells limit.A store that does fill the columns, as the previous one did, keeps showing them, because the protein's own value wins.
Tests
test_empty_core_fields_come_from_the_entry_metadata: a protein with every core field empty shows its entry's name, organism, taxon, length and review status.tests/test_proteins_router.py,tests/test_proteins_stats_router.pyandtests/test_endpoint_gating_sweep.pypass.lint-gates.shis green.Not in this PR
The instrument's statistics sections in
proteins_stats.py(the top organisms and the length histogram) still readprotein.organismandprotein.length. Oncelink_protein_sequences(#1303) has run, the length can come from the linked sequence.