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

GPR rules of split reactions are not selected properly #33

Open
voidsailor opened this issue Feb 26, 2025 · 0 comments
Open

GPR rules of split reactions are not selected properly #33

voidsailor opened this issue Feb 26, 2025 · 0 comments

Comments

@voidsailor
Copy link
Contributor

Hello again @Paulocracy :),

the problem from issue #12 is still present.

In create_smoment_model_reaction_wise, reactions are split if they have measured isoenzymes. The GPR rule of the original reaction is distributed accordingly among the new reactions and split GPR rules are stored in the dict "reaction_id_gene_rules_mapping". This dict uses the ids of the split reactions, e.g. "PCFLOPm_GPRSPLIT_1", as keys and a corresponding GPR rule as value.

Subsequently, in the main loop, pseudo metabolites should be added to every reaction. At the beginning of the loop, the reaction ids are split by "_GPRSPLIT_" yielding the id of the original reaction (i.e., "PCFLOPm") and overwriting the reaction name of the split reaction ("PCFLOPm_GPRSPLIT_1"):

for model_reaction_id in model_reaction_ids:
# Get the reaction and split the ID at the ID addition
reaction = model.reactions.get_by_id(model_reaction_id)
splitted_id = reaction.id.split(id_addition)
# If the reaction has no name, ignore it
if splitted_id[0] == "":
continue
# Take the reaction ID from the first part of the split
reaction_id = splitted_id[0]
# Remove GPRSPLIT name addition from reactions with measured protein concentrations
if "_GPRSPLIT_" in reaction_id:
reaction_id = reaction_id.split("_GPRSPLIT_")[0]
# If the reaction has no associated enzyme stoichiometries, ignore it
if reaction_id not in list(reaction_id_gene_rules_mapping.keys()):
continue
# If the reaction has no gene rule, ignore it
gene_rule = reaction_id_gene_rules_mapping[reaction_id]
if gene_rule == [""]:
continue
# If the reaction is manually excluded, ignore it

Later, the GPR rule of the split reaction is retrieved from the "reaction_id_gene_rules_mapping" dict but using the original reaction id instead of the id of the split reaction resulting in the same and incorrect pseudo metabolites being assigned to the split reactions.

I'll create a pull request later :)

(Sorry for spamming you with issues, I'm working my way through autoPACMEN for another project :D)

Paulocracy added a commit that referenced this issue Feb 28, 2025
bugfix where pseudo metabolites where not assigned correctly (#12, #33), guard for complex GPR rules (#32)
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

No branches or pull requests

1 participant