Menu

#14 Iterating multiple tasks over local variable creates invalid SEDML

1.0
closed
nobody
None
2016-03-10
2016-03-03
No

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=&apos;S1&apos;]">
          <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=&apos;S1&apos;]">
          <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=&apos;S1&apos;]" 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=&apos;S2&apos;]" 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=&apos;S1&apos;]" 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=&apos;S2&apos;]" 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

Discussion

  • Lucian Smith

    Lucian Smith - 2016-03-08

    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.

     
  • Lucian Smith

    Lucian Smith - 2016-03-08
    • status: open --> pending
     
  • Lucian Smith

    Lucian Smith - 2016-03-08

    OK! This should be working in the latest SVN. Let me know if it does!

     
  • Matthias König

    Matthias König - 2016-03-09

    Getting build errors in revision 63.

    Updated to revision 63.
    --------------------------------------
    build phrasedml
    --------------------------------------
    Build directory: /home/mkoenig/tmp/phrasedml_build
    -- The C compiler identification is GNU 4.8.4
    -- The CXX compiler identification is GNU 4.8.4
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found SWIG: /usr/bin/swig (found version "2.0.11") 
    --   Using SWIG                    = /usr/bin/swig
    --   Using Python                  = 
    -- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
    -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found version "2.7.6") 
    --   main program include directories = 
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CELLML_API_INSTALL_DIR
    
    -- Build files have been written to: /home/mkoenig/tmp/phrasedml_build
    Scanning dependencies of target phrasedml
    [  2%] Building CXX object CMakeFiles/phrasedml.dir/src/model.cpp.o
    [  5%] Building CXX object CMakeFiles/phrasedml.dir/src/modelChange.cpp.o
    [  8%] Building CXX object CMakeFiles/phrasedml.dir/src/oneStep.cpp.o
    [ 11%] Building CXX object CMakeFiles/phrasedml.dir/src/output.cpp.o
    [ 13%] Building CXX object CMakeFiles/phrasedml.dir/src/phrasedml.tab.cpp.o
    [ 16%] Building CXX object CMakeFiles/phrasedml.dir/src/phrasedml_api.cpp.o
    [ 19%] Building CXX object CMakeFiles/phrasedml.dir/src/registry.cpp.o
    [ 22%] Building CXX object CMakeFiles/phrasedml.dir/src/repeatedTask.cpp.o
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp: In member function ‘virtual bool phrasedml::PhrasedRepeatedTask::finalize()’:
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:356:18: error: no match for ‘operator=’ (operand types are ‘std::set<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >::iterator {aka std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >}’ and ‘void’)
                 comb = combinelist.erase(comb);
                      ^
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:356:18: note: candidate is:
    In file included from /usr/include/c++/4.8/set:60:0,
                     from /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:7:
    /usr/include/c++/4.8/bits/stl_tree.h:228:12: note: std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >& std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >::operator=(const std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >&)
         struct _Rb_tree_const_iterator
                ^
    /usr/include/c++/4.8/bits/stl_tree.h:228:12: note:   no known conversion for argument 1 from ‘void’ to ‘const std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >&’
    make[2]: *** [CMakeFiles/phrasedml.dir/src/repeatedTask.cpp.o] Error 1
    make[1]: *** [CMakeFiles/phrasedml.dir/all] Error 2
    make: *** [all] Error 2
    --------------------------------------
    install phrasedml
    --------------------------------------
    [  2%] Building CXX object CMakeFiles/phrasedml.dir/src/repeatedTask.cpp.o
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp: In member function ‘virtual bool phrasedml::PhrasedRepeatedTask::finalize()’:
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:356:18: error: no match for ‘operator=’ (operand types are ‘std::set<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >::iterator {aka std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >}’ and ‘void’)
                 comb = combinelist.erase(comb);
                      ^
    /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:356:18: note: candidate is:
    In file included from /usr/include/c++/4.8/set:60:0,
                     from /home/mkoenig/svn/phrasedml/src/repeatedTask.cpp:7:
    /usr/include/c++/4.8/bits/stl_tree.h:228:12: note: std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >& std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >::operator=(const std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >&)
         struct _Rb_tree_const_iterator
                ^
    /usr/include/c++/4.8/bits/stl_tree.h:228:12: note:   no known conversion for argument 1 from ‘void’ to ‘const std::_Rb_tree_const_iterator<std::pair<std::vector<std::basic_string<char> >, std::basic_string<char> > >&’
    make[2]: *** [CMakeFiles/phrasedml.dir/src/repeatedTask.cpp.o] Error 1
    make[1]: *** [CMakeFiles/phrasedml.dir/all] Error 2
    make: *** [all] Error 2
    
     
  • Lucian Smith

    Lucian Smith - 2016-03-10

    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.

     
  • Matthias König

    Matthias König - 2016-03-10

    Solved. Build works and problem solved.
    thanks.
    Can be closed.

     
  • Lucian Smith

    Lucian Smith - 2016-03-10
    • status: pending --> closed
     
  • Lucian Smith

    Lucian Smith - 2016-03-10

    Great--thanks for testing!

     

Log in to post a comment.