-
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
Add groups feature #543
Comments
I don't think a full-fledged solution would be that hard to code up. a Group would just be a A while back I played around with a metabolite group summary. Essentially ignore flows within the group, just look at how fluxes enter/exit. So I could certainly revive that with a I would expect the harder problems would be syncing it across the |
In my view of the hierarchy I would do two three things:
|
Okay, you convinced me 😄 @Midnighter Your suggestion looks good to me. Maybe the groups attribute on metabolites etc. should just be ids (strings) to not create unwanted references to Model. @pstjohn Seems like a good idea to me that the groups feature should be its own object since you could add useful methods to it like |
@Midnighter the pickle format is not backwards compatible as it is for now. You can not unpickle cobra 0.5 models in 0.6 for instance since they have different attributes and methods. JSON and SBMl should be straight forward. |
The SBML import export of groups (subsystems) is straight-forward. As soon as someone implements the groups on |
Hi, |
Unfortunately, not yet. With a better SBML parser in the works, compartment classes imminent, I can definitely see these coming soon, though. We will prioritize cobrapy development in our group for all of August so latest then, unless you want to take a stab at it? :) |
If Silvia is not interested in implementing it, I would be happy to try. To restate the to-dos that have been discussed so far, just for my own understanding:
Based on this summary, I have a few questions:
Also, considering the Thoughts? |
sorry for my MIA, |
Having spent some time now with the new API I would retract my concerns about the references to model. Groups are always defined in the context of a model so it makes sense they have a reference to it. We did have a lot of bugs/problems recently related to some properties similar to that of groups that were mostly caused by having the same information in several places (for instance with reactions and compartments). So it would rather argue for having a "single source of truth" now. This means that the assignment into groups should only happen once, for instance in |
I very much agree with a single source of truth. Also, SBML defines groups as having a list of members whereas the group information is not defined at all on the reaction. This brings up the argument again of do we need def get_associated_groups(self, element):
return [g for g in self.groups if element in g] |
So it sounds like the optimal solution is a new Let me know if I missed anything, otherwise I will get to work on a solution. |
Sounds about right. Initially I wanted to recommend making the class |
I will write the SBML groups import and export for this. Just let me know
when there is a semi-stable version of this feature, i.e. the Group class.
…On Tue, Jul 10, 2018 at 8:13 PM Moritz E. Beber ***@***.***> wrote:
Sounds about right. Initially I wanted to recommend making the class Group
inherit from set but groups can be elements of other groups and sets are
unhashable so they can not be members of other sets. I guess an attribute
members which is a set would do the trick. Other than that I would try to
keep the Group class rather sparse and only implement the minimum
interface to satisfy the SBML requirements.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#543 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA29umeni5dKFc6yhCu7W-n3pKsPzUY6ks5uFO7TgaJpZM4OTQYC>
.
--
Matthias König, PhD.
Junior Group Leader LiSyM - Systems Medicine of the Liver
Humboldt Universität zu Berlin, Institute of Biology, Institute for
Theoretical Biology
https://livermetabolism.com
[email protected]
https://twitter.com/konigmatt
https://github.com/matthiaskoenig
Tel: +49 30 2093 98435
|
@gregmedlock's proposal looks good to me. I would like some utility methods to get groups across a species type and group name as a pandas DataFrame. For instance getting the subsystem for all reactions which was one of the initial motivations to implement this feature. |
@gregmedlock How's your progress on this so far? I'd like to help this along however I can in the coming weeks, but I also don't want to step on your toes if you've already started with it. Could you give me a quick update on where you're at? |
My plan is to spend next week on it, start to finish, although I see @Midnighter has assigned it to @AlbaLopez. If next week is too late I am happy to let anyone else take the reins. |
Hi Greg, |
No worries at all, a month is a long time to leave the issue hanging with no update! Will make the PR as soon as it's ready. |
@cdiener for the utility function, would returning a dataframe of booleans with element id's as rownames (genes, reactions, metabolites) and group id's as column names meet your desired use cases? The function would just take any list of metabolites, reactions, and/or genes, e.g. reaction_group_associations = model.get_group_associations(model.reactions) Second question... would |
I'm definitely in favor of becoming a little more function-oriented and not to tack on every method to the model class. |
The new libsbml parser reads and writes groups (and subsystem information). |
Feature description
Allow cobrapy objects to be annotated with groups like the legacy
subsystem
. This is supposed to increase compatibility with SBML groups.Possible API
Add a groups attribute to metabolites, reactions and genes that can be used to store arbitrary grouping attributes. Could be a lightweight object or list. Example:
The SBML interface would read and write the groups.
or to support the
kind
attributeProblems
SBML groups allows nested groups like (group1, species1, species2). This is not compatible with the current cobrapy API that assigns groups as properties onto metabolites, reactions or genes. However, building a full fledged group system like
model.groups
would be hard to maintain since one has to sync those with the context manager and model modifications which is not necessary in the proposed API. However, to use it like that we would have to ignore all nested groups since SBML specifically prohibits flattening of the group hierarchy:The text was updated successfully, but these errors were encountered: