Skip to content

Commit

Permalink
Merge pull request #633 from biolink/go-site-844-gorule-0000020-error…
Browse files Browse the repository at this point in the history
…s-before-warnings

For #844
  • Loading branch information
mugitty committed May 12, 2023
2 parents 5d4eee5 + cfb179e commit c5f06bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ontobio/io/assocparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,11 @@ def to_report_json(self):
def sort_messages(self, r, messages):
if len(messages) > 0:
# Messages for GORULE:0000020 are sorted by level (Error before Warning), then by GO id
if r != "GORULE:0000020":
if r != "gorule-0000020":
return None
messages.sort(key=lambda x: x.get('level'))
messages.sort(key=lambda x: x.get('obj'))
messages.sort(key=lambda x: x.get('level'))


def to_markdown(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gafparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ def test_obsolete_replair_of_extensions():
assoc_result = p.parse_line("ZFIN\tZDB-GENE-980526-362\tctnnb1\t\tGO:0007155\tPMID:15494018\tIC\tGO:0005912\tP\tcatenin (cadherin-associated protein), beta 1\tctnnb|id:ibd2058|wu:fb73e10|wu:fi81c06|wu:fk25h01\tprotein_coding_gene\ttaxon:7955\t20041026\tZFIN\tpart_of(GO:0005913)|part_of(GO:0016458)\tUniProtKB:P12345")
print(p.report.to_markdown())
assert assoc_result.associations == []
assert p.report.to_report_json()["messages"]["gorule-0000020"][0]["obj"] == "GO:0005913"
assert p.report.to_report_json()["messages"]["gorule-0000020"][1]["obj"] == "GO:0016458"
assert p.report.to_report_json()["messages"]["gorule-0000020"][0]["obj"] == "GO:0016458"
assert p.report.to_report_json()["messages"]["gorule-0000020"][1]["obj"] == "GO:0005913"

#Reset the report
p = GafParser(config=assocparser.AssocParserConfig(
Expand Down

0 comments on commit c5f06bc

Please sign in to comment.