Skip to content

fix(worker): clear stale uniprot_id_from_mapped_metadata on remap - #849

Open
davereinhart wants to merge 2 commits into
release-2026.3.0from
fix/davereinhart/794/clear-stale-uniprot-id
Open

fix(worker): clear stale uniprot_id_from_mapped_metadata on remap#849
davereinhart wants to merge 2 commits into
release-2026.3.0from
fix/davereinhart/794/clear-stale-uniprot-id

Conversation

@davereinhart

Copy link
Copy Markdown
Collaborator

The UniProt polling job only writes target_gene.uniprot_id_from_mapped_metadata on a successful lookup. When a remap produced no UniProt ID (no results, ambiguous results, or the target gene was not found), the value from the previous mapping run survived and became mismatched against the freshly written pre/post mapped metadata — a state unreachable for a new target_gene record.

Clear the field alongside the other mapped metadata writes in map_variants_for_score_set, so it is reset before the downstream UniProt mapping jobs run.

Closes #794

The UniProt polling job only writes target_gene.uniprot_id_from_mapped_metadata
on a successful lookup. When a remap produced no UniProt ID (no results,
ambiguous results, or the target gene was not found), the value from the
previous mapping run survived and became mismatched against the freshly
written pre/post mapped metadata — a state unreachable for a new target_gene
record.

Clear the field alongside the other mapped metadata writes in
map_variants_for_score_set, so it is reset before the downstream UniProt
mapping jobs run.

Closes #794
@coveralls

coveralls commented Aug 18, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 32290129612

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit b1c84da on release-2026.3.0.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 88.789%

Details

  • Patch coverage: 3 of 3 lines across 1 file are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15609
Covered Lines: 13859
Line Coverage: 88.79%
Coverage Strength: 0.89 hits per line

💛 - Coveralls

@bencap bencap left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dave, looks good. I had a thought that our handling of the mapped_hgnc_symbol property looked really similar to the shape of this bug. If you'd rather keep this PR clean to just the issue at hand, I can open up a new issue for that one. Just lmk.

Comment on lines 170 to 175
if gene_info:
target_gene.mapped_hgnc_name = gene_info.get("hgnc_symbol")
post_mapped_metadata["hgnc_name_selection_method"] = gene_info.get("selection_method")

job_manager.save_to_context({"mapped_hgnc_name": target_gene.mapped_hgnc_name})
logger.debug("Added mapped HGNC name to target gene.", extra=job_manager.logging_context())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at your changes, I am thinking we should also do a similar thing here. This is basically an identical bug to the uniprot_id_from_mapped_metadata. If the mapper doesn't supply gene_info, we retain the stale gene info from a prior run.

We could add a new issue but I was thinking it might be small and similar enough to the purpose of this bug fix that we just fold it in.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bencap I added a new commit to include this. Let me know if that looks ok and if you think it should have its own unit test like the cleared uniprot ID.

The mapping job only wrote mapped_hgnc_name when gene info was present, so a
target gene remapped without gene info kept values from a prior run. Explicitly
reset to None in the else branch.
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.

Clear existing uniprot_id_from_mapped_metadata value from target_gene prior to updating

3 participants