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

Possible to add reactions with reagents whose corresponding species are not part of the model #19

Open
willigott opened this issue Apr 9, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@willigott
Copy link
Contributor

When one builds a reaction object and adds reagents to it, one can add this reaction to the model no matter whether the corresponding species exists or not. For example,

import cbmpy as cbm
from cbmpy.CBModel import Reaction, Reagent

mod_name = 'e_coli_core.xml'
model = cbm.CBRead.readSBML3FBC(mod_name)

reagent1 = Reagent("dummy_1", "i_dont_exist", -1.0)
reagent2 = Reagent("dummy_2", "i_dont_exist_either", 1.0)

rea = Reaction("dummy")

rea.addReagent(reagent1)
rea.addReagent(reagent2)

model.addReaction(rea)

print(model.getReaction("dummy").getStoichiometry())
# prints [(-1.0, 'i_dont_exist'), (1.0, 'i_dont_exist_either')]

if model.getSpecies('i_dont_exist') is None:
    print("species does not exist") # this will be printed

This might be confusing as it looks like these species exist but they actually don't.

I guess the easiest would be to add an additional check in addReagent whether reag.getSpecies() already exists in the model and if not either create the species or throw an error (I would prefer the error).

@willigott willigott changed the title Possible to add reactions with reagents that are not part of the model Possible to add reactions with reagents whose corresponding species are not part of the model Apr 9, 2019
@bgoli bgoli self-assigned this Jun 17, 2019
@bgoli bgoli added this to the Release 0.7.24 milestone Jun 17, 2019
@bgoli bgoli removed the enhancement label Jun 17, 2019
@bgoli bgoli modified the milestones: Release 0.7.25, Release 0.8.0 Aug 11, 2019
@bgoli bgoli modified the milestones: Release 0.8.0, Release 0.8.1 Feb 2, 2021
@bgoli bgoli modified the milestones: Release 0.8.1, Release 0.8.2 Jul 21, 2021
@bgoli bgoli modified the milestones: Release 0.8.3, Release 0.8.5 Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants