-
Notifications
You must be signed in to change notification settings - Fork 217
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
Make a decision on the behavior of Compartments #760
Comments
Even though it may require slightly more maintenance, I favor With increased consistency across these classes, might it be possible to move a lot of functionality up to the I have to admit that I avoid the context manager entirely, in practice, out of fear that something I am manipulating isn't being reset correctly. I'd be happy to implement context management for Regarding 2., would usability suffer if users needed to handle compartments on their own, e.g. raise an error whenever any action (add reactions/metabolites) attempts to add a metabolite that is not associated with an existing compartment? In this use case, users must point metabolite.compartment to an existing |
I changed the topic to "Make a decision on the behavior of Compartments". The groups feature was already implemented via #543. |
I agree with adding compartments, however, it's quite hard as well. Groups have been added but are not fully supported. We miss (1) context management and (2) support for I/O other than SBML. I have some code that almost completes (2) but still needs work. And I haven't even started (1) for Groups. The same will be true for compartments so it's mostly the complexity of the task impeding progress. |
I have a related use case that supports adopting compartments as a first-class entity. We are trying to use COBRApy as much as we can within our web-based reconstruction tool. This has worked great so far – no need to reimplement I/O, support for standards, mass balance calculations, etc. However, for GUI-directed model editing, users need to be able to add compartments before those compartments are used by any metabolites or reactions. If a user adds a compartment and then downloads their model, COBRApy will throw out the unused compartment and generate a JSON file that doesn't match the database (as of version 0.15.1). This is confusing and potentially leads to data loss (e.g. if the user wants to upload that file again after making edits). Let me know if that makes sense, and if we can help out with sorting it out. To recreate:
[EDIT] Sorry, this might belong here: #652 |
@opencobra/cobrapy-core, @gregmedlock we need to make a design choice on the proposed groups and compartments PRs and I'd love to have everyone's input. My apologies that the issues were not very well specified.
The design choices revolve around the following issues:
DictList
. That means adding metabolites and reactions to the model would have to also manage thecompartments
attribute. They could also be generated on the fly, i.e., be a property that loops over metabolites to generate the compartments. The problem I see with the latter approach is that both groups and compartments are not only containers but can carry important attributes such as annotation. With on the fly generation it is not clear which compartment instance we are adding annotation to. Let me elaborate: Compartments are currently automatically instantiated from a string when a metabolite is created with a compartment value that is a string. So if you generate many metabolites that are then added to a model and the model then builds a set of compartments based on ID, which compartment are we actually annotating? This can more easily be handled in input/output (but would need further code) where compartments can be created first before parsing metabolites but works less well in cases where a user creates new metabolites before adding them to a model.To sum up my opinions:
On (2.) I have a feeling that in order to be consistent we should bite the bullet and add groups as well as compartments as fully managed
DictList
s just like reactions, metabolites, and genes. That means we also have to context manage them. This will be extra work but automatically solve (1.). However, I would like to resolve these PRs as soon as possible so I'm happy to go with a solution that can be implemented more quickly.The text was updated successfully, but these errors were encountered: