Skip to content

Commit

Permalink
Fix serialization of holds_over_chain clauses with fastobo
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Jun 18, 2022
1 parent ad6857f commit f997ff1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pronto/serializers/_fastobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def _to_typedef_frame(self, relationship: Relationship):
if r.builtin:
frame.append(fastobo.typedef.BuiltinClause(True))
for chain in sorted(r.holds_over_chain):
frame.append(fastobo.typedef.HoldsOverChainClause(*chain))
c1, c2 = map(fastobo.id.parse, chain)
frame.append(fastobo.typedef.HoldsOverChainClause(c1, c2))
if r.antisymmetric:
frame.append(fastobo.typedef.IsAntiSymmetricClause(True))
if r.cyclic:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,12 @@ def test_metadata_tag_serialization(self):
is_metadata_tag: true
""").strip()
)

def test_relationship_chains(self):
ont = pronto.Ontology()
r1 = ont.create_relationship("r1")
r2 = ont.create_relationship("r2")
r3 = ont.create_relationship("r3")
r3.holds_over_chain = { (r1, r2) }
r3.equivalent_to_chain = { (r1, r2) }
ont.dumps()

0 comments on commit f997ff1

Please sign in to comment.