Skip to content

Commit

Permalink
Fix remove unit assignments (#136)
Browse files Browse the repository at this point in the history
* remove units

* remove units from SBML tests

Co-authored-by: Dilan Pathirana <59329744+dilpath@users.noreply.github.com>
  • Loading branch information
jvanhoefer and dilpath committed Jul 29, 2021
1 parent 01b9100 commit 4ad4c8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
22 changes: 11 additions & 11 deletions tests/test_yaml2sbml/true_sbml_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@
<compartment id="Compartment" size="1" constant="true"/>
</listOfCompartments>
<listOfSpecies>
<species id="S1" compartment="Compartment" initialAmount="0.1" substanceUnits="dimensionless" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="S2" compartment="Compartment" initialAmount="1" substanceUnits="dimensionless" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="S3" compartment="Compartment" initialAmount="1" substanceUnits="dimensionless" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="S1" compartment="Compartment" initialAmount="0.1" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="S2" compartment="Compartment" initialAmount="1" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="S3" compartment="Compartment" initialAmount="1" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
</listOfSpecies>
<listOfParameters>
<parameter id="t" name="t" constant="false"/>
<parameter id="c1" name="c1" value="1" units="dimensionless" constant="true"/>
<parameter id="Shalve" name="Shalve" value="0.1" units="dimensionless" constant="true"/>
<parameter id="Vh" name="Vh" value="0.1" units="dimensionless" constant="true"/>
<parameter id="h" name="h" value="0.1" units="dimensionless" constant="true"/>
<parameter id="Vmm" name="Vmm" value="0.1" units="dimensionless" constant="true"/>
<parameter id="Km" name="Km" value="0.1" units="dimensionless" constant="true"/>
<parameter id="v1" name="v1" value="0.1" units="dimensionless" constant="true"/>
<parameter id="k4" name="k4" value="0.1" units="dimensionless" constant="true"/>
<parameter id="c1" name="c1" value="1" constant="true"/>
<parameter id="Shalve" name="Shalve" value="0.1" constant="true"/>
<parameter id="Vh" name="Vh" value="0.1" constant="true"/>
<parameter id="h" name="h" value="0.1" constant="true"/>
<parameter id="Vmm" name="Vmm" value="0.1" constant="true"/>
<parameter id="Km" name="Km" value="0.1" constant="true"/>
<parameter id="v1" name="v1" value="0.1" constant="true"/>
<parameter id="k4" name="k4" value="0.1" constant="true"/>
</listOfParameters>
<listOfRules>
<assignmentRule variable="t">
Expand Down
9 changes: 0 additions & 9 deletions yaml2sbml/yaml2sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ def _create_parameter(model: sbml.Model, parameter_id: str, value: str = None):
"""
Create a parameter and add it to the given SBML model.
Units are set as dimensionless by default.
Arguments:
model: the SBML model to which the parameter will be added.
parameter_id: the parameter ID
Expand All @@ -287,8 +285,6 @@ def _create_parameter(model: sbml.Model, parameter_id: str, value: str = None):
if value is not None:
k.setValue(float(value))

k.setUnits('dimensionless')


def _read_assignments_block(model: sbml.Model, assignment_list: list):
"""
Expand Down Expand Up @@ -327,7 +323,6 @@ def _create_assignment(model: sbml.Model, assignment_id: str, formula: str):

assignment_parameter.setName(assignment_id)
assignment_parameter.setConstant(False)
assignment_parameter.setUnits('dimensionless')

assignment_rule = model.createAssignmentRule()
assignment_rule.setVariable(assignment_id)
Expand Down Expand Up @@ -417,8 +412,6 @@ def _create_species(model: sbml.Model, species_id: str, initial_amount: str):
"""
Create a species and add it to the SBML model.
Units are set as dimensionless by default.
Arguments:
model: the SBML model to which the species will be added.
species_id: the species ID
Expand All @@ -445,8 +438,6 @@ def _create_species(model: sbml.Model, species_id: str, initial_amount: str):
s.setHasOnlySubstanceUnits(False)
s.setCompartment('Compartment')

s.setSubstanceUnits('dimensionless')

return s


Expand Down

0 comments on commit 4ad4c8c

Please sign in to comment.