Fix HPO parsing for OBO 1.4 - round 2#289
Merged
Merged
Conversation
MattWellie
approved these changes
Jun 15, 2026
MattWellie
left a comment
There was a problem hiding this comment.
Oof, so it was just bad luck that the original failure we spotted was ordered a certain way?
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.
Follow up to #288
The problem
The regex assumed
{modifier}comes after! comment, but OBO 1.4 spec puts the modifier before the comment, and the real HPO file uses the standard ordering. With a line likeis_a: HP:0032162 {xref="PMID:31677808"} ! Phenotypic abnormality, the anchored-to-end regex didn't match,split(' ! ')[0]returnedHP:0032162 {xref="..."}, and that string was stored as theparent_id, leading to errors.The fix
re.search(r'HP:\d{7}', value)extracts the parent id directly, regardless of where (or whether) modifiers/comments appear around it.is_a:line surfaces a clear error instead of silently storing garbage asparent_id(which is what bit us in the last PR).update_hpo_tests.py— added a new fixture termHP:9999003using the OBO 1.4 standard ordering ({modifier} ! comment) so this case is covered going forward; bumped record counts to 8.