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

WIP: Specification of Timecourses #581

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft

WIP: Specification of Timecourses #581

wants to merge 27 commits into from

Conversation

fbergmann
Copy link
Contributor

@fbergmann fbergmann commented May 22, 2024

This draft PR adds the descriptions from the Time course specification to the release/2.0.0 branch.

preview site is: https://petab--581.org.readthedocs.build/en/581/documentation_data_format.html#timecourses-table

FFroehlich and others added 17 commits March 10, 2023 07:32
* extract all changes from previous

* fixup

* allow hyphens in extension names

* fixup hyphens

* only require one toolbox that implements extension

* specify how to work with multiple PEtab problems

* specify we do not require a quorum number of votes

* allow test cases to be provided by the extension library

* Apply suggestions from code review

Co-authored-by: Daniel Weindl <[email protected]>

Co-authored-by: Daniel Weindl <[email protected]>
PEtab extensions were introduced in #537. We should be able to distinguish there between optional extensions and required extensions, i.e. those that modify the parameter estimation problem as such, and those that just add additional/optional information (e.g. annotations, info for visualization, ...). If some tool does not know about a certain optional extension, it can safely be ignored during import, if it does not know about a required extension, it should fail.

This PR adds a `required` attribute to extensions in the yaml file to indicate whether they are required for the mathematical interpretation of the PEtab problem.

Resolves #544
- remove preequilibrationConditionId
- remove simulationConditionId
- add timecourseID
@dweindl
Copy link
Member

dweindl commented May 23, 2024

Thx Frank.

Maybe #541 and #542 can also be addressed here.

doc/documentation_data_format.rst Outdated Show resolved Hide resolved
doc/documentation_data_format.rst Outdated Show resolved Hide resolved
@dweindl dweindl linked an issue May 30, 2024 that may be closed by this pull request
dweindl and others added 2 commits June 26, 2024 16:00
Previously, the math expression syntax wasn't specified. This was very problematic, because different libraries and programming languages have different names for the same functions, and more importantly, differ in operator precedence.


Co-authored-by: Dilan Pathirana <[email protected]>
Co-authored-by: dilpath <[email protected]>
@dweindl
Copy link
Member

dweindl commented Dec 5, 2024

Resolved merge conflicts.

This needs to be updated to match the new mostly-agreed-upon format in #586

  • changed conditions table
  • changed experiments table
  • add examples from google doc - to be updated to the new format
  • update v2/gfx/petab_scope_and_files.svg: changed names, changed columns, match color of conditions+experiments table
  • v2/gfx/petab_scope_and_files.svg / v2/gfx/petab_files.svg : smaller SBML logo / indicate alternatives

@dweindl dweindl force-pushed the v2_timecourses branch 2 times, most recently from b79293f to 56be96d Compare December 10, 2024 20:14
dweindl added a commit to PEtab-dev/libpetab-python that referenced this pull request Dec 18, 2024
Add basic support for PEtab version 2 experiments (see also PEtab-dev/PEtab#586, and  PEtab-dev/PEtab#581). Follow-up to #334.

Partially supersedes #263, which was started before petab.v1/petab.v2 were introduced and before PEtab-dev/PEtab#586.

* updates the required fields in the measurement table
* updates some validation functions to not expect the old `simulationConditionId`s (but does not do full validation yet)
* extends PEtab v1 up-conversion to create a new experiment table.

---------

Co-authored-by: Dilan Pathirana <[email protected]>

We distinguish between three types of entities:

* Entities that are defined in terms of a time-derivative, e.g., the targets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Entities that are defined in terms of a time-derivative, e.g., the targets
* **Differential Targets**: Entities that are defined in terms of a time-derivative, e.g., the targets

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same below


* Entities that are defined in terms of a time-derivative, e.g., the targets
of SBML rate rules or non-constant species participating in reactions.
Referred to as `differential targets` below.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Referred to as `differential targets` below.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same below

+--------------+------------------+------------------+-----------------+--------------------+
| conditionId1 | conditionName1 | modelEntityId1 | setCurrentValue | 0.42 |
+--------------+------------------+------------------+-----------------+--------------------+
| conditionId1 | conditionName1 | modelEntityId2 | | 0.42 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to below, operationType is required

+--------------+------------------+------------------+-----------------+--------------------+
| conditionId1 | conditionName1 | modelEntityId2 | | 0.42 |
+--------------+------------------+------------------+-----------------+--------------------+
| conditionId2 | ... | modelEntityId1 | | modelEntityId1 + 3 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing operationType

values as defined in the model).
The target must be a constant target or a differential target.

- ``setRate``: The time-derivative of the target is set to ``targetValue``
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems natural to have an addToCurrentValue as well

in the model. ``-inf`` indicates pre-equilibration (e.g., for drug
treatments, the model would be pre-equilibrated with the no-drug condition).

- ``CONDITION_ID``: Reference to a condition ID in the condition table that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PETAB_ID, REQUIRED, REFERENCES(conditions.conditionID)]

@@ -519,7 +699,7 @@ Additional columns may be added.
Detailed field description
~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``parameterId`` [STRING, NOT NULL]
- ``parameterId`` [STRING, REQUIRED]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``parameterId`` [STRING, REQUIRED]
- ``parameterId`` [PARAMETER_ID, REQUIRED]


- ``experimentId`` [STRING, REQUIRED]

Identifier of the experiment. The usual PEtab identifier requirements apply.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Identifier of the experiment. The usual PEtab identifier requirements apply.
Identifier of the experiment.

This is specified as a tab-separated value file in the following way:

+---------------------+-------------------+-----------------+
| experimentId | time | conditionId |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree that we can drop the name in the conditions table, I think it would be nice to have an optional name column here.

@@ -757,14 +939,14 @@ The TSV file has two mandatory columns, ``petabEntityId`` and
Detailed field description
~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``petabEntityId`` [STRING, NOT NULL]
- ``petabEntityId`` [STRING, REQUIRED]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``petabEntityId`` [STRING, REQUIRED]
- ``petabEntityId`` [PETAB_ID, REQUIRED]

Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'm happy to review this again after the current feedback round


- A model

- A measurement file to fit the model to [TSV]

- A condition file specifying model inputs and condition-specific parameters
- (optional) A condition file specifying model inputs and condition-specific parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we usually refer to this as the "conditions table"

Suggested change
- (optional) A condition file specifying model inputs and condition-specific parameters
- (optional) A conditions file specifying model inputs and condition-specific parameters

Comment on lines +108 to +111
- ``NON_ESTIMATED_ENTITY_ID``: A string that is a valid PEtab ID and refers
to an entity that has some associated numeric value and is not estimated,
e.g., a model parameter, parameter table parameter, or a species in the
model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``NON_ESTIMATED_ENTITY_ID``: A string that is a valid PEtab ID and refers
to an entity that has some associated numeric value and is not estimated,
e.g., a model parameter, parameter table parameter, or a species in the
model.
- ``NON_ESTIMATED_ENTITY_ID``: A string that is a valid PEtab ID and refers
to an entity that has some associated numeric value (e.g. a model parameter,
parameter table parameter, or a species in the model) and is not estimated.

* Clarification and specification of various previously underspecified aspects
(math expressions, overriding values in the condition table, etc.)
(:ref:`math_expressions`, overriding values in the condition table, etc.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should list everything (explicitly or by some grouping)

Suggested change
(:ref:`math_expressions`, overriding values in the condition table, etc.)
(:ref:`math_expressions`, overriding values in the condition table)

Comment on lines +146 to +150
The conditions table specifies changes to parameters, initial values of species
and compartments for specific simulation conditions. Different conditions can
be combined to form time courses or experiment through the
:ref:`experiments_table`. Any changes applied to the model will remain in
effect until they are changed by a subsequent condition.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The conditions table specifies changes to parameters, initial values of species
and compartments for specific simulation conditions. Different conditions can
be combined to form time courses or experiment through the
:ref:`experiments_table`. Any changes applied to the model will remain in
effect until they are changed by a subsequent condition.
The conditions table specifies changes to parameters, initial or intermediate values of
species, and compartments, during specific time periods. The start and end of the time
period is defined in the :ref:`experiments_table`, where multiple conditions can be
combined to specify time courses or experiments that span multiple time periods. Any
changes applied to the model will remain in effect until they are changed by a condition
applied at a later time period.

| ... | ... | ... | | ... |
+--------------+------------------+------------------+-----------------+--------------------+

Each line specifies a change of one specific property of a specific entity.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each line specifies a change of one specific property of a specific entity.
Each line specifies the change in the numeric value of one specific non-estimated entity.

We distinguish between three types of entities:

* Entities that are defined in terms of a time-derivative, e.g., the targets
of SBML rate rules or non-constant species participating in reactions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of SBML rate rules or non-constant species participating in reactions.
of SBML rate rules or species that change by participating in reactions (educts or products).

Comment on lines +255 to +256
For any conditionId with ``operationType=noChange``, there must not be any
other row with the same ``conditionId`` in the conditions table.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For any conditionId with ``operationType=noChange``, there must not be any
other row with the same ``conditionId`` in the conditions table.
For any ``conditionId`` with ``operationType=noChange``, there must not be any
other row with the same ``conditionId`` in the conditions table.

+---------------------+-------------------+-----------------+
| experimentId | time | conditionId |
+=====================+===================+=================+
| PETAB_ID | NUMERIC or '-inf' | CONDITION_ID |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, in the measurements table it is NUMERIC\|inf instead

Comment on lines +474 to +481
Note: The time interval in which a condition is applied includes the
respective starting timepoint, but excludes the starting timepoint of
the following condition. This means that for an experiment
``[time_A:condition_A; time_B:condition_B]``, ``condition_A`` is active
during the interval ``[time_A, time_B)``. This implies that any event
assignment that triggers at ``time_B`` will occur *after* ``condition_B`` was
applied and for any measurements at ``time_B``, the observables will be
evaluated *after* ``condition_B`` was applied.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the old (not long format) version of the experiments table, so it might be confusing to users

Suggested change
Note: The time interval in which a condition is applied includes the
respective starting timepoint, but excludes the starting timepoint of
the following condition. This means that for an experiment
``[time_A:condition_A; time_B:condition_B]``, ``condition_A`` is active
during the interval ``[time_A, time_B)``. This implies that any event
assignment that triggers at ``time_B`` will occur *after* ``condition_B`` was
applied and for any measurements at ``time_B``, the observables will be
evaluated *after* ``condition_B`` was applied.
Note: The time interval in which a condition is applied includes the
respective starting timepoint, but excludes the starting timepoint of
the following condition. This means that for an experiment where
``condition_A`` is applied at ``time_A`` and later ``condition_B`` is
applied at ``time_B``, then ``condition_A`` is active
during the interval ``[time_A, time_B)``. This implies that any event
assignment that triggers at ``time_B`` will occur *after* ``condition_B`` was
applied and for any measurements at ``time_B``, the observables will be
evaluated *after* ``condition_B`` was applied.

Comment on lines +483 to +487
Multiple conditions can be applied at the same time point by specifying
multiple lines with the same ``experimentId`` and ``time`` but different
``conditionId``. The order of the conditions is arbitrary **????**.

**TODO** how to deal with conflicts?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion based on previous conversations, not sure how to word it best though

Suggested change
Multiple conditions can be applied at the same time point by specifying
multiple lines with the same ``experimentId`` and ``time`` but different
``conditionId``. The order of the conditions is arbitrary **????**.
**TODO** how to deal with conflicts?
Multiple conditions can be applied at the same time point by specifying
multiple lines with the same ``experimentId`` and ``time`` but different
``conditionId``. The order of the conditions is arbitrary.
All changes across all simultaneous conditions are applied in order of
dependencies, with conservation of mass when volumes change, i.e.
a volume change implies a concentration change, but not vice versa.
Hence, volume changes are applied before concentration changes in the
same compartment, and changes to parameters are applied before
changes to species that depend on the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants