-
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
#652[Feature request] Provide compartments as objects #696
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
274a28b
Added class compartment
73cfd2c
Modified cobra.model for cobra.model.compartments
MaxGreil 3bff4bb
Modified cobra.model add_metabolites function for compartments
MaxGreil 1b0b91d
Modified json and yml for new class model.compartments
MaxGreil 3fbb27c
Modified sbml and sbml3 plus test_model for new model.compartments
MaxGreil ecbd37c
Refreshed files with update_pickels, modified model, sbml3, mat
MaxGreil 8584119
fixed some errors for new class compartment in tests
MaxGreil 818abfe
fixed mini.json
MaxGreil 324ffb0
fixed pep8
MaxGreil f3900b1
fixed errors in test_util.py
MaxGreil f9d2b61
fixed errors in test_io.py
MaxGreil 1123475
Test fix for test_io.py
MaxGreil 8e20e26
Next try
MaxGreil 0da69be
Test with latin1
MaxGreil 8ec223c
Merge branch 'devel' into Compartments
MaxGreil ae97bf9
some of the requested changes
MaxGreil a2e8b1e
deleted files
MaxGreil cd35d1d
utf-8 encoding
MaxGreil cdb5afe
Merge branch 'devel' of git://github.com/opencobra/cobrapy into Compa…
MaxGreil 989ba5b
Property compartments
MaxGreil 9dba00e
Setter for compartments
MaxGreil 20833b9
Run update.py for new property compartments
MaxGreil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import absolute_import | ||
|
||
from copy import deepcopy | ||
from cobra.util.util import format_long_string | ||
|
||
from cobra.core.object import Object | ||
|
||
|
||
class Compartment(Object): | ||
"""Compartment is a class for holding information regarding | ||
a compartment in a cobra.Model object | ||
|
||
Parameters | ||
---------- | ||
id : string | ||
An identifier for the compartment | ||
name : string | ||
A human readable name. | ||
""" | ||
def __init__(self, id=None, name=""): | ||
Object.__init__(self, id, name) | ||
|
||
def copy(self): | ||
return deepcopy(self) | ||
|
||
def _repr_html_(self): | ||
return """ | ||
<table> | ||
<tr> | ||
<td><strong>Compartment identifier</strong></td><td>{id}</td> | ||
</tr><tr> | ||
<td><strong>Name</strong></td><td>{name}</td> | ||
</tr><tr> | ||
<td><strong>Memory address</strong></td> | ||
<td>{address}</td> | ||
</tr> | ||
</table>""".format(id=self.id, name=format_long_string(self.name), | ||
address='0x0%x' % id(self)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces should probably be disallowed as well since we will get problems with optlang otherwise.