fix(worker): clear stale uniprot_id_from_mapped_metadata on remap - #849
fix(worker): clear stale uniprot_id_from_mapped_metadata on remap#849davereinhart wants to merge 2 commits into
Conversation
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
Coverage Report for CI Build 32290129612Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Warning No base build found for commit Coverage: 88.789%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
bencap
left a comment
There was a problem hiding this comment.
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.
| 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()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
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