Skip to content

Commit 39e0418

Browse files
committed
skip events without assignments in SBML
1 parent b6ecede commit 39e0418

4 files changed

Lines changed: 9 additions & 81 deletions

File tree

cases/11-time-switcher/master/sbml/nameless.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,6 @@
120120
</listOfReactions>
121121

122122
<listOfEvents>
123-
<event
124-
id="sw0"
125-
>
126-
<trigger>
127-
<math xmlns="http://www.w3.org/1998/Math/MathML">
128-
129-
130-
131-
132-
</math>
133-
</trigger>
134-
</event>
135123
<event
136124
id="sw1"
137125
>

cases/16-d-switcher/master/sbml/nameless.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,6 @@
147147

148148
</listOfEventAssignments>
149149
</event>
150-
<event
151-
id="sw2"
152-
>
153-
<trigger>
154-
<math xmlns="http://www.w3.org/1998/Math/MathML">
155-
<apply><and/><apply><lt/><ci>S1</ci><cn>10</cn></apply><apply><gt/><csymbol definitionURL="http://www.sbml.org/sbml/symbols/time">t</csymbol><cn>400000</cn></apply></apply>
156-
</math>
157-
</trigger>
158-
</event>
159150
</listOfEvents>
160151

161152

cases/20-syntax/master/sbml/nameless.xml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -187,57 +187,6 @@
187187

188188
</listOfEventAssignments>
189189
</event>
190-
<event
191-
id="ts2"
192-
>
193-
<trigger>
194-
<math xmlns="http://www.w3.org/1998/Math/MathML">
195-
196-
<apply><geq/>
197-
<apply><minus/>
198-
<apply><divide/>
199-
<apply><minus/>
200-
<csymbol definitionURL="http://www.sbml.org/sbml/symbols/time">t</csymbol>
201-
<cn>0</cn>
202-
</apply>
203-
<ci>period2</ci>
204-
</apply>
205-
<apply><floor/>
206-
<apply><plus/>
207-
<apply><divide/>
208-
<apply><minus/>
209-
<csymbol definitionURL="http://www.sbml.org/sbml/symbols/time">t</csymbol>
210-
<cn>0</cn>
211-
</apply>
212-
<ci>period2</ci>
213-
</apply>
214-
<cn>0.5</cn>
215-
</apply>
216-
</apply>
217-
</apply>
218-
<cn>0</cn>
219-
</apply>
220-
221-
222-
223-
</math>
224-
</trigger>
225-
</event>
226-
<event
227-
id="cs1"
228-
>
229-
<trigger>
230-
<math xmlns="http://www.w3.org/1998/Math/MathML">
231-
232-
<apply>
233-
<geq/>
234-
<apply><minus/><ci>k1</ci><cn>1</cn></apply>
235-
<cn>0</cn>
236-
</apply>
237-
238-
</math>
239-
</trigger>
240-
</event>
241190
</listOfEvents>
242191

243192

src/templates/sbml.xml.njk

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@
378378
<listOfEvents>
379379
{%- for event in listOfTimeEvents -%}
380380
{%- set startMathML = '<ci>' + event.start + '</ci>' if event.start is defined else '<cn>'+ event.startObj.num + '</cn>' %}
381+
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
382+
{%- if eventAssignments|length > 0 %}{# skip events with no assignments #}
381383
<event
382384
id="{{event.id}}"
383385
{#- metaid="{{event.index}}" #}
@@ -422,8 +424,6 @@
422424
{% if not event.active %}</apply>{% endif %}
423425
</math>
424426
</trigger>
425-
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
426-
{%- if eventAssignments|length > 0 %}
427427
<listOfEventAssignments>
428428
{% for record in eventAssignments %}
429429
<eventAssignment
@@ -434,10 +434,12 @@
434434
</eventAssignment>
435435
{% endfor %}
436436
</listOfEventAssignments>
437-
{%- endif %}
438437
</event>
438+
{%- endif %}
439439
{%- endfor %}
440440
{%- for event in listOfCEvents %}
441+
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
442+
{%- if eventAssignments|length > 0 %}
441443
<event
442444
id="{{event.id}}"
443445
{#- metaid="{{event.index}}" #}
@@ -453,8 +455,6 @@
453455
{% if not event.active %}</apply>{% endif %}
454456
</math>
455457
</trigger>
456-
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
457-
{%- if eventAssignments|length > 0 %}
458458
<listOfEventAssignments>
459459
{% for record in eventAssignments %}
460460
<eventAssignment
@@ -465,10 +465,12 @@
465465
</eventAssignment>
466466
{% endfor %}
467467
</listOfEventAssignments>
468-
{%- endif %}
469468
</event>
469+
{%- endif %}
470470
{%- endfor %}
471471
{%- for event in listOfDEvents %}
472+
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
473+
{%- if eventAssignments|length > 0 %}
472474
<event
473475
id="{{ event.id }}"
474476
{#- metaid="{{ event.index }}" #}
@@ -480,8 +482,6 @@
480482
{%- if not event.active %}</apply>{% endif %}
481483
</math>
482484
</trigger>
483-
{%- set eventAssignments = population.selectRecordsByContext(event.id) -%}
484-
{%- if eventAssignments|length > 0 %}
485485
<listOfEventAssignments>
486486
{% for record in eventAssignments %}
487487
<eventAssignment
@@ -492,8 +492,8 @@
492492
</eventAssignment>
493493
{% endfor %}
494494
</listOfEventAssignments>
495-
{%- endif %}
496495
</event>
496+
{%- endif %}
497497
{%- endfor %}
498498
</listOfEvents>
499499
{% endif %}

0 commit comments

Comments
 (0)