-
Notifications
You must be signed in to change notification settings - Fork 218
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
Refactor cobra.Model and cobra.Reaction #311
Comments
I would add:
|
I think we need strike a balance between bloated core classes and scattered code. I see |
so I've been thinking more about context managers and adding together models / reactions / metabolites... It would be great if we could add reactions to a model in a context, and have them removed after the model leaves that context. (Same with metabolites, adding metabolites to reactions, etc.) If this is the behavior we want, we're going to need sets of functions that are exact inverses of eachother: i.e., model.add_reaction, reaction.remove_from_model(), etc. Rather than keeping these scattered across the various classes, I think we should these in a centralized file (cobra.manipulation.addition) or similar. We could define a bunch of methods, In Object.py, we could define We'll keep the existing functions around for compatibility, but we may want to standardize them a bit. (Why, for instance, does |
To continue this discussion how about we for: reactions
metabolites
genes
|
We can probably close this for now, thoughts? |
Yup agree, whatever is left here should better be made to a more concrete issue, so let's close. |
This is something I'd like to get to eventually. Hopefully we could keep these classes relatively clean and put a lot of the implementation in other files.
Some candidates to move:
Reaction.build_reaction_string
,Reaction.build_reaction_from_string
These could easily go into a cobra/utils/reaction_string.py or something similar.
Model.copy
andReaction.copy
, could go into a utils/copy.pyModel.add_reactions
and similarThese we could put in a cobra/utils/combine.py, and do something like
def add_reaction_to_model
,add_reaction_to_reaction
, etc. If we thought it was worth it, it could then be pretty trivial to add in a bunch more functionality to__add__
, checking the type of the other class and calling the correct routine as appropriate.all the
optlang
stuff 😄 . When/where it makes sense at leastupper_bound
andlower_bound
Note: From cobrapy meeting, lets prioritize where methods can be reused.
The text was updated successfully, but these errors were encountered: