Skip to content

Conversation

@JR-1991
Copy link
Member

@JR-1991 JR-1991 commented Oct 9, 2025

As mentioned in #86, the current implementation disregards species that are not explicitly included in either a reaction scheme or an ODE but are part of either a kinetic law or an ODE equation. For instance, as illustrated in the PGM-ENO dataset, the protein concentration prot01 is not explicitly modeled in a reaction scheme but is part of the kinetic law. Therefore, it should not be removed because it is an integral part of the system. Discarding it results in undefined behavior, as documented in #86.

This pull request enhances the logic for filtering species in EnzymeML documents to ensure that all species referenced in equations, whether in ODEs, assignments, initial assignments, or kinetic laws, are retained, even if they are not directly involved in reactions. Additionally, new and more comprehensive tests have been added to validate this behavior. Minor improvements to unit tests for CSV import are also included.

Filtering logic improvements:

  • Updated the _remove_unmodeled_species method in base.py to collect all species referenced in any equation (ODE, assignment, initial assignment, kinetic law) and ensure these are not removed from the document, using symbolic analysis via sympy. Also added a helper method _get_all_species to retrieve all species IDs. [1] [2] [3] [4]

Testing enhancements:

  • Added multiple new tests to test_thinlayer.py that verify species referenced in equations (but not in reactions or ODEs) are correctly retained after filtering. These cover ODE, assignment, initial assignment, and kinetic law scenarios, and use a new species exclusively referenced in equations.
  • Updated the species IDs in the test document creation to match new test scenarios.
  • Minor import fix in test_thinlayer.py for completeness.

CSV import test improvements:

  • Added assertions in test_tabular.py to ensure that data units are present and correct for imported species measurements. [1] [2]

Closes issues


This change is Reviewable

Additional assertions verify that data_unit is not None for species_data[0] and species_data[1] in TestTabularImport, improving test coverage for unit presence.
Updates BaseThinLayer to retain species that are referenced in ODE, assignment, initial assignment, and kinetic law equations, even if they are not part of reactions or defined as ODEs. Adds tests to verify that such species are not removed during optimization.
@JR-1991 JR-1991 self-assigned this Oct 9, 2025
@JR-1991 JR-1991 added this to EnzymeML Oct 9, 2025
@JR-1991 JR-1991 added the bug Something isn't working label Oct 9, 2025
@JR-1991 JR-1991 linked an issue Oct 9, 2025 that may be closed by this pull request
@JR-1991 JR-1991 moved this to QA in EnzymeML Oct 9, 2025
@jmrohwer
Copy link
Member

Still does not work, see discussion in #86.

Improves species value assignment in InitMap by checking for both '<species>_init' and '<species>' attributes in the model, raising an error if neither is found. Also updates import order and minor formatting for consistency.
@JR-1991 JR-1991 marked this pull request as ready for review October 14, 2025 11:01
@JR-1991 JR-1991 merged commit f64d1fc into main Oct 14, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from QA to Done in EnzymeML Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ThinLayerPysces: proteins not updated during simulation

3 participants