Skip to content

Commit

Permalink
Merge pull request #350 from sbmlteam/fbcV3-update
Browse files Browse the repository at this point in the history
Update Fbc V3 package
  • Loading branch information
skeating authored Sep 19, 2023
2 parents bee0af7 + aee04c3 commit 9faec63
Show file tree
Hide file tree
Showing 39 changed files with 892 additions and 197 deletions.
10 changes: 10 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and converting models.
- Attributes of the ModelHistory can now be accessed from
const objects.

- The FBC V3 package has been updated to reflect the latest
specification. There are now optional attributes `fbc:reaction2`
on the FluxObjective and `fbc:variable2` on the
UserDefinedConstraintComponent.

* Bug fixes

- A bug converting / validating models with the 'comp' package
Expand All @@ -23,6 +28,11 @@ and converting models.

- A fix to the CMake Build system ensures that check for dependencies
is more robust. Thanks to first time contributor @adelhpour

- The type of the FBC V3 `coefficient` attribute on the
UserDefinedConstraintComponent has been corrected, it was mistakenly
a double before, now it has been corrected to be a SIdRef as
described in the specification.


====================================================================
Expand Down
4 changes: 3 additions & 1 deletion dev/packages/deviser-fbc_v3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<attribute name="id" required="false" type="SId" abstract="false"/>
<attribute name="name" required="false" type="string" abstract="false"/>
<attribute name="reaction" required="true" type="SIdRef" element="Reaction" abstract="false"/>
<attribute name="reaction2" required="false" type="SIdRef" element="Reaction" abstract="false"/>
<attribute name="coefficient" required="true" type="double" abstract="false"/>
<attribute name="variableType" required="true" type="enum" element="FbcVariableType" abstract="false"/>
</attributes>
Expand Down Expand Up @@ -226,8 +227,9 @@
<attributes>
<attribute name="id" required="false" type="SId" abstract="false"/>
<attribute name="name" required="false" type="string" abstract="false"/>
<attribute name="coefficient" required="true" type="double" abstract="false"/>
<attribute name="coefficient" required="true" type="SIdRef" element="Parameter" abstract="false"/>
<attribute name="variable" required="true" type="SIdRef" element="Reaction,Parameter" abstract="false"/>
<attribute name="variable2" required="false" type="SIdRef" element="Reaction,Parameter" abstract="false"/>
<attribute name="variableType" required="true" type="enum" element="FbcVariableType" abstract="false"/>
</attributes>
</element>
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/matlab/getDefaultValues.m
Original file line number Diff line number Diff line change
Expand Up @@ -3565,7 +3565,7 @@
int32(-1), ...
'', ...
'', ...
0/0, ...
'', ...
int32(0), ...
'', ...
'', ...
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/matlab/getValueType.m
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,7 @@
'int', ...
'char', ...
'char', ...
'double', ...
'char', ...
'bool', ...
'char', ...
'char', ...
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/matlab/test/test-data/fbcV3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<fbc:listOfUserDefinedConstraints>
<fbc:userDefinedConstraint sboTerm="SBO:0000001" fbc:id="uc2" fbc:lowerBound="uc2lb" fbc:upperBound="uc2ub">
<fbc:listOfUserDefinedConstraintComponents>
<fbc:userDefinedConstraintComponent metaid="_udc1" sboTerm="SBO:0000001" fbc:id="dd" fbc:name="string" fbc:coefficient="2" fbc:variable="R2" fbc:variableType="linear"/>
<fbc:userDefinedConstraintComponent metaid="_udc1" sboTerm="SBO:0000001" fbc:id="dd" fbc:name="string" fbc:coefficient="uc2ub" fbc:variable="R2" fbc:variableType="linear"/>
</fbc:listOfUserDefinedConstraintComponents>
</fbc:userDefinedConstraint>
</fbc:listOfUserDefinedConstraints>
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/matlab/test/testReadFromFileFbc3.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@

Totalfail = Totalfail + fail_unless( strcmp(m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).typecode, 'SBML_FBC_USERDEFINEDCONSTRAINTCOMPONENT'));
Totalfail = Totalfail + fail_unless( strcmp(m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).fbc_id, 'dd'));
Totalfail = Totalfail + fail_unless( m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).fbc_coefficient == 2);
Totalfail = Totalfail + fail_unless( m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).isSetfbc_coefficient == 1);
Totalfail = Totalfail + fail_unless( strcmp(m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).fbc_coefficient, 'uc2ub'));
Totalfail = Totalfail + fail_unless( strcmp(m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).fbc_variable, 'R2'));
Totalfail = Totalfail + fail_unless( strcmp(m.fbc_userDefinedConstraint(1).fbc_userDefinedConstraintComponent(1).fbc_variableType, 'linear'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,19 @@ START_TEST(test_FbcExtension_create_and_write_L3V1V3)
FluxObjective* fluxObjective = objective->createFluxObjective();
fluxObjective->setReaction("J0");
fluxObjective->setCoefficient(1);
fluxObjective->setVariableType("linear");
fluxObjective->setReaction2("J0");
fluxObjective->setVariableType("quadratic");

UserDefinedConstraint* userconstraint = mplugin->createUserDefinedConstraint();
userconstraint->setId("uc2");
userconstraint->setLowerBound("uc2lb");
userconstraint->setUpperBound("uc2ub");

UserDefinedConstraintComponent * udcc = userconstraint->createUserDefinedConstraintComponent();
udcc->setCoefficient(2);
udcc->setCoefficient("ucc1");
udcc->setVariable("Avar");
udcc->setVariableType("linear");
udcc->setVariableType("quadratic");
udcc->setVariable2("Avar2");

// check annotations on several types
FbcSBasePlugin* sbaseplugin = dynamic_cast<FbcSBasePlugin*>(compartment->getPlugin("fbc"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
</listOfKeyValuePairs>
</annotation>
<fbc:listOfFluxObjectives>
<fbc:fluxObjective fbc:reaction="J0" fbc:coefficient="1" fbc:variableType="linear"/>
<fbc:fluxObjective fbc:reaction="J0" fbc:coefficient="1" fbc:variableType="quadratic" fbc:reaction2="J0"/>
</fbc:listOfFluxObjectives>
</fbc:objective>
</fbc:listOfObjectives>
<fbc:listOfUserDefinedConstraints>
<fbc:userDefinedConstraint fbc:id="uc2" fbc:lowerBound="uc2lb" fbc:upperBound="uc2ub">
<fbc:listOfUserDefinedConstraintComponents>
<fbc:userDefinedConstraintComponent fbc:coefficient="2" fbc:variable="Avar" fbc:variableType="linear"/>
<fbc:userDefinedConstraintComponent fbc:coefficient="ucc1" fbc:variable="Avar" fbc:variableType="quadratic" fbc:variable2="Avar2"/>
</fbc:listOfUserDefinedConstraintComponents>
</fbc:userDefinedConstraint>
</fbc:listOfUserDefinedConstraints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

<fbc:listOfUserDefinedConstraintComponents>

<fbc:userDefinedConstraintComponent fbc:coefficient="2" fbc:variable="Avar" fbc:variableType="linear"/>
<fbc:userDefinedConstraintComponent fbc:coefficient="uc2ub" fbc:variable="Avar" fbc:variableType="linear"/>
</fbc:listOfUserDefinedConstraintComponents>
</fbc:userDefinedConstraint>
</fbc:listOfUserDefinedConstraints>
<fbc:listOfObjectives fbc:activeObjective="obj1">
<fbc:objective fbc:id="obj1" fbc:type="maximize">
<fbc:listOfFluxes>
<fbc:fluxObjective fbc:reaction="J8" fbc:coefficient="1" fbc:variableType="linear"/>
<fbc:fluxObjective fbc:reaction="J8" fbc:coefficient="1" fbc:variableType="quadratic" fbc:reaction2="J8"/>
</fbc:listOfFluxes>
</fbc:objective>
</fbc:listOfObjectives>
Expand Down
Loading

0 comments on commit 9faec63

Please sign in to comment.