Skip to content

fix(api): a protein's name, organism, length and review status come from its entry metadata - #1304

Merged
github-actions[bot] merged 1 commit into
developfrom
fix/protein-fields-from-uniprot-metadata
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
developfrom
fix/protein-fields-from-uniprot-metadata

Conversation

@frapercan

@frapercan frapercan commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

The gap

In the store now serving the public site, and in dev, entry_name, organism, taxonomy_id, length and reviewed are NULL in protein for all 2,758,480 proteins. No operation fills them there; resolve_protein_metadata writes them to protein_uniprot_metadata. So a protein page showed empty top-level fields next to a metadata object holding the values, and /proteins/stats reported 0 reviewed proteins.

The change

The author chose that the API read the metadata (2026-11-24).

  • Detail and listing: each field is the protein's own, else its canonical entry's metadata. An isoform takes the entry's name, organism and review status, never its length.
  • The reviewed filter 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.
  • The search also matches the entry's name and organism.
  • The listing reads the metadata of its page in one query.
  • _matches and _metadata_of keep list_proteins under 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.
  • Locally, tests/test_proteins_router.py, tests/test_proteins_stats_router.py and tests/test_endpoint_gating_sweep.py pass. lint-gates.sh is green.

Not in this PR

The instrument's statistics sections in proteins_stats.py (the top organisms and the length histogram) still read protein.organism and protein.length. Once link_protein_sequences (#1303) has run, the length can come from the linked sequence.

…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

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.64%. Comparing base (7edfb68) to head (36b8230).
⚠️ Report is 4 commits behind head on develop.

❌ 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

Impacted file tree graph

@@             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     
Files with missing lines Coverage Δ
protea/api/routers/proteins.py 98.90% <100.00%> (+0.18%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@frapercan
frapercan marked this pull request as ready for review November 24, 2026 16:58
@github-actions
github-actions Bot enabled auto-merge (squash) November 24, 2026 16:58
@github-actions
github-actions Bot merged commit 5f968c9 into develop Nov 24, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant