Repository navigation
feat: events (VCML BioEvents) are read, modelled and written back - #67
Merged
Merged
Conversation
Application.events holds each BioEvent: its trigger type (VCell's seven), whether it uses values from trigger time, its role-tagged parameters (trigger function, delay, observable, threshold, trigger times) and its event assignments; Application.add_event adds a general-trigger event. The reader takes VCell's current form and the legacy <Trigger>/<Delay> forms the way VCell's XmlReader does. Before, events were dropped on every read and write, so a re-written model (simulate_ode writes the model back) ran without them: BioModel 297 (Ciliberto 2003) left COPASI's answer at its first event; with its four events kept it agrees within 4e-6. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem. pyvcell had no model for VCell events, so every read and write dropped them.
simulate_odewrites the model back before solving, so any model with events ran without them.Found through biosimulations/compose-api#364, where pbsim-common's
VCellUTCStepruns SED-ML archives beside COPASI and Tellurium. On BioModel 297 (Ciliberto 2003), cell division and budding are events. VCell tracked COPASI until the first trigger (t ≈ 73 min), then diverged by up to 6× a variable's range.Data model (
pyvcell/vcml/models_app.py)Application.events: list[Event], one per VCML<BioEvents><BioEvent>(VCell'sBioEvent).Event:name;trigger_type: anEventTriggerType(VCell's seven: general, single time, observable above or below a threshold, linear or log range of times, list of times);use_values_from_trigger_time;parameters: a list ofEventParameter;assignments: a list ofEventAssignment(variable, expression).triggeranddelayare convenience properties for the general-trigger function and the delay.EventParameter: name,role(anEventParameterRole, VCell'sBioEventParameterType), expression and optional unit.Application.add_event(name, trigger, assignments, delay=None, use_values_from_trigger_time=True)adds a general-trigger event.pyvcell.vcml.Reading and writing
visit_BioEvent) follows VCell'sXmlReader.getBioEvents.TriggerType, role-tagged<Parameter>s,<EventAssignment>s.<Trigger>expr</Trigger>and the first-pass 5.4<TriggerParameters triggerClass="TriggerGeneral">, each with<Delay>.(t > -1.0), which never rises, and a missingUseValuesFromTriggerTimereads as false.<BioEvents>after the simulations, as VCell'sXmlproducerdoes. VCell regenerates the math events from them.Results
tests/vcml/test_events.py:Not modelled: RDF and annotation metadata (
<Annotation>,vcml:uriBinding, ...) is still dropped on a round trip. It doesn't change the math.🤖 Generated with Claude Code