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
3 changes: 3 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0018/0018.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
`A` is reinitialized to the value in the condition table after
preequilibration, `B` is not updated.

This test is a more tricky version of test 0029, which also includes a
non-zero simulation start time without a preequilibration condition.

## Model

A simple conversion reaction `A <=> B` in a single compartment, following
Expand Down
3 changes: 3 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0018/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ For preequilibration, species `B` is initialized with `0`. For simulation,
`A` is reinitialized to the value in the condition table after
preequilibration, `B` is not updated.

This test is a more tricky version of test 0029, which also includes a
non-zero simulation start time without a preequilibration condition.

## Model

A simple conversion reaction `A <=> B` in a single compartment, following
Expand Down
54 changes: 54 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/0029.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from inspect import cleandoc

from petab.v2.C import *
from petab.v2.core import *
from petab.v2 import Problem
from petabtests import DEFAULT_SBML_FILE, PetabV2TestCase, analytical_a

DESCRIPTION = cleandoc("""
## Objective

This case features a simple test with two data points with a non-zero
simulation start time.

## Model

A simple conversion reaction `A <=> B` in a single compartment, following
mass action kinetics.
""")

# problem --------------------------------------------------------------------
a0 = 1.0
b0 = 1.0
k1 = 0.8
k2 = 0.6

problem = Problem()
problem.add_experiment("e1", 5.0, "")

problem.add_observable("obs_a", "A", noise_formula="1")

problem.add_measurement("obs_a", experiment_id="e1", time=5, measurement=0.01)
problem.add_measurement("obs_a", experiment_id="e1", time=10, measurement=0.1)

problem.add_parameter("k1", lb=0, ub=10, nominal_value=k1, estimate=True)
problem.add_parameter("k2", lb=0, ub=10, nominal_value=k2, estimate=True)

# solutions ------------------------------------------------------------------

simulation_df = problem.measurement_df.copy(deep=True).rename(
columns={MEASUREMENT: SIMULATION}
)
simulation_df[SIMULATION] = [
analytical_a(t=(t - 5.0), a0=a0, b0=b0, k1=k1, k2=k2) for t in simulation_df[TIME]
]


case = PetabV2TestCase.from_problem(
id=29,
problem=problem,
brief="Simulation. Non-zero simulation start time",
description=DESCRIPTION,
model=DEFAULT_SBML_FILE,
simulation_df=simulation_df,
)
11 changes: 11 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PEtab test case 0029

## Objective

This case features a simple test with two data points with a non-zero
simulation start time.

## Model

A simple conversion reaction `A <=> B` in a single compartment, following
mass action kinetics.
14 changes: 14 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_0029.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
condition_files: []
experiment_files:
- _experiments.tsv
format_version: 2.0.0
measurement_files:
- _measurements.tsv
model_files:
model_0:
language: sbml
location: _model.xml
observable_files:
- _observables.tsv
parameter_files:
- _parameters.tsv
7 changes: 7 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_0029_solution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
chi2: 1.55356258735436
llh: -2.61465836008652
simulation_files:
- _simulations.tsv
tol_chi2: 0.001
tol_llh: 0.001
tol_simulations: 0.001
2 changes: 2 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_experiments.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
experimentId time conditionId
e1 5.0
3 changes: 3 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_measurements.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
modelId observableId experimentId time measurement observableParameters noiseParameters
obs_a e1 5.0 0.01
obs_a e1 10.0 0.1
94 changes: 94 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" level="2" version="4">
<model id="conversion_reaction_0" name="Conversion Reaction 0">

<listOfUnitDefinitions>
<unitDefinition id="volume" name="volume">
<listOfUnits>
<unit kind="litre" exponent="1" scale="-3" multiplier="1"/>
</listOfUnits>
</unitDefinition>
<unitDefinition id="substance" name="substance">
<listOfUnits>
<unit kind="mole" exponent="1" scale="-3" multiplier="1"/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>

<listOfCompartments>
<compartment id="compartment" name="compartment" spatialDimensions="3" size="1" constant="true">
</compartment>
</listOfCompartments>

<listOfSpecies>
<species id="A" name="A" compartment="compartment" initialConcentration="2" boundaryCondition="false" constant="false">
</species>
<species id="B" name="B" compartment="compartment" initialConcentration="2" boundaryCondition="false" constant="false">
</species>
</listOfSpecies>

<listOfParameters>
<parameter id="a0" name="a0" value="1" constant="true">
</parameter>
<parameter id="b0" name="b0" value="1" constant="true">
</parameter>
<parameter id="k1" name="k1" value="0" constant="true">
</parameter>
<parameter id="k2" name="k2" value="0" constant="true">
</parameter>
</listOfParameters>

<listOfInitialAssignments>
<initialAssignment symbol="A">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> a0 </ci>
</math>
</initialAssignment>
<initialAssignment symbol="B">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> b0 </ci>
</math>
</initialAssignment>
</listOfInitialAssignments>

<listOfReactions>
<reaction id="fwd" name="fwd" reversible="false">
<listOfReactants>
<speciesReference species="A" stoichiometry="1"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="B" stoichiometry="1"/>
</listOfProducts>
<kineticLaw>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<times/>
<ci> compartment </ci>
<ci> k1 </ci>
<ci> A </ci>
</apply>
</math>
</kineticLaw>
</reaction>
<reaction id="rev" name="rev" reversible="false">
<listOfReactants>
<speciesReference species="B" stoichiometry="1"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="A" stoichiometry="1"/>
</listOfProducts>
<kineticLaw>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<times/>
<ci> compartment </ci>
<ci> k2 </ci>
<ci> B </ci>
</apply>
</math>
</kineticLaw>
</reaction>
</listOfReactions>

</model>
</sbml>
2 changes: 2 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_observables.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
observableId observableName observableFormula noiseFormula noiseDistribution observablePlaceholders noisePlaceholders
obs_a A 1.00000000000000 normal
3 changes: 3 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_parameters.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameterId lowerBound upperBound nominalValue estimate priorDistribution priorParameters
k1 0.0 10.0 0.8 true
k2 0.0 10.0 0.6 true
3 changes: 3 additions & 0 deletions petabtests/cases/v2.0.0/sbml/0029/_simulations.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
modelId observableId experimentId time simulation observableParameters noiseParameters
obs_a e1 5.0 1.0
obs_a e1 10.0 0.8572731259950793
4 changes: 4 additions & 0 deletions petabtests/cases/v2.0.0/sbml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ Simulation. Condition-specific parameters defined via math expressions in the pa

Simulation. None t0 condition applied at time-point without measurements.

# [0029](0029/)

Simulation. Non-zero simulation start time