feat: implement named stoichiometry and advanced event options for AntimonySerializer#310
Conversation
|
@draeger, @luciansmith - Just pinging you both here since this PR specifically implements the advanced edge cases we discussed at the end of #305! Whenever you have a moment to review the logic for the named stoichiometries and event formatting, let me know if it looks good or if any tweaks are needed! |
|
That's not actually the correct syntax for delays! It's: at S1-5 after B>3: x = 4 i.e. '[formula] after' Are you ensuring that the produced Antimony is correct by trying to parse it with libAntimony? And then ensuring that libAntimony gives you essentially the same SBML when round-tripped? It might help with things like this. |
Ah, thank you so much for the correction! I completely misunderstood the Antimony documentation regarding the delay syntax. Regarding your question about round-trip testing with I will push a fix for the delay syntax right away. |
|
@luciansmith Fix pushed! The tests are passing cleanly with the updated |
draeger
left a comment
There was a problem hiding this comment.
A few minor change requests about formatting only.
draeger
left a comment
There was a problem hiding this comment.
I'll merge this now and we can add an interface collecting Antimony keywords later.
|
Thank you for the merge, @draeger! Funny timing - I actually just finished building that exact Update: new PR : #311 . |
Description
This PR acts as a direct follow-up to the Phase 1-3 implementation merged in #305. It addresses the advanced edge cases and feature requests highlighted by @luciansmith during the initial review, ensuring the serializer can handle complex SBML models cleanly and token-efficiently.
Key Updates
toAntimony(Reaction r)to check for and serialize named stoichiometries (e.g., dynamically mapping ton S2 => S3if theSpeciesReferencehas an ID).toAntimony(Event e)to support complex event configurations:delay=...)priority=...)t0=false)persistent=false)t0andpersistentare only appended if explicitly set tofalse, keeping the resulting Antimony string as concise as possible.Testing
Expanded
AntimonySerializerTest.javato cover these new edge cases. All tests are passing cleanly (BUILD SUCCESS).With these advanced features in place, the underlying serialization logic is fully complete and ready to be adapted into the upcoming
TreeWalkVisitor pattern we are discussing in #262!