Closed hsauro closed 9 years ago
It looks like an SBML restriction regarding greater than / less than. I've already disabled validation, I don't know of any way to force the conversion. @luciansmith, any ideas?
Here's a full dump of the errors:
Error: Invalid document for moiety conversion:
Error: Conversion Errors: line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type: <plus>, <minus>, <times>, <divide>, <power>, <root>, <abs>, <exp>, <ln>, <log>, <floor>, <ceiling>, <factorial>, <sin>, <cos>, <tan>, <sec>, <csc>, <cot>, <sinh>, <cosh>, <tanh>, <sech>, <csch>, <coth>, <arcsin>, <arccos>, <arctan>, <arcsec>, <arccsc>, <arccot>, <arcsinh>, <arccosh>, <arctanh>, <arcsech>, <arccsch>, <arccoth>.
Reference: L3V1 Section 3.4.9
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type: <plus>, <minus>, <times>, <divide>, <power>, <root>, <abs>, <exp>, <ln>, <log>, <floor>, <ceiling>, <factorial>, <sin>, <cos>, <tan>, <sec>, <csc>, <cot>, <sinh>, <cosh>, <tanh>, <sech>, <csch>, <coth>, <arcsin>, <arccos>, <arctan>, <arcsec>, <arccsc>, <arccot>, <arcsinh>, <arccosh>, <arctanh>, <arcsech>, <arccsch>, <arccoth>.
Reference: L3V1 Section 3.4.9
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10217 [Error]) The MathML formulas in the following elements must yield numeric expressions: <math> in <kineticLaw>, <stoichiometryMath> in <speciesReference>, <math> in <initialAssignment>, <math> in <assignmentRule>, <math> in <rateRule>, <math> in <algebraicRule>, and <delay> in <event>, and <math> in <eventAssignment>.
Reference: L3V1 Sections 4.8, 4.9, 4.11 and 4.12
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule does not return a numeric result.
Error: Invalid SBML:
line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type: <plus>, <minus>, <times>, <divide>, <power>, <root>, <abs>, <exp>, <ln>, <log>, <floor>, <ceiling>, <factorial>, <sin>, <cos>, <tan>, <sec>, <csc>, <cot>, <sinh>, <cosh>, <tanh>, <sech>, <csch>, <coth>, <arcsin>, <arccos>, <arctan>, <arcsec>, <arccsc>, <arccot>, <arcsinh>, <arccosh>, <arctanh>, <arcsech>, <arccsch>, <arccoth>.
Reference: L3V1 Section 3.4.9
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type: <plus>, <minus>, <times>, <divide>, <power>, <root>, <abs>, <exp>, <ln>, <log>, <floor>, <ceiling>, <factorial>, <sin>, <cos>, <tan>, <sec>, <csc>, <cot>, <sinh>, <cosh>, <tanh>, <sech>, <csch>, <coth>, <arcsin>, <arccos>, <arctan>, <arcsec>, <arccsc>, <arccot>, <arcsinh>, <arccosh>, <arctanh>, <arcsech>, <arccsch>, <arccoth>.
Reference: L3V1 Section 3.4.9
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10217 [Error]) The MathML formulas in the following elements must yield numeric expressions: <math> in <kineticLaw>, <stoichiometryMath> in <speciesReference>, <math> in <initialAssignment>, <math> in <assignmentRule>, <math> in <rateRule>, <math> in <algebraicRule>, and <delay> in <event>, and <math> in <eventAssignment>.
Reference: L3V1 Sections 4.8, 4.9, 4.11 and 4.12
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule does not return a numeric result.
Error: error setting conserved moiety converter document, at rrllvm::ModelGeneratorContext::ModelGeneratorContext(const std::string &, unsigned int)
Oh wait, here's something: If you initialize DayTime
it works:
// Compartments and Species:
species $DosePulse;
// Assignment Rules:
DayTime = 7.5
DosePulse := (DayTime > 7)*(DayTime < 8);
Try that Antimony string and see if it runs for you.
Would like a permanent fix however. Cannt do this in jdesigner.
H
On Wednesday, September 30, 2015, Kyle Medley notifications@github.com wrote:
Oh wait, here's something: If you initialize DayTime it works:
// Compartments and Species: species $DosePulse;
// Assignment Rules: DayTime = 7.5 DosePulse := (DayTime > 7)*(DayTime < 8);
Try that Antimony string and see if it runs for you.
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/roadrunner/issues/202#issuecomment-144442241.
If the problem is conversion, all you should need to do is set the 'strict' flag to 'false'. I usually convert SBML files with 'setLevelAndVersion', but IIRC the conversion here was done in some other way? If you give me the libsbml code that is returning failure, I can look into how to set 'strict' to false in that context.
On Wed, Sep 30, 2015 at 8:10 AM, Kyle Medley notifications@github.com wrote:
It looks like an SBML restriction regarding greater than / less than. I've already disabled validation, I don't know of any way to force the conversion. @luciansmith https://github.com/luciansmith, any ideas?
Here's a full dump of the errors:
Error: Invalid document for moiety conversion: Error: Conversion Errors: line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type:
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Reference: L3V1 Section 3.4.9 The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type:
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Reference: L3V1 Section 3.4.9 The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10217 [Error]) The MathML formulas in the following elements must yield numeric expressions:
The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule does not return a numeric result.
Error: Invalid SBML: line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type:
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Reference: L3V1 Section 3.4.9 The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10210 [Error]) The arguments to the following MathML constructs must have a numeric type:
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Reference: L3V1 Section 3.4.9 The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule uses an argument to a operator that expects a numeric value.
line 15: (10217 [Error]) The MathML formulas in the following elements must yield numeric expressions:
in , in , in , in , in , in , and in , and in . Reference: L3V1 Sections 4.8, 4.9, 4.11 and 4.12 The formula 'gt(DayTime, 7) * lt(DayTime, 8)' in the math element of the AssignmentRule does not return a numeric result.
Error: error setting conserved moiety converter document, at rrllvm::ModelGeneratorContext::ModelGeneratorContext(const std::string &, unsigned int)
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/roadrunner/issues/202#issuecomment-144441366.
I already set the 'strict' flag. Here is the code:
// this does an in-place conversion, at least for the time being
SBMLLevelVersionConverter versionConverter;
ConversionProperties versionProps = versionConverter.getDefaultProperties();
versionProps.addOption("strict", false);
versionConverter.setProperties(&versionProps);
// need to set what checks the converter does. The const doc arg is fixed in 5.10, but
// we work with 5.9 for now.
libsbml::SBMLDocument* pdoc = const_cast<libsbml::SBMLDocument*>(doc);
pdoc->setApplicableValidators((unsigned char)Config::getInt(
Config::SBML_APPLICABLEVALIDATORS));
versionConverter.setDocument(doc);
If initializing DayTime fixes the problem, that means that the strict/conversion/validation issue is a red herring.
IIRC, Frank's roadrunner initialized everything to a default if it didn't have one assigned in the model. Compartments, reaction rates, and stoichiometries all had a default of '1', while species and parameters all had a default of '0'. Somehow, DayTime isn't getting its default here, and it's causing a problem.
In Herbert's original problematic model (which I guess he edited away?) 'DayTime' was set via an assignment rule. In the last released version of Spyder (i.e. the one running on my computer), the following works:
import tellurium as te
r = te.loada( ''' function mod(x, y) x - y*floor(x/y); end
// Compartments and Species: species DosePulse;
// Assignment Rules: DayTime := mod(time, 24); DosePulse := (DayTime > 7)*(DayTime < 8); ''')
m = r.simulate (0,10,1000)
which is a sort of amalgamation of Herbert's original model and the highly-trimmed-down one that's still posted here. Does it work on the develop version of roadrunner? If not, we've gotten at least a little closer to figuring out Herbert's original problem: what it seems to me that happened is that Herbert's original model exposed a problem, but when he trimmed it down to make it a better example, that exposed a different problem (the defaults, I think).
For comparison, here's Herbert's original problematic model, which works fine for me with Spyder 2.3.0:
import tellurium as te
r = te.loada( ''' function mod(x, y) x - y*floor(x/y); end
// Compartments and Species: species $DayTime in compartment, $DosePulse in compartment, Node2 in compartment_; species Node3, Node4, Node5; species Node6, Node7;
// Assignment Rules: DayTime := mod(time, 24); DosePulse := (DayTime > 7)*(DayTime < 8);
// Reactions: J1: Node2 => Node3; InfRate(DayTime >= 7)(DayTime <= 8); J2: Node4 => Node5; InfRateDosePulse; J3: Node6 => Node7; InfRate(mod(time, 24) >= 7)*(mod(time, 24) <= 8);
// Species initializations: Node2 = 0; Node3 = 0; Node4 = 0; Node5 = 0; Node6 = 0; Node7 = 0;
// Variable initializations: InfRate = 10;
// Other declarations: const InfRate; ''')
m = r.simulate (0,1000,1000)
Thanks @luciansmith. We're going to see if an update to the latest binaries fixes it.
This model results in a crash of libroadRunner, any ideas? Note you must used relaxed SBML mode for this.
import tellurium as te
r = te.loada( ''' // Compartments and Species: species $DosePulse;
// Assignment Rules: DosePulse := (DayTime > 7)*(DayTime < 8); ''')
Output:
File "", line 1, in
runfile('C:/Users/hsauro/Documents/Embarcadero/Studio/Projects/VCL_Projects/pathwayDesigner_VCL/Bugs/bugmodel.py', wdir='C:/Users/hsauro/Documents/Embarcadero/Studio/Projects/VCL_Projects/pathwayDesigner_VCL/Bugs')
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 711, in runfile execfile(filename, namespace)
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 79, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/hsauro/Documents/Embarcadero/Studio/Projects/VCL_Projects/pathwayDesigner_VCL/Bugs/bugmodel.py", line 37, in
''')
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\tellurium\tellurium.py", line 193, in loada return loadAntimonyModel (antStr)
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\tellurium\tellurium.py", line 180, in loadAntimonyModel rr = roadrunner.RoadRunner(sbmlStr)
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\roadrunner\roadrunner.py", line 3342, in _new_init RoadRunner._swig_init(self, *args)
File "C:\Tellurium-Winpython\python-2.7.10\lib\site-packages\roadrunner\roadrunner.py", line 2496, in init this = _roadrunner.new_RoadRunner(*args)
RuntimeError: error setting conserved moiety converter document, at ??0ModelGeneratorContext@rrllvm@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z