Iterating multiple tasks over local variable creates invalid SEDML
Paraphrased Human-Readable Adaptation of SED-ML
Brought to you by:
ckiri0315,
luciansmith
Hi Lucian,
The following example creates invalid SED-ML
from __future__ import print_function import tellurium as te antimonyStr = ''' model testcase_08() J0: S1 -> S2; k1*S1-k2*S2 S1 = 10.0; S2 = 0.0; k1 = 0.5; k2=0.4 end ''' phrasedmlStr = ''' mod1 = model "testcase_08" mod2 = model "testcase_08" sim1 = simulate uniform(0, 10, 100) sim2 = simulate uniform(0, 3, 10) task1 = run sim1 on mod1 task2 = run sim2 on mod2 repeat1 = repeat [task1, task2] for local.X in uniform(0, 10, 9), mod1.S1 = X, mod2.S1 = X+3 plot task1.time vs task1.S1, task1.S2 plot task2.time vs task2.S1, task2.S2 '''
IOError: line 113: (01015 [Error]) Missing a required XML attribute. The parameter attribute 'value' is required.
You have to assign the parameter the corresponding range SId as value.
<parameter id="X"/> <-- here
<?xml version="1.0" encoding="UTF-8"?> <sedML xmlns="http://sed-ml.org/sed-ml/level1/version2" level="1" version="2"> <listOfSimulations> <uniformTimeCourse id="sim1" initialTime="0" outputStartTime="0" outputEndTime="10" numberOfPoints="100"> <algorithm kisaoID="KISAO:0000019"/> </uniformTimeCourse> <uniformTimeCourse id="sim2" initialTime="0" outputStartTime="0" outputEndTime="3" numberOfPoints="10"> <algorithm kisaoID="KISAO:0000019"/> </uniformTimeCourse> </listOfSimulations> <listOfModels> <model id="mod1" language="urn:sedml:language:sbml.level-3.version-1" source="testcase_08"/> <model id="mod2" language="urn:sedml:language:sbml.level-3.version-1" source="testcase_08"/> </listOfModels> <listOfTasks> <task id="task1" modelReference="mod1" simulationReference="sim1"/> <task id="task2" modelReference="mod2" simulationReference="sim2"/> <repeatedTask id="repeat1" range="uniform_linear_for_S1" resetModel="false"> <listOfRanges> <uniformRange id="uniform_linear_for_S1" start="0" end="10" numberOfPoints="9" type="linear"/> </listOfRanges> <listOfChanges> <setValue range="uniform_linear_for_S1" modelReference="mod1" target="/sbml:sbml/sbml:model/descendant::*[@id='S1']"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> uniform_linear_for_S1 </ci> </math> </setValue> <setValue modelReference="mod2" target="/sbml:sbml/sbml:model/descendant::*[@id='S1']"> <listOfParameters> <parameter id="X"/> </listOfParameters> <math xmlns="http://www.w3.org/1998/Math/MathML"> <apply> <plus/> <ci> X </ci> <cn type="integer"> 3 </cn> </apply> </math> </setValue> </listOfChanges> <listOfSubTasks> <subTask order="0" task="task1"/> <subTask order="1" task="task2"/> </listOfSubTasks> </repeatedTask> </listOfTasks> <listOfDataGenerators> <dataGenerator id="plot_0_0_0" name="task1.time"> <listOfVariables> <variable id="task1_____time" symbol="urn:sedml:symbol:time" taskReference="task1"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task1_____time </ci> </math> </dataGenerator> <dataGenerator id="plot_0_0_1" name="task1.S1"> <listOfVariables> <variable id="task1_____S1" target="/sbml:sbml/sbml:model/descendant::*[@id='S1']" taskReference="task1" modelReference="mod1"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task1_____S1 </ci> </math> </dataGenerator> <dataGenerator id="plot_0_1_1" name="task1.S2"> <listOfVariables> <variable id="task1_____S2" target="/sbml:sbml/sbml:model/descendant::*[@id='S2']" taskReference="task1" modelReference="mod1"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task1_____S2 </ci> </math> </dataGenerator> <dataGenerator id="plot_1_0_0" name="task2.time"> <listOfVariables> <variable id="task2_____time" symbol="urn:sedml:symbol:time" taskReference="task2"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task2_____time </ci> </math> </dataGenerator> <dataGenerator id="plot_1_0_1" name="task2.S1"> <listOfVariables> <variable id="task2_____S1" target="/sbml:sbml/sbml:model/descendant::*[@id='S1']" taskReference="task2" modelReference="mod2"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task2_____S1 </ci> </math> </dataGenerator> <dataGenerator id="plot_1_1_1" name="task2.S2"> <listOfVariables> <variable id="task2_____S2" target="/sbml:sbml/sbml:model/descendant::*[@id='S2']" taskReference="task2" modelReference="mod2"/> </listOfVariables> <math xmlns="http://www.w3.org/1998/Math/MathML"> <ci> task2_____S2 </ci> </math> </dataGenerator> </listOfDataGenerators> <listOfOutputs> <plot2D id="plot_0"> <listOfCurves> <curve logX="false" logY="false" xDataReference="plot_0_0_0" yDataReference="plot_0_0_1"/> <curve logX="false" logY="false" xDataReference="plot_0_0_0" yDataReference="plot_0_1_1"/> </listOfCurves> </plot2D> <plot2D id="plot_1"> <listOfCurves> <curve logX="false" logY="false" xDataReference="plot_1_0_0" yDataReference="plot_1_0_1"/> <curve logX="false" logY="false" xDataReference="plot_1_0_0" yDataReference="plot_1_1_1"/> </listOfCurves> </plot2D> </listOfOutputs> </sedML>
Matthias
Just a note to say I'm looking into this. The problem seems to be the combination of using 'S1=X' and 'S2=X+3'. A minimal phrasedml script that demonstrates the problem:
mod1 = model "sbml_model.xml"
sim1 = simulate uniform(0, 10, 100)
task1 = run sim1 on mod1
repeat1 = repeat task1 for local.X in uniform(0, 10, 9), S1 = X, S2 = X+3
Changing 'S1=X' to 'S1=X+0' solves the problem.
OK! This should be working in the latest SVN. Let me know if it does!
Getting build errors in revision 63.
Not sure if this is a C++11 incompatibility or not, but at any rate, just checked in a new version that will hopefully work better for you.
Solved. Build works and problem solved.
thanks.
Can be closed.
Great--thanks for testing!