Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/sbml/conversion/SBMLRateRuleConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ SBMLRateRuleConverter::getDefaultProperties() const
prop.addOption("useStoichiometryFromMath", true,
"If a number appears in the math use it as the stoichiometry");

prop.addOption("performSanityCheck", true,
"Whether the model should be checked for suitability first");

init = true;
return prop;
}
Expand Down Expand Up @@ -300,7 +303,7 @@ SBMLRateRuleConverter::convert()
{
// if we cannot do the conversion - dont try
OperationReturnValues_t returnValue;
if (!isDocumentAppropriate(returnValue))
if (performSanityCheck() && !isDocumentAppropriate(returnValue))
{
return returnValue;
}
Expand Down Expand Up @@ -1137,6 +1140,21 @@ bool SBMLRateRuleConverter::useStoichiometryFromMath()
return value;
}

bool SBMLRateRuleConverter::performSanityCheck()
{
bool value = true;
if (getProperties() == NULL || getProperties()->hasOption("performSanityCheck") == false)
{
return value;
}
else
{
value = getProperties()->getBoolValue("performSanityCheck");
}
return value;
}


void
SBMLRateRuleConverter::analyseCoefficient(std::vector<double> coeffs, unsigned int term_index)
{
Expand Down
2 changes: 2 additions & 0 deletions src/sbml/conversion/SBMLRateRuleConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class LIBSBML_EXTERN SBMLRateRuleConverter : public SBMLConverter

bool useStoichiometryFromMath();

bool performSanityCheck();

// functions to deal with multiple compartments
bool speciesFromMultipleCompartmentsInSameRateRule();

Expand Down
12 changes: 12 additions & 0 deletions src/sbml/conversion/test/TestSBMLRateRuleConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ START_TEST(test_conversion_raterule_converter_invalid)

fail_unless(rule_rn_converter->convert() == LIBSBML_OPERATION_FAILED);

// now override the check for suitability to force an invalid document through
// assuming the user knows what they are doing
rule_rn_props.addOption("performSanityCheck", false);
rule_rn_converter->setProperties(&rule_rn_props);

fail_unless(rule_rn_converter->convert() == LIBSBML_OPERATION_SUCCESS);

// reset to default
rule_rn_props.setBoolValue("performSanityCheck", true);
rule_rn_converter->setProperties(&rule_rn_props);


delete doc;
}
END_TEST
Expand Down
Loading