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

[Feature request] Provide compartments as objects like all other model components #652

Open
ChristianLieven opened this issue Jan 19, 2018 · 6 comments · May be fixed by #725
Open

[Feature request] Provide compartments as objects like all other model components #652

ChristianLieven opened this issue Jan 19, 2018 · 6 comments · May be fixed by #725
Assignees

Comments

@ChristianLieven
Copy link
Contributor

Problem description

To future-proof cobrapy it migh make sense to offer compartments not just as a dictionary but as objects like all the other model components. While adding little overhead in terms of performance (the larges model I've seen had 14 compartments), I think this would have a lot of benefits such as allowing users to store information on compartment size (pH, molecular size potentially relevant for ME-model-esque calculations) and compartment-specific annotation (type of compartment, SBO terms, literature reference and whatnot).

Code Sample in Jupyter Notebook

IN[1]: model.compartment.c
OUT[1]: 
"""
Compartment identifier | c
-- | --
Name | Cytosol
Memory address | 0x011c852e90
pH | 6.7
Contains 4 metabolites| pyr_c, g6p_c, g3p_c, f6p_c
"""

IN[2]: model.compartment.c.annotation
OUT[2]: 
{'SBO': 'SBO:0000247',
'ImaginaryCompDB':'SpecificCompIdentifier'}
@Midnighter
Copy link
Member

I fully support the idea but don't really see us implementing it until a cobrapy 1.0 or so.

@pstjohn
Copy link
Contributor

pstjohn commented Jan 22, 2018

The other question would be the degree of compatibility with the various SBML specs... I.e., I don't think they have an annotation field.

Could be nice to have compartment.reactions / compartment.metabolites methods as well.

@matthiaskoenig
Copy link
Contributor

matthiaskoenig commented Jan 23, 2018

Just for clarification:
Compartments are like all other SMBL objects sub classes of SBase. This means they have the same

  • sbo term
  • annotation
  • id
  • metaid
    fields like all other SBML objects, e.g., Species and Reactions.

So completely compatible with Species and Reactions, you can even use the same parser code to read the information for annotations from all the different objects.

Yes, please add compartments as first class cobra citizens. These are very important.

@cdiener
Copy link
Member

cdiener commented Jan 23, 2018

I have no objections. The proposed API looks good to me. So basically model.compartment would be container of lightweight objects (might even be NamedTuples). That would be pretty simple to add. Just have to adjust the JSON and YAML schema as well.

@matthiaskoenig
Copy link
Contributor

Can somebody implement this? This should not be a too big change, but just changing how the compartments are stored (dict of compartment objects instead of dict of compartment strings). Providing all the annotations on the compartments is then just one line of code in the sbml parser. I just need to be able to set

c.annotation

on a compartment object.

@MaxGreil
Copy link
Contributor

I can have a look at this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants