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

PreProcess class for reactions removal #100

Merged
merged 32 commits into from
Jul 26, 2024

Conversation

SotirisTouliopoulos
Copy link
Contributor

Aim of this PR is to provide a "PreProcess" class to dingo that identifies and removes certain reactions.

This removal is achieved by setting the lower and upper bounds of reactions to 0.

3 types of reactions are identified and removed from the metabolic models:

  1. Blocked
  2. Zero-flux
  3. Metabolically less efficient

The metabolic model given as an input to the "PreProcess" class must be in a cobra format. A list with the removed reactions ids and a reduced dingo model are returned from the "reduce" function of this class.

from cobra.io import load_json_model

cobra_model = load_json_model("ext_data/e_coli_core.json")

obj = PreProcess(cobra_model)

removed_reactions, dingo_model = obj.reduce(extend=0)

In addition, reactions that do not affect the objective function when sequentially knocked-down can be removed from the model.
To perform this additional removal of reactions, the "extend" parameter from the "reduce" function is set to 1.

removed_reactions, dingo_model = obj.reduce(extend=1)

However, this may lead to infesible solutions in large models. When this happens, these reactions are restored to their initial bounds.

This unittest shows how the PreProcess class works with the E.coli core model. It removes 46 reactions with "extend" set to 0 and 47 reactions with "extend" set to 1. An FBA is also called after reactions removal and the value of the objective function is the same, as the initial one.

This new script in the dingo/ directory contains the code for the PreProcess class.

@hariszaf hariszaf assigned hariszaf and unassigned hariszaf Jul 9, 2024
Copy link
Collaborator

@hariszaf hariszaf left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.
It needs to make clear some definitions.
Parts of the code can be simplified.
For the test, are you sure that this is actually the number of each case or is this the number your function returned?

dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
Copy link
Contributor

@vfisikop vfisikop left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Show resolved Hide resolved
tests/preprocess.py Outdated Show resolved Hide resolved
tests/preprocess.py Outdated Show resolved Hide resolved
dingo/preprocess.py Outdated Show resolved Hide resolved
@TolisChal TolisChal merged commit 0c222c4 into GeomScale:develop Jul 26, 2024
1 check passed
@SotirisTouliopoulos SotirisTouliopoulos deleted the preprocess branch July 27, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants