Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remove unit assignments #136

Merged
merged 6 commits into from
Jul 29, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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