diff --git a/cobra/__init__.py b/cobra/__init__.py index 57982c0fd..5f065ca2e 100644 --- a/cobra/__init__.py +++ b/cobra/__init__.py @@ -10,7 +10,7 @@ from cobra import flux_analysis, io from cobra.core import ( - DictList, Gene, Metabolite, Model, Object, Reaction, Species) + DictList, Gene, Metabolite, Model, Object, Reaction, Species, Compartment) from cobra.util import show_versions __version__ = "0.13.4" diff --git a/cobra/core/__init__.py b/cobra/core/__init__.py index f23d109a3..3d48fa6a9 100644 --- a/cobra/core/__init__.py +++ b/cobra/core/__init__.py @@ -10,3 +10,4 @@ from cobra.core.reaction import Reaction from cobra.core.solution import Solution, LegacySolution, get_solution from cobra.core.species import Species +from cobra.core.compartment import Compartment diff --git a/cobra/core/compartment.py b/cobra/core/compartment.py new file mode 100644 index 000000000..a53124b4a --- /dev/null +++ b/cobra/core/compartment.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- + +"""Provide a class for compartments.""" + +from __future__ import absolute_import + +from copy import deepcopy +from cobra.util import format_long_string, is_not_sane +from six import string_types + +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=""): + super(Compartment, self).__init__(id=id, name=name) + self._id = None + self.id = id + + def __contains__(self, metabolite): + return metabolite.compartment is self + + def __eq__(self, other): + if self is other: + return True + if isinstance(other, string_types): + return self._id == other + if isinstance(other, Compartment): + return self._id == other.id + else: + return False + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return hash(self._id) + + def copy(self): + return deepcopy(self) + + @property + def id(self): + return self._id + + @id.setter + def id(self, value): + if is_not_sane(value): + raise TypeError("The compartment ID must be a non-empty string") + self._id = value + + def _repr_html_(self): + return """ + + + + + + + + + +
Compartment identifier{id}
Name{name}
Memory address{address}
""".format(id=self.id, name=format_long_string(self.name), + address='0x0%x' % id(self)) diff --git a/cobra/core/metabolite.py b/cobra/core/metabolite.py index 781fd1236..6e05b147c 100644 --- a/cobra/core/metabolite.py +++ b/cobra/core/metabolite.py @@ -12,7 +12,8 @@ from cobra.core.formula import elements_and_molecular_weights from cobra.core.species import Species from cobra.util.solver import check_solver_status -from cobra.util.util import format_long_string +from cobra.util.util import format_long_string, is_not_sane +from cobra.core.compartment import Compartment # Numbers are not required because of the |(?=[A-Z])? block. See the @@ -35,8 +36,8 @@ class Metabolite(Species): A human readable name. charge : float The charge number of the metabolite - compartment: str or None - Compartment of the metabolite. + compartment: cobra.Compartment, str or None + Compartment or compartment ID that the the metabolite is in. """ def __init__(self, id=None, formula=None, name="", @@ -44,6 +45,7 @@ def __init__(self, id=None, formula=None, name="", Species.__init__(self, id, name) self.formula = formula # because in a Model a metabolite may participate in multiple Reactions + self._compartment = None self.compartment = compartment self.charge = charge @@ -58,6 +60,28 @@ def _set_id_with_model(self, value): self._id = value self.model.metabolites._generate_index() + @property + def compartment(self): + return self._compartment + + @compartment.setter + def compartment(self, value): + if value is None: + self._compartment = None + elif isinstance(value, Compartment): + if self._model and value.id in self._model.compartments: + self._compartment = \ + self._model.compartments.get_by_id(value.id) + else: + self._compartment = value + elif not is_not_sane(value): + if self._model and value in self._model.compartments: + self._compartment = self._model.compartments.get_by_id(value) + else: + self._compartment = Compartment(value) + else: + raise TypeError("The compartment ID must be a non-empty string") + @property def constraint(self): """Get the constraints associated with this metabolite from the solve diff --git a/cobra/core/model.py b/cobra/core/model.py index 4a8e30c07..156db7afa 100644 --- a/cobra/core/model.py +++ b/cobra/core/model.py @@ -22,7 +22,7 @@ from cobra.util.solver import ( get_solver_name, interface_to_str, set_objective, solvers, add_cons_vars_to_problem, remove_cons_vars_from_problem, assert_optimal) -from cobra.util.util import AutoVivification, format_long_string +from cobra.util.util import AutoVivification, format_long_string, is_not_sane from cobra.medium import find_boundary_types LOGGER = logging.getLogger(__name__) @@ -91,7 +91,7 @@ def __init__(self, id_or_model=None, name=None): self.reactions = DictList() # A list of cobra.Reactions self.metabolites = DictList() # A list of cobra.Metabolites # genes based on their ids {Gene.id: Gene} - self._compartments = dict() + self._compartments = DictList() # A list of cobra.Compartments self._contexts = [] # from cameo ... @@ -162,31 +162,36 @@ def get_metabolite_compartments(self): return {met.compartment for met in self.metabolites if met.compartment is not None} - @property - def compartments(self): - return {met.compartment: self._compartments.get(met.compartment, '') - for met in self.metabolites if met.compartment is not None} + def get_metabolites_in_compartment(self, compartment): + """ + Return all metabolites in a specific compartment. - @compartments.setter - def compartments(self, value): - """Get or set the dictionary of current compartment descriptions. + Parameters: + ----------- + compartment : Either a `cobra.core.Compartment` object or a string + matching the ID of a compartment associated with the cobra.Model. - Assigning a dictionary to this property updates the model's - dictionary of compartment descriptions with the new values. + """ + if isinstance(compartment, string_types): + return {m for m in self.metabolites if + m.compartment.id == compartment} + else: + return {m for m in self.metabolites if + m.compartment is compartment} - Parameters - ---------- - value : dict - Dictionary mapping compartments abbreviations to full names. + @property + def compartments(self): + for met in self.metabolites: + if met.compartment is not None: + try: + self._compartments.append(met.compartment) + except Exception: + pass + return self._compartments - Examples - -------- - >>> import cobra.test - >>> model = cobra.test.create_test_model("textbook") - >>> model.compartments = {'c': 'the cytosol'} - {'c': 'the cytosol', 'e': 'extracellular'} - """ - self._compartments.update(value) + @compartments.setter + def compartments(self, compartments): + self._compartments = compartments @property def medium(self): @@ -330,12 +335,47 @@ def copy(self): except Exception: # pragma: no cover new._solver = copy(self.solver) # pragma: no cover + try: + new.compartments = self.compartments + except Exception: + pass + # it doesn't make sense to retain the context of a copied model so # assign a new empty context new._contexts = list() return new + def add_compartments(self, compartment_list): + """ + Will add a list of compartments to the model object. + + The change is reverted upon exit when using the model as a context. + + Parameters + ---------- + compartment_list : list + A list with `cobra.Compartment` objects as elements. + + """ + if not hasattr(compartment_list, '__iter__'): + compartment_list = [compartment_list] + if len(compartment_list) == 0: + return None + + # First check whether the compartments exist in the model + compartment_list = [x for x in compartment_list + if x not in self.compartments] + + self._compartments += compartment_list + + context = get_context(self) + if context: + context(partial(self._compartments.__isub__, compartment_list)) + for x in compartment_list: + # Do we care? + context(partial(setattr, x, '_model', None)) + def add_metabolites(self, metabolite_list): """Will add a list of metabolites to the model object and add new constraints accordingly. @@ -357,12 +397,29 @@ def add_metabolites(self, metabolite_list): if x.id not in self.metabolites] bad_ids = [m for m in metabolite_list - if not isinstance(m.id, string_types) or len(m.id) < 1] + if is_not_sane(m.id)] if len(bad_ids) != 0: raise ValueError('invalid identifiers in {}'.format(repr(bad_ids))) - for x in metabolite_list: - x._model = self + for m in metabolite_list: + # Link up metabolite to model. + m._model = self + # Ignore if the metabolite has no compartment assignment at all. + if m.compartment is None: + continue + # If a compartment with this ID already exists in the model .. + if m.compartment.id in self.compartments: + # .. then re-trigger the metabolite.compartment.setter to now + # assign metabolite to this specific compartment. + LOGGER.warning("The compartment {} of metabolite {} has been " + "replaced with a compartment which already " + "exists in the model the ID of which is " + "identical".format(m.compartment, m.id)) + m.compartment = m.compartment.id + # Else, safely add the new compartment to the the central + # list of compartments. + else: + self.add_compartments([m.compartment]) self.metabolites += metabolite_list # from cameo ... @@ -382,6 +439,56 @@ def add_metabolites(self, metabolite_list): # Do we care? context(partial(setattr, x, '_model', None)) + def remove_compartments(self, compartment_list, destructive=False): + """ + Removes a list of compartments from the object. + + Be aware that this method does not work with the context manager! + Before removing a non-empty compartment destructively we recommend + storing affected metabolites and compartment for later recovery: + + >>> met_list = model.get_metabolites_in_compartment('x') + >>> backup_compartment = model.compartments.x.copy() + >>> model.remove_compartments([model.compartments.x], destructive=True) + + Parameters + ---------- + compartment_list : list + A list with `cobra.Compartment` objects as elements. + + destructive : bool + If False then the compartment will not be removed if it contains + metabolites. If True the compartment will be removed even if when + it is non-empty. All associated metabolites will then lack a + compartment annotation. + + """ + if not hasattr(compartment_list, '__iter__'): + compartment_list = [compartment_list] + # Ignore compartments that don't exist in the model + compartment_list = [comp for comp in compartment_list + if comp in self.compartments] + for comp in compartment_list: + compartment_mets = self.get_metabolites_in_compartment(comp) + if destructive and compartment_mets: + warn('The compartment {} was not empty. ' + 'It contained {} metabolites which are now ' + 'left without compartment association.' + ''.format(comp.id, len(compartment_mets))) + for met in compartment_mets: + met.compartment = None + self.compartments.remove(comp.id) + continue + elif not destructive and compartment_mets: + raise NameError('The compartment {} is not empty. Removing it ' + 'will leave {} metabolites without ' + 'compartment association. To bypass this ' + 'error invoke this function with ' + 'destructive=True.' + ''.format(comp.id, len(compartment_mets))) + else: + self.compartments.remove(comp.id) + def remove_metabolites(self, metabolite_list, destructive=False): """Remove a list of metabolites from the the object. @@ -403,17 +510,24 @@ def remove_metabolites(self, metabolite_list, destructive=False): # Make sure metabolites exist in model metabolite_list = [x for x in metabolite_list if x.id in self.metabolites] - for x in metabolite_list: - x._model = None + for m in metabolite_list: + m._model = None if not destructive: - for the_reaction in list(x._reaction): - the_coefficient = the_reaction._metabolites[x] - the_reaction.subtract_metabolites({x: the_coefficient}) + for the_reaction in list(m._reaction): + the_coefficient = the_reaction._metabolites[m] + the_reaction.subtract_metabolites({m: the_coefficient}) else: - for x in list(x._reaction): - x.remove_from_model() + for r in list(m._reaction): + r.remove_from_model() + + # Notify the user when removing a metabolite has left a + # compartment empty. + if len(self.get_metabolites_in_compartment(m.compartment)) == 1: + warn("{} is the only metabolite in compartment {}. " + "Removing it has left that compartment empty." + "".format(m.id, m.compartment)) self.metabolites -= metabolite_list @@ -899,6 +1013,7 @@ def repair(self, rebuild_index=True, rebuild_relationships=True): self.reactions._generate_index() self.metabolites._generate_index() self.genes._generate_index() + self._compartments._generate_index() if rebuild_relationships: for met in self.metabolites: met._reaction.clear() @@ -1089,15 +1204,16 @@ def _repr_html_(self): Objective expression {objective} - Compartments + {n_compartments} compartment(s) {compartments} - """.format( + """.format( name=self.id, address='0x0%x' % id(self), num_metabolites=len(self.metabolites), num_reactions=len(self.reactions), objective=format_long_string(str(self.objective.expression), 100), - compartments=", ".join( - v if v else k for k, v in iteritems(self.compartments) - )) + n_compartments=len(self.compartments), + compartments=format_long_string( + ', '.join((r.id + " : " + r.name) for r in self._compartments), + 200)) diff --git a/cobra/io/__init__.py b/cobra/io/__init__.py index fac8edb8f..619bef45d 100644 --- a/cobra/io/__init__.py +++ b/cobra/io/__init__.py @@ -2,11 +2,12 @@ from __future__ import absolute_import +from cobra.io.schemata import MODEL_SCHEMA from cobra.io.dict import (model_from_dict, model_to_dict) from cobra.io.json import ( - to_json, from_json, load_json_model, save_json_model) + to_json, from_json, load_json_model, save_json_model, JSON_SPEC) from cobra.io.yaml import ( - to_yaml, from_yaml, load_yaml_model, save_yaml_model) + to_yaml, from_yaml, load_yaml_model, save_yaml_model, YAML_SPEC) from cobra.io.sbml3 import read_sbml_model, write_sbml_model from cobra.io.sbml import read_legacy_sbml from cobra.io.sbml import write_cobra_model_to_sbml_file as \ diff --git a/cobra/io/dict.py b/cobra/io/dict.py index da4369a8d..874380ae5 100644 --- a/cobra/io/dict.py +++ b/cobra/io/dict.py @@ -8,7 +8,7 @@ from numpy import bool_, float_ from six import iteritems, string_types -from cobra.core import Gene, Metabolite, Model, Reaction +from cobra.core import Gene, Metabolite, Model, Reaction, Compartment from cobra.util.solver import set_objective _REQUIRED_REACTION_ATTRIBUTES = [ @@ -44,11 +44,17 @@ "annotation": {}, } -_ORDERED_OPTIONAL_MODEL_KEYS = ["name", "compartments", "notes", "annotation"] +_REQUIRED_COMPARTMENT_ATTRIBUTES = ["id", "name"] +_ORDERED_OPTIONAL_COMPARTMENT_KEYS = ["notes", "annotation"] +_OPTIONAL_COMPARTMENT_ATTRIBUTES = { + "notes": {}, + "annotation": {}, +} + +_ORDERED_OPTIONAL_MODEL_KEYS = ["name", "notes", "annotation"] _OPTIONAL_MODEL_ATTRIBUTES = { "name": None, # "description": None, should not actually be included - "compartments": [], "notes": {}, "annotation": {}, } @@ -70,6 +76,8 @@ def _fix_type(value): # handle legacy Formula type if value.__class__.__name__ == "Formula": return str(value) + if value.__class__.__name__ == "Compartment": + return value.id if value is None: return "" return value @@ -118,6 +126,28 @@ def gene_from_dict(gene): return new_gene +def compartment_to_dict(compartment): + new_compartment = OrderedDict() + for key in _REQUIRED_COMPARTMENT_ATTRIBUTES: + new_compartment[key] = _fix_type(getattr(compartment, key)) + _update_optional(compartment, new_compartment, + _OPTIONAL_COMPARTMENT_ATTRIBUTES, + _ORDERED_OPTIONAL_COMPARTMENT_KEYS) + return new_compartment + + +def compartment_from_dict(compartment): + # Backwards compatibility support for the old schema + if "id" not in compartment: + id, name = next(iteritems(compartment)) + return Compartment(id=id, name=name) + else: + new_compartment = Compartment(compartment["id"]) + for k, v in iteritems(compartment): + setattr(new_compartment, k, v) + return new_compartment + + def reaction_to_dict(reaction): new_reaction = OrderedDict() for key in _REQUIRED_REACTION_ATTRIBUTES: @@ -162,9 +192,9 @@ def model_to_dict(model, sort=False): ------- OrderedDict A dictionary with elements, 'genes', 'compartments', 'id', - 'metabolites', 'notes' and 'reactions'; where 'metabolites', 'genes' - and 'metabolites' are in turn lists with dictionaries holding all - attributes to form the corresponding object. + 'metabolites', 'notes' and 'reactions'; where 'metabolites', + 'compartments', 'genes' and 'metabolites' are in turn lists with + dictionaries holding all attributes to form the corresponding object. See Also -------- @@ -174,6 +204,7 @@ def model_to_dict(model, sort=False): obj["metabolites"] = list(map(metabolite_to_dict, model.metabolites)) obj["reactions"] = list(map(reaction_to_dict, model.reactions)) obj["genes"] = list(map(gene_to_dict, model.genes)) + obj["compartments"] = list(map(compartment_to_dict, model.compartments)) obj["id"] = model.id _update_optional(model, obj, _OPTIONAL_MODEL_ATTRIBUTES, _ORDERED_OPTIONAL_MODEL_KEYS) @@ -182,6 +213,7 @@ def model_to_dict(model, sort=False): obj["metabolites"].sort(key=get_id) obj["reactions"].sort(key=get_id) obj["genes"].sort(key=get_id) + obj["compartments"].sort(key=get_id) return obj @@ -211,6 +243,8 @@ def model_from_dict(obj): if 'reactions' not in obj: raise ValueError('Object has no reactions attribute. Cannot load.') model = Model() + model.add_compartments([compartment_from_dict(compartment) for + compartment in obj['compartments'] if compartment]) model.add_metabolites( [metabolite_from_dict(metabolite) for metabolite in obj['metabolites']] ) @@ -225,6 +259,6 @@ def model_from_dict(obj): rxn in objective_reactions} set_objective(model, coefficients) for k, v in iteritems(obj): - if k in {'id', 'name', 'notes', 'compartments', 'annotation'}: + if k in {'id', 'name', 'notes', 'annotation'}: setattr(model, k, v) return model diff --git a/cobra/io/json.py b/cobra/io/json.py index 410f96c20..af6901456 100644 --- a/cobra/io/json.py +++ b/cobra/io/json.py @@ -2,18 +2,32 @@ from __future__ import absolute_import -try: - import simplejson as json -except ImportError: - import json +import json + from six import string_types +import cobra.io.schemata from cobra.io.dict import model_to_dict, model_from_dict + JSON_SPEC = "1" +JSON_FORMAT = { + True: { + "indent": 2, + "separators": (", ", ": "), + "sort_keys": True, + "allow_nan": False + }, + False: { + "separators": (",", ":"), + "sort_keys": False, + "allow_nan": False + } +} + -def to_json(model, sort=False, **kwargs): +def to_json(model, sort=False, pretty=False, **kwargs): """ Return the model as a JSON document. @@ -26,6 +40,10 @@ def to_json(model, sort=False, **kwargs): sort : bool, optional Whether to sort the metabolites, reactions, and genes or maintain the order defined in the model. + pretty : bool, optional + Whether to format the JSON more compactly (default) or in a more + verbose but easier to read fashion. Can be partially overwritten by the + ``kwargs``. Returns ------- @@ -36,10 +54,13 @@ def to_json(model, sort=False, **kwargs): -------- save_json_model : Write directly to a file. json.dumps : Base function. + """ obj = model_to_dict(model, sort=sort) obj[u"version"] = JSON_SPEC - return json.dumps(obj, allow_nan=False, **kwargs) + options = JSON_FORMAT[pretty] + options.update(kwargs) + return json.dumps(obj, **options) def from_json(document): @@ -59,6 +80,7 @@ def from_json(document): See Also -------- load_json_model : Load directly from a file. + """ return model_from_dict(json.loads(document)) @@ -88,25 +110,18 @@ def save_json_model(model, filename, sort=False, pretty=False, **kwargs): -------- to_json : Return a string representation. json.dump : Base function. + """ obj = model_to_dict(model, sort=sort) obj[u"version"] = JSON_SPEC - - if pretty: - dump_opts = { - "indent": 4, "separators": (",", ": "), "sort_keys": True, - "allow_nan": False} - else: - dump_opts = { - "indent": 0, "separators": (",", ":"), "sort_keys": False, - "allow_nan": False} - dump_opts.update(**kwargs) + options = JSON_FORMAT[pretty] + options.update(**kwargs) if isinstance(filename, string_types): with open(filename, "w") as file_handle: - json.dump(obj, file_handle, **dump_opts) + json.dump(obj, file_handle, **options) else: - json.dump(obj, filename, **dump_opts) + json.dump(obj, filename, **options) def load_json_model(filename): @@ -127,116 +142,10 @@ def load_json_model(filename): See Also -------- from_json : Load from a string. + """ if isinstance(filename, string_types): with open(filename, "r") as file_handle: return model_from_dict(json.load(file_handle)) else: return model_from_dict(json.load(filename)) - - -json_schema = { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "COBRA", - "description": "JSON representation of COBRA model", - "type": "object", - "properties": { - "id": {"type": "string"}, - "name": {"type": "string"}, - "description": {"type": "string"}, - "version": { - "type": "integer", - "default": 1, - }, - - "reactions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": {"type": "string"}, - "name": {"type": "string"}, - "metabolites": { - "type": "object", - "patternProperties": { - ".*": {"type": "number"}, - } - }, - "gene_reaction_rule": {"type": "string"}, - "lower_bound": {"type": "number"}, - "upper_bound": {"type": "number"}, - "objective_coefficient": { - "type": "number", - "default": 0, - }, - "variable_kind": { - "type": "string", - "pattern": "integer|continuous", - "default": "continuous" - }, - "subsystem": {"type": "string"}, - "notes": {"type": "object"}, - "annotation": {"type": "object"}, - }, - "required": ["id", "name", "metabolites", "lower_bound", - "upper_bound", "gene_reaction_rule"], - "additionalProperties": False, - } - }, - "metabolites": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": {"type": "string"}, - "name": {"type": "string"}, - "compartment": { - "type": "string", - "pattern": "[a-z]{1,2}" - }, - "charge": {"type": "integer"}, - "formula": {"type": "string"}, - "_bound": { - "type": "number", - "default": 0 - }, - "_constraint_sense": { - "type": "string", - "default": "E", - "pattern": "E|L|G", - }, - "notes": {"type": "object"}, - "annotation": {"type": "object"}, - }, - "required": ["id", "name", "compartment"], - "additionalProperties": False, - } - - }, - "genes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": {"type": "string"}, - "name": {"type": "string"}, - "notes": {"type": "object"}, - "annotation": {"type": "object"}, - }, - "required": ["id", "name"], - "additionalProperties": False, - } - - }, - "compartments": { - "type": "object", - "patternProperties": { - "[a-z]{1,2}": {"type": "string"} - } - }, - "notes": {"type": "object"}, - "annotation": {"type": "object"}, - }, - "required": ["id", "reactions", "metabolites", "genes"], - "additionalProperties": False, -} diff --git a/cobra/io/mat.py b/cobra/io/mat.py index 1840d99d9..8bee0b99f 100644 --- a/cobra/io/mat.py +++ b/cobra/io/mat.py @@ -11,7 +11,7 @@ from numpy import array, inf, isinf from six import string_types -from cobra.core import Metabolite, Model, Reaction +from cobra.core import Metabolite, Model, Reaction, Compartment from cobra.util import create_stoichiometric_matrix from cobra.util.solver import set_objective @@ -120,7 +120,8 @@ def create_mat_metabolite_id(model): for met in model.metabolites: if not _get_id_compartment(met.id) and met.compartment: yield '{}[{}]'.format(met.id, - model.compartments[met.compartment].lower()) + model.compartments.get_by_id( + met.compartment).name.lower()) else: yield met.id @@ -204,12 +205,15 @@ def from_mat_struct(mat_struct, model_id=None, inf=inf): new_metabolite.compartment = m['comps'][0, 0][comp_index][0][0] if new_metabolite.compartment not in model.compartments: comp_name = m['compNames'][0, 0][comp_index][0][0] - model.compartments[new_metabolite.compartment] = comp_name + model.add_compartments([ + Compartment(str(new_metabolite.compartment), comp_name)]) else: new_metabolite.compartment = _get_id_compartment(new_metabolite.id) - if new_metabolite.compartment not in model.compartments: - model.compartments[ - new_metabolite.compartment] = new_metabolite.compartment + if new_metabolite.compartment not in model.compartments and \ + new_metabolite.compartment is not None: + model.add_compartments([ + Compartment(str(new_metabolite.compartment), + new_metabolite.compartment)]) try: new_metabolite.name = str(m["metNames"][0, 0][i][0][0]) except (IndexError, ValueError): diff --git a/cobra/io/sbml.py b/cobra/io/sbml.py index cc4d65f0c..5b0c598d5 100644 --- a/cobra/io/sbml.py +++ b/cobra/io/sbml.py @@ -9,7 +9,7 @@ from six import iteritems -from cobra.core import Metabolite, Model, Reaction +from cobra.core import Metabolite, Model, Reaction, Compartment from cobra.util.solver import set_objective try: @@ -123,6 +123,10 @@ def create_cobra_model_from_sbml_file(sbml_filename, old_sbml=False, [(v, k) for k, v in iteritems(compartment_dict)]) cobra_model = Model(sbml_model_id) + # Populate the compartment list - This will be done based on + # cobra.Metabolites in cobra.Reactions in the future. + compartments = [Compartment(k, v) for k, v in iteritems(compartment_dict)] + cobra_model.add_compartments(compartments) metabolites = [] metabolite_dict = {} # Convert sbml_metabolites to cobra.Metabolites @@ -344,9 +348,6 @@ def create_cobra_model_from_sbml_file(sbml_filename, old_sbml=False, # Now, add all of the reactions to the model. cobra_model.id = sbml_model.getId() - # Populate the compartment list - This will be done based on - # cobra.Metabolites in cobra.Reactions in the future. - cobra_model.compartments = compartment_dict cobra_model.add_reactions(cobra_reaction_list) set_objective(cobra_model, coefficients) @@ -460,14 +461,14 @@ def get_libsbml_document(cobra_model, # Add in the common compartment abbreviations. If there are additional # compartments they also need to be added. - if not cobra_model.compartments: - cobra_model.compartments = {'c': 'cytosol', - 'p': 'periplasm', - 'e': 'extracellular'} - for the_key in cobra_model.compartments.keys(): + if len(cobra_model.compartments) == 0: + cobra_model.add_compartments([Compartment('c', 'cytosol'), + Compartment('p', 'periplasm'), + Compartment('e', 'extracellular')]) + for compartment in cobra_model.compartments: sbml_comp = sbml_model.createCompartment() - sbml_comp.setId(the_key) - sbml_comp.setName(cobra_model.compartments[the_key]) + sbml_comp.setId(compartment.id) + sbml_comp.setName(compartment.name) sbml_comp.setSize(1) # Just to get rid of warnings if print_time: @@ -562,7 +563,7 @@ def get_libsbml_document(cobra_model, # they are set to be identical note_dict = the_reaction.notes.copy() if the_reaction.gene_reaction_rule: - note_dict['GENE ASSOCIATION'] = [ + note_dict['GENE_ASSOCIATION'] = [ str(the_reaction.gene_reaction_rule)] if the_reaction.subsystem: note_dict['SUBSYSTEM'] = [str(the_reaction.subsystem)] @@ -657,7 +658,7 @@ def add_sbml_species(sbml_model, cobra_metabolite, note_start_tag, sbml_species.setName(cobra_metabolite.id) if the_compartment is not None: try: - sbml_species.setCompartment(the_compartment) + sbml_species.setCompartment(the_compartment.id) except: warn('metabolite failed: ' + the_id) return cobra_metabolite diff --git a/cobra/io/sbml3.py b/cobra/io/sbml3.py index 8f6e7e808..b388a7146 100644 --- a/cobra/io/sbml3.py +++ b/cobra/io/sbml3.py @@ -13,7 +13,7 @@ from six import iteritems, string_types -from cobra.core import Gene, Metabolite, Model, Reaction +from cobra.core import Gene, Metabolite, Model, Reaction, Compartment from cobra.core.gene import parse_gpr from cobra.manipulation.modify import _renames from cobra.manipulation.validate import check_metabolite_compartment_formula @@ -262,8 +262,8 @@ def parse_xml_into_model(xml, number=float): model = Model(model_id) model.name = xml_model.get("name") - model.compartments = {c.get("id"): c.get("name") for c in - xml_model.findall(COMPARTMENT_XPATH)} + model.add_compartments([Compartment(c.get("id"), c.get("name")) for c + in xml_model.findall(COMPARTMENT_XPATH)]) # add metabolites for species in xml_model.findall(SPECIES_XPATH % 'false'): met = get_attrib(species, "id", require=True) @@ -467,9 +467,9 @@ def create_bound(reaction, bound_type): # add in compartments compartments_list = SubElement(xml_model, "listOfCompartments") compartments = cobra_model.compartments - for compartment, name in iteritems(compartments): - SubElement(compartments_list, "compartment", id=compartment, name=name, - constant="true") + for compartment in compartments: + SubElement(compartments_list, "compartment", id=compartment.id, + name=compartment.name, constant="true") # add in metabolites species_list = SubElement(xml_model, "listOfSpecies") diff --git a/cobra/io/schemata/__init__.py b/cobra/io/schemata/__init__.py new file mode 100644 index 000000000..77d5db991 --- /dev/null +++ b/cobra/io/schemata/__init__.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +"""Provide JSON schemata that can be used for validation.""" + +from __future__ import absolute_import + +import json + +from importlib_resources import open_text + + +with open_text("cobra.io.schemata", "model_schema.json", + encoding="utf-8") as file_handle: + MODEL_SCHEMA = json.load(file_handle) diff --git a/cobra/io/schemata/model_schema.json b/cobra/io/schemata/model_schema.json new file mode 100644 index 000000000..88b15117b --- /dev/null +++ b/cobra/io/schemata/model_schema.json @@ -0,0 +1,114 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "COBRA", + "description": "JSON representation of COBRA model", + "type": "object", + "properties": { + "id": {"type": "string"}, + "name": {"type": "string"}, + "description": {"type": "string"}, + "version": { + "type": "string", + "default": "1" + }, + + "reactions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": {"type": "string"}, + "name": {"type": "string"}, + "metabolites": { + "type": "object", + "patternProperties": { + ".*": {"type": "number"} + } + }, + "gene_reaction_rule": {"type": "string"}, + "lower_bound": {"type": "number"}, + "upper_bound": {"type": "number"}, + "objective_coefficient": { + "type": "number", + "default": 0 + }, + "variable_kind": { + "type": "string", + "pattern": "integer|continuous", + "default": "continuous" + }, + "subsystem": {"type": "string"}, + "notes": {"type": "object"}, + "annotation": {"type": "object"} + }, + "required": ["id", "name", "metabolites", "lower_bound", + "upper_bound", "gene_reaction_rule"], + "additionalProperties": false + } + }, + "metabolites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": {"type": "string"}, + "name": {"type": "string"}, + "compartment": { + "type": "string", + "pattern": "[a-z]{1,2}" + }, + "charge": {"type": "integer"}, + "formula": {"type": "string"}, + "_bound": { + "type": "number", + "default": 0 + }, + "_constraint_sense": { + "type": "string", + "default": "E", + "pattern": "E|L|G" + }, + "notes": {"type": "object"}, + "annotation": {"type": "object"} + }, + "required": ["id", "name", "compartment"], + "additionalProperties": false + } + + }, + "genes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": {"type": "string"}, + "name": {"type": "string"}, + "notes": {"type": "object"}, + "annotation": {"type": "object"} + }, + "required": ["id", "name"], + "additionalProperties": false + } + + }, + "compartments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": {"type": "string"}, + "name": {"type": "string"}, + "notes": {"type": "object"}, + "annotation": {"type": "object"} + }, + "required": ["id", "name"], + "additionalProperties": false + } + + }, + "notes": {"type": "object"}, + "annotation": {"type": "object"} + }, + "required": ["id", "reactions", "metabolites", "genes"], + "additionalProperties": false +} diff --git a/cobra/io/yaml.py b/cobra/io/yaml.py index a31c16608..1b862f5af 100644 --- a/cobra/io/yaml.py +++ b/cobra/io/yaml.py @@ -14,6 +14,7 @@ class MyYAML(YAML): + def dump(self, data, stream=None, **kwargs): inefficient = False if stream is None: diff --git a/cobra/manipulation/modify.py b/cobra/manipulation/modify.py index 1403c413b..555d20179 100644 --- a/cobra/manipulation/modify.py +++ b/cobra/manipulation/modify.py @@ -56,7 +56,8 @@ def escape_ID(cobra_model): for x in chain([cobra_model], cobra_model.metabolites, cobra_model.reactions, - cobra_model.genes): + cobra_model.genes, + cobra_model.compartments): x.id = _escape_str_id(x.id) cobra_model.repair() gene_renamer = _GeneEscaper() diff --git a/cobra/test/data/iJO1366.pickle b/cobra/test/data/iJO1366.pickle index 2e89067fa..3192a560f 100644 Binary files a/cobra/test/data/iJO1366.pickle and b/cobra/test/data/iJO1366.pickle differ diff --git a/cobra/test/data/mini.json b/cobra/test/data/mini.json index 0268e688b..6cbcd6c02 100644 --- a/cobra/test/data/mini.json +++ b/cobra/test/data/mini.json @@ -1,1367 +1,1373 @@ { - "compartments": { - "c": "cytosol", - "e": "extracellular" - }, - "genes": [ - { - "id": "b0755", - "name": "gpmA" - }, - { - "id": "b0875", - "name": "aqpZ" - }, - { - "id": "b1101", - "name": "ptsG" - }, - { - "id": "b1380", - "name": "ldhA" - }, - { - "id": "b1621", - "name": "malX" - }, - { - "annotation": { - "ncbigi": [ - "GI:1208453", - "GI:1652654" - ] - }, - "id": "b1676", - "name": "pykF" - }, - { - "id": "b1723", - "name": "pfkB" - }, - { - "id": "b1773", - "name": "ydjI" - }, - { - "id": "b1779", - "name": "gapA" - }, - { - "id": "b1817", - "name": "manX" - }, - { - "id": "b1818", - "name": "manY" - }, - { - "id": "b1819", - "name": "manZ" - }, - { - "id": "b1854", - "name": "pykA" - }, - { - "id": "b2097", - "name": "fbaB" - }, - { - "id": "b2133", - "name": "dld" - }, - { - "id": "b2415", - "name": "ptsH" - }, - { - "id": "b2416", - "name": "ptsI" - }, - { - "id": "b2417", - "name": "crr" - }, - { - "annotation": { - "ncbigi": "GI:1653839" - }, - "id": "b2779", - "name": "eno" - }, - { - "id": "b2925", - "name": "fbaA" - }, - { - "annotation": { - "ncbigi": "GI:1653609" - }, - "id": "b2926", - "name": "pgk" - }, - { - "id": "b2975", - "name": "glcA" - }, - { - "id": "b2987", - "name": "pitB" - }, - { - "id": "b3493", - "name": "pitA" - }, - { - "id": "b3603", - "name": "lldP" - }, - { - "id": "b3612", - "name": "gpmM" - }, - { - "annotation": { - "ncbigi": [ - "GI:1006614", - "GI:1651919" - ] - }, - "id": "b3916", - "name": "pfkA" - }, - { - "id": "b3919", - "name": "tpiA" - }, - { - "annotation": { - "ncbigi": "GI:1653253" - }, - "id": "b4025", - "name": "pgi" - }, - { - "id": "b4395", - "name": "ytjC" - }, - { - "id": "s0001", - "name": "G_s0001" - } - ], - "id": "mini_textbook", - "metabolites": [ - { - "annotation": { - "bigg.metabolite": "13dpg", - "biocyc": "DPG", - "chebi": [ - "CHEBI:16001", - "CHEBI:1658", - "CHEBI:20189", - "CHEBI:57604", - "CHEBI:11881" - ], - "hmdb": "HMDB01270", - "kegg.compound": "C00236", - "pubchem.substance": "3535", - "reactome": "REACT_29800", - "seed.compound": "cpd00203", - "unipathway.compound": "UPC00236" - }, - "charge": -4, - "compartment": "c", - "formula": "C3H4O10P2", - "id": "13dpg_c", - "name": "3-Phospho-D-glyceroyl phosphate" - }, - { - "annotation": { - "bigg.metabolite": "2pg", - "biocyc": "2-PG", - "chebi": [ - "CHEBI:1267", - "CHEBI:58289", - "CHEBI:17835", - "CHEBI:21028", - "CHEBI:11651", - "CHEBI:12986", - "CHEBI:24344", - "CHEBI:39868" - ], - "hmdb": [ - "HMDB03391", - "HMDB00362" - ], - "kegg.compound": "C00631", - "pubchem.substance": "3904", - "reactome": "REACT_30485", - "seed.compound": "cpd00482", - "unipathway.compound": "UPC00631" - }, - "charge": -3, - "compartment": "c", - "formula": "C3H4O7P", - "id": "2pg_c", - "name": "D-Glycerate 2-phosphate" - }, - { - "annotation": { - "bigg.metabolite": "3pg", - "biocyc": "G3P", - "chebi": [ - "CHEBI:40016", - "CHEBI:58272", - "CHEBI:57998", - "CHEBI:11879", - "CHEBI:1657", - "CHEBI:1659", - "CHEBI:17050", - "CHEBI:21029", - "CHEBI:11882", - "CHEBI:11880", - "CHEBI:12987", - "CHEBI:17794", - "CHEBI:24345" - ], - "hmdb": "HMDB00807", - "kegg.compound": [ - "C00197", - "C00597" - ], - "pubchem.substance": "3497", - "reactome": "REACT_29728", - "seed.compound": "cpd00169", - "unipathway.compound": [ - "UPC00597", - "UPC00197" - ] - }, - "charge": -3, - "compartment": "c", - "formula": "C3H4O7P", - "id": "3pg_c", - "name": "3-Phospho-D-glycerate" - }, - { - "annotation": { - "bigg.metabolite": "adp", - "biocyc": [ - "ADP", - "ADP-GROUP" - ], - "cas": [ - "58-64-0", - "58-64-0" - ], - "chebi": [ - "CHEBI:13222", - "CHEBI:16761", - "CHEBI:2342", - "CHEBI:22244", - "CHEBI:40553", - "CHEBI:456216" - ], - "hmdb": "HMDB01341", - "kegg.compound": "C00008", - "kegg.glycan": "G11113", - "pubchem.substance": "3310", - "reactome": [ - "REACT_190072", - "REACT_481002", - "REACT_211606", - "REACT_429160", - "REACT_29370", - "REACT_196180", - "REACT_113581", - "REACT_113582", - "REACT_114564", - "REACT_114565", - "REACT_429153" - ], - "seed.compound": "cpd00008", - "unipathway.compound": "UPC00008" - }, - "charge": -3, - "compartment": "c", - "formula": "C10H12N5O10P2", - "id": "adp_c", - "name": "ADP" - }, - { - "annotation": { - "bigg.metabolite": "atp", - "biocyc": "ATP", - "cas": [ - "56-65-5", - "56-65-5" - ], - "chebi": [ - "CHEBI:40938", - "CHEBI:15422", - "CHEBI:57299", - "CHEBI:13236", - "CHEBI:10789", - "CHEBI:30616", - "CHEBI:22249", - "CHEBI:10841", - "CHEBI:2359" - ], - "hmdb": "HMDB00538", - "kegg.compound": "C00002", - "kegg.drug": "D08646", - "pubchem.substance": "3304", - "reactome": [ - "REACT_190078", - "REACT_113592", - "REACT_113593", - "REACT_114570", - "REACT_29358", - "REACT_389573", - "REACT_139836", - "REACT_211579" - ], - "seed.compound": "cpd00002", - "unipathway.compound": "UPC00002" - }, - "charge": -4, - "compartment": "c", - "formula": "C10H12N5O13P3", - "id": "atp_c", - "name": "ATP" - }, - { - "annotation": { - "bigg.metabolite": "dhap", - "biocyc": "DIHYDROXY-ACETONE-PHOSPHATE", - "cas": [ - "57-04-5", - "57-04-5" - ], - "chebi": [ - "CHEBI:14341", - "CHEBI:57642", - "CHEBI:14342", - "CHEBI:16108", - "CHEBI:5454", - "CHEBI:24355", - "CHEBI:39571" - ], - "hmdb": [ - "HMDB01473", - "HMDB11735" - ], - "kegg.compound": "C00111", - "pubchem.substance": "3411", - "reactome": [ - "REACT_188451", - "REACT_75970", - "REACT_390404" - ], - "seed.compound": "cpd00095", - "unipathway.compound": "UPC00111" - }, - "charge": -2, - "compartment": "c", - "formula": "C3H5O6P", - "id": "dhap_c", - "name": "Dihydroxyacetone phosphate" - }, - { - "annotation": { - "bigg.metabolite": "f6p", - "biocyc": "FRUCTOSE-6P", - "cas": [ - "643-13-0", - "643-13-0" - ], - "chebi": [ - "CHEBI:57634", - "CHEBI:12352", - "CHEBI:45804", - "CHEBI:61527", - "CHEBI:61553", - "CHEBI:10375", - "CHEBI:16084", - "CHEBI:42378", - "CHEBI:22768" - ], - "hmdb": "HMDB03971", - "kegg.compound": [ - "C05345", - "C00085" - ], - "pubchem.substance": "3385", - "seed.compound": "cpd00072", - "unipathway.compound": [ - "UPC05345", - "UPC00085" - ] - }, - "charge": -2, - "compartment": "c", - "formula": "C6H11O9P", - "id": "f6p_c", - "name": "D-Fructose 6-phosphate" - }, - { - "annotation": { - "bigg.metabolite": "fdp", - "biocyc": "FRUCTOSE-16-DIPHOSPHATE", - "cas": [ - "488-69-7", - "488-69-7" - ], - "chebi": [ - "CHEBI:32968", - "CHEBI:49299", - "CHEBI:42553", - "CHEBI:32966", - "CHEBI:37736", - "CHEBI:28013", - "CHEBI:32967", - "CHEBI:41014", - "CHEBI:22767", - "CHEBI:10374", - "CHEBI:40595", - "CHEBI:40591" - ], - "kegg.compound": [ - "C05378", - "C00354" - ], - "pubchem.substance": "3647", - "seed.compound": "cpd00290", - "unipathway.compound": "UPC00354" - }, - "charge": -4, - "compartment": "c", - "formula": "C6H10O12P2", - "id": "fdp_c", - "name": "D-Fructose 1,6-bisphosphate" - }, - { - "annotation": { - "bigg.metabolite": "g3p", - "cas": [ - "142-10-9", - "142-10-9" - ], - "chebi": [ - "CHEBI:17138", - "CHEBI:14333", - "CHEBI:5446", - "CHEBI:58027" - ], - "hmdb": "HMDB01112", - "kegg.compound": [ - "C00661", - "C00118" - ], - "pubchem.substance": "3930", - "seed.compound": "cpd00102", - "unipathway.compound": [ - "UPC00661", - "UPC00118" - ] - }, - "charge": -2, - "compartment": "c", - "formula": "C3H5O6P", - "id": "g3p_c", - "name": "Glyceraldehyde 3-phosphate" - }, - { - "annotation": { - "bigg.metabolite": "g6p", - "biocyc": [ - "D-glucose-6-phosphate", - "GLC-6-P" - ], - "cas": [ - "56-73-5", - "56-73-5" - ], - "chebi": [ - "CHEBI:10399", - "CHEBI:22797", - "CHEBI:41041", - "CHEBI:17719", - "CHEBI:4170", - "CHEBI:61548", - "CHEBI:58247", - "CHEBI:12375" - ], - "hmdb": [ - "HMDB03498", - "HMDB06793", - "HMDB01401", - "HMDB01549" - ], - "kegg.compound": [ - "C00092", - "C01172" - ], - "pubchem.substance": "3392", - "reactome": "REACT_1629756", - "seed.compound": "cpd00079", - "unipathway.compound": "UPC00092" - }, - "charge": -2, - "compartment": "c", - "formula": "C6H11O9P", - "id": "g6p_c", - "name": "D-Glucose 6-phosphate" - }, - { - "annotation": { - "bigg.metabolite": "glc__D", - "cas": [ - "50-99-7", - "50-99-7" - ], - "kegg.compound": "C00031", - "pubchem.substance": "3333" - }, - "charge": 0, - "compartment": "e", - "formula": "C6H12O6", - "id": "glc__D_e", - "name": "D-Glucose" - }, - { - "annotation": { - "bigg.metabolite": "h2o", - "biocyc": [ - "WATER", - "OH", - "OXONIUM" - ], - "cas": [ - "7732-18-5", - "7732-18-5" - ], - "chebi": [ - "CHEBI:15377", - "CHEBI:13365", - "CHEBI:41979", - "CHEBI:16234", - "CHEBI:36385", - "CHEBI:42857", - "CHEBI:27313", - "CHEBI:44819", - "CHEBI:29373", - "CHEBI:10743", - "CHEBI:5594", - "CHEBI:29356", - "CHEBI:53442", - "CHEBI:29375", - "CHEBI:29374", - "CHEBI:13419", - "CHEBI:43228", - "CHEBI:44292", - "CHEBI:13352", - "CHEBI:41981", - "CHEBI:29412", - "CHEBI:42043", - "CHEBI:33811", - "CHEBI:33813", - "CHEBI:35511", - "CHEBI:5585", - "CHEBI:44641", - "CHEBI:44701" - ], - "hmdb": [ - "HMDB01039", - "HMDB02111" - ], - "kegg.compound": [ - "C01328", - "C00001", - "C18714", - "C18712" - ], - "kegg.drug": [ - "D00001", - "D06322", - "D03703" - ], - "pubchem.substance": "3303", - "reactome": [ - "REACT_947593", - "REACT_189422", - "REACT_141343", - "REACT_113518", - "REACT_1605715", - "REACT_109276", - "REACT_113521", - "REACT_113519", - "REACT_2022884", - "REACT_351603", - "REACT_29356" - ], - "seed.compound": [ - "cpd15275", - "cpd00001" - ], - "unipathway.compound": [ - "UPC00001", - "UPC01328" - ] - }, - "charge": 0, - "compartment": "c", - "formula": "H2O", - "id": "h2o_c", - "name": "H2O" - }, - { - "annotation": { - "bigg.metabolite": "h2o", - "biocyc": [ - "WATER", - "OH", - "OXONIUM" - ], - "cas": [ - "7732-18-5", - "7732-18-5" - ], - "chebi": [ - "CHEBI:15377", - "CHEBI:13365", - "CHEBI:41979", - "CHEBI:16234", - "CHEBI:36385", - "CHEBI:42857", - "CHEBI:27313", - "CHEBI:44819", - "CHEBI:29373", - "CHEBI:10743", - "CHEBI:5594", - "CHEBI:29356", - "CHEBI:53442", - "CHEBI:29375", - "CHEBI:29374", - "CHEBI:13419", - "CHEBI:43228", - "CHEBI:44292", - "CHEBI:13352", - "CHEBI:41981", - "CHEBI:29412", - "CHEBI:42043", - "CHEBI:33811", - "CHEBI:33813", - "CHEBI:35511", - "CHEBI:5585", - "CHEBI:44641", - "CHEBI:44701" - ], - "hmdb": [ - "HMDB01039", - "HMDB02111" - ], - "kegg.compound": [ - "C01328", - "C00001", - "C18714", - "C18712" - ], - "kegg.drug": [ - "D00001", - "D06322", - "D03703" - ], - "pubchem.substance": "3303", - "reactome": [ - "REACT_947593", - "REACT_189422", - "REACT_141343", - "REACT_113518", - "REACT_1605715", - "REACT_109276", - "REACT_113521", - "REACT_113519", - "REACT_2022884", - "REACT_351603", - "REACT_29356" - ], - "seed.compound": [ - "cpd15275", - "cpd00001" - ], - "unipathway.compound": [ - "UPC00001", - "UPC01328" - ] - }, - "charge": 0, - "compartment": "e", - "formula": "H2O", - "id": "h2o_e", - "name": "H2O" - }, - { - "annotation": { - "bigg.metabolite": "h", - "biocyc": "PROTON", - "cas": [ - "12408-02-5", - "12408-02-5" - ], - "chebi": [ - "CHEBI:24636", - "CHEBI:15378", - "CHEBI:10744", - "CHEBI:13357", - "CHEBI:5584" - ], - "kegg.compound": "C00080", - "pubchem.substance": "3380", - "reactome": [ - "REACT_194688", - "REACT_425978", - "REACT_193465", - "REACT_374900", - "REACT_74722", - "REACT_425999", - "REACT_428040", - "REACT_163953", - "REACT_372511", - "REACT_2000349", - "REACT_70106", - "REACT_1470067", - "REACT_113529", - "REACT_425969", - "REACT_428548", - "REACT_156540", - "REACT_1614597", - "REACT_351626", - "REACT_427899" - ], - "seed.compound": "cpd00067", - "unipathway.compound": "UPC00080" - }, - "charge": 1, - "compartment": "c", - "formula": "H", - "id": "h_c", - "name": "H+" - }, - { - "annotation": { - "bigg.metabolite": "h", - "biocyc": "PROTON", - "cas": [ - "12408-02-5", - "12408-02-5" - ], - "chebi": [ - "CHEBI:24636", - "CHEBI:15378", - "CHEBI:10744", - "CHEBI:13357", - "CHEBI:5584" - ], - "kegg.compound": "C00080", - "pubchem.substance": "3380", - "reactome": [ - "REACT_194688", - "REACT_425978", - "REACT_193465", - "REACT_374900", - "REACT_74722", - "REACT_425999", - "REACT_428040", - "REACT_163953", - "REACT_372511", - "REACT_2000349", - "REACT_70106", - "REACT_1470067", - "REACT_113529", - "REACT_425969", - "REACT_428548", - "REACT_156540", - "REACT_1614597", - "REACT_351626", - "REACT_427899" - ], - "seed.compound": "cpd00067", - "unipathway.compound": "UPC00080" - }, - "charge": 1, - "compartment": "e", - "formula": "H", - "id": "h_e", - "name": "H+" - }, - { - "charge": -1, - "compartment": "c", - "formula": "C3H5O3", - "id": "lac__D_c", - "name": "D-Lactate" - }, - { - "charge": -1, - "compartment": "e", - "formula": "C3H5O3", - "id": "lac__D_e", - "name": "D-Lactate" - }, - { - "annotation": { - "bigg.metabolite": "nad", - "biocyc": "NAD", - "cas": [ - "53-84-9", - "53-84-9" - ], - "chebi": [ - "CHEBI:21901", - "CHEBI:7422", - "CHEBI:44214", - "CHEBI:15846", - "CHEBI:13394", - "CHEBI:13393", - "CHEBI:44215", - "CHEBI:13389", - "CHEBI:57540", - "CHEBI:44281" - ], - "hmdb": "HMDB00902", - "kegg.compound": "C00003", - "kegg.drug": "D00002", - "pubchem.substance": "3305", - "reactome": [ - "REACT_192307", - "REACT_29360", - "REACT_427523", - "REACT_194653", - "REACT_113526" - ], - "seed.compound": "cpd00003", - "unipathway.compound": "UPC00003" - }, - "charge": -1, - "compartment": "c", - "formula": "C21H26N7O14P2", - "id": "nad_c", - "name": "Nicotinamide adenine dinucleotide" - }, - { - "annotation": { - "bigg.metabolite": "nadh", - "biocyc": "NADH", - "cas": [ - "58-68-4", - "58-68-4" - ], - "chebi": [ - "CHEBI:13395", - "CHEBI:21902", - "CHEBI:16908", - "CHEBI:7423", - "CHEBI:44216", - "CHEBI:57945", - "CHEBI:13396" - ], - "hmdb": "HMDB01487", - "kegg.compound": "C00004", - "pubchem.substance": "3306", - "reactome": [ - "REACT_192305", - "REACT_73473", - "REACT_194697", - "REACT_29362" - ], - "seed.compound": "cpd00004", - "unipathway.compound": "UPC00004" - }, - "charge": -2, - "compartment": "c", - "formula": "C21H27N7O14P2", - "id": "nadh_c", - "name": "Nicotinamide adenine dinucleotide - reduced" - }, - { - "annotation": { - "bigg.metabolite": "pep", - "biocyc": "PHOSPHO-ENOL-PYRUVATE", - "cas": [ - "138-08-9", - "138-08-9" - ], - "chebi": [ - "CHEBI:44897", - "CHEBI:44894", - "CHEBI:14812", - "CHEBI:8147", - "CHEBI:26055", - "CHEBI:26054", - "CHEBI:58702", - "CHEBI:18021" - ], - "hmdb": "HMDB00263", - "kegg.compound": "C00074", - "pubchem.substance": "3374", - "reactome": [ - "REACT_29492", - "REACT_372364" - ], - "seed.compound": "cpd00061", - "unipathway.compound": "UPC00074" - }, - "charge": -3, - "compartment": "c", - "formula": "C3H2O6P", - "id": "pep_c", - "name": "Phosphoenolpyruvate" - }, - { - "annotation": { - "bigg.metabolite": "pi", - "biocyc": [ - "Pi", - "PHOSPHATE-GROUP", - "CPD0-1421" - ], - "cas": [ - "14265-44-2", - "14265-44-2" - ], - "chebi": [ - "CHEBI:37583", - "CHEBI:7793", - "CHEBI:37585", - "CHEBI:34683", - "CHEBI:14791", - "CHEBI:34855", - "CHEBI:29137", - "CHEBI:29139", - "CHEBI:63036", - "CHEBI:26020", - "CHEBI:39739", - "CHEBI:32597", - "CHEBI:32596", - "CHEBI:43474", - "CHEBI:63051", - "CHEBI:43470", - "CHEBI:9679", - "CHEBI:35433", - "CHEBI:4496", - "CHEBI:45024", - "CHEBI:18367", - "CHEBI:26078", - "CHEBI:39745", - "CHEBI:24838" - ], - "hmdb": "HMDB02142", - "kegg.compound": [ - "C13556", - "C13558", - "C00009" - ], - "kegg.drug": "D05467", - "pubchem.substance": "3311", - "reactome": [ - "REACT_947590", - "REACT_109277", - "REACT_113548", - "REACT_2255331", - "REACT_29372", - "REACT_113550", - "REACT_113551" - ], - "seed.compound": [ - "cpd09464", - "cpd09463", - "cpd00009" - ], - "unipathway.compound": "UPC00009" - }, - "charge": -2, - "compartment": "c", - "formula": "HO4P", - "id": "pi_c", - "name": "Phosphate" - }, - { - "annotation": { - "bigg.metabolite": "pi", - "biocyc": [ - "Pi", - "PHOSPHATE-GROUP", - "CPD0-1421" - ], - "cas": [ - "14265-44-2", - "14265-44-2" - ], - "chebi": [ - "CHEBI:37583", - "CHEBI:7793", - "CHEBI:37585", - "CHEBI:34683", - "CHEBI:14791", - "CHEBI:34855", - "CHEBI:29137", - "CHEBI:29139", - "CHEBI:63036", - "CHEBI:26020", - "CHEBI:39739", - "CHEBI:32597", - "CHEBI:32596", - "CHEBI:43474", - "CHEBI:63051", - "CHEBI:43470", - "CHEBI:9679", - "CHEBI:35433", - "CHEBI:4496", - "CHEBI:45024", - "CHEBI:18367", - "CHEBI:26078", - "CHEBI:39745", - "CHEBI:24838" - ], - "hmdb": "HMDB02142", - "kegg.compound": [ - "C13556", - "C13558", - "C00009" - ], - "kegg.drug": "D05467", - "pubchem.substance": "3311", - "reactome": [ - "REACT_947590", - "REACT_109277", - "REACT_113548", - "REACT_2255331", - "REACT_29372", - "REACT_113550", - "REACT_113551" - ], - "seed.compound": [ - "cpd09464", - "cpd09463", - "cpd00009" - ], - "unipathway.compound": "UPC00009" - }, - "charge": -2, - "compartment": "e", - "formula": "HO4P", - "id": "pi_e", - "name": "Phosphate" - }, - { - "annotation": { - "bigg.metabolite": "pyr", - "biocyc": "PYRUVATE", - "cas": [ - "127-17-3", - "127-17-3" - ], - "chebi": [ - "CHEBI:15361", - "CHEBI:14987", - "CHEBI:8685", - "CHEBI:32816", - "CHEBI:45253", - "CHEBI:26466", - "CHEBI:26462" - ], - "hmdb": "HMDB00243", - "kegg.compound": "C00022", - "lipidmaps": "LMFA01060077", - "pubchem.substance": "3324", - "reactome": [ - "REACT_113557", - "REACT_389680", - "REACT_29398" - ], - "seed.compound": "cpd00020", - "unipathway.compound": "UPC00022" - }, - "charge": -1, - "compartment": "c", - "formula": "C3H3O3", - "id": "pyr_c", - "name": "Pyruvate" - } - ], - "reactions": [ - { - "annotation": { - "bigg.reaction": "ATPM" - }, - "gene_reaction_rule": "", - "id": "ATPM", - "lower_bound": 8.39, - "metabolites": { - "adp_c": 1.0, - "atp_c": -1.0, - "h2o_c": -1.0, - "h_c": 1.0, - "pi_c": 1.0 - }, - "name": "ATP maintenance requirement", - "objective_coefficient": 1.0, - "upper_bound": 1000.0 - }, - { - "gene_reaction_rule": "b3603 or b2975", - "id": "D_LACt2", - "lower_bound": -1000.0, - "metabolites": { - "h_c": 1, - "h_e": -1, - "lac__D_c": 1, - "lac__D_e": -1 - }, - "name": "", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "ENO" - }, - "gene_reaction_rule": "b2779", - "id": "ENO", - "lower_bound": -1000.0, - "metabolites": { - "2pg_c": -1.0, - "h2o_c": 1.0, - "pep_c": 1.0 - }, - "name": "enolase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "SBO": "SBO:0000627", - "bigg.reaction": "glc" - }, - "gene_reaction_rule": "", - "id": "EX_glc__D_e", - "lower_bound": -10.0, - "metabolites": { - "glc__D_e": -1.0 - }, - "name": "D-Glucose exchange", - "upper_bound": 1000.0 - }, - { - "annotation": { - "SBO": "SBO:0000627", - "bigg.reaction": "h" - }, - "gene_reaction_rule": "", - "id": "EX_h_e", - "lower_bound": -1000.0, - "metabolites": { - "h_e": -1.0 - }, - "name": "H+ exchange", - "upper_bound": 1000.0 - }, - { - "gene_reaction_rule": "", - "id": "EX_lac__D_e", - "lower_bound": 0.0, - "metabolites": { - "lac__D_e": -1.0 - }, - "name": "D-lactate exchange", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "FBA" - }, - "gene_reaction_rule": "b1773 or b2097 or b2925", - "id": "FBA", - "lower_bound": -1000.0, - "metabolites": { - "dhap_c": 1.0, - "fdp_c": -1.0, - "g3p_c": 1.0 - }, - "name": "fructose-bisphosphate aldolase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "GAPD" - }, - "gene_reaction_rule": "b1779", - "id": "GAPD", - "lower_bound": -1000.0, - "metabolites": { - "13dpg_c": 1.0, - "g3p_c": -1.0, - "h_c": 1.0, - "nad_c": -1.0, - "nadh_c": 1.0, - "pi_c": -1.0 - }, - "name": "glyceraldehyde-3-phosphate dehydrogenase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "GLCpts" - }, - "gene_reaction_rule": "( b2417 and b1621 and b2415 and b2416 ) or ( b2417 and b1101 and b2415 and b2416 ) or ( b1817 and b1818 and b1819 and b2415 and b2416 )", - "id": "GLCpts", - "lower_bound": 0.0, - "metabolites": { - "g6p_c": 1.0, - "glc__D_e": -1.0, - "pep_c": -1.0, - "pyr_c": 1.0 - }, - "name": "D-glucose transport via PEP:Pyr PTS", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "H2Ot" - }, - "gene_reaction_rule": "b0875 or s0001", - "id": "H2Ot", - "lower_bound": -1000.0, - "metabolites": { - "h2o_c": 1.0, - "h2o_e": -1.0 - }, - "name": "R H2O transport via - diffusion", - "upper_bound": 1000.0 - }, - { - "gene_reaction_rule": "b2133 or b1380", - "id": "LDH_D", - "lower_bound": -1000.0, - "metabolites": { - "h_c": 1.0, - "lac__D_c": -1.0, - "nad_c": -1.0, - "nadh_c": 1.0, - "pyr_c": 1.0 - }, - "name": "D-lactate dehydrogenase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PFK" - }, - "gene_reaction_rule": "b3916 or b1723", - "id": "PFK", - "lower_bound": 0.0, - "metabolites": { - "adp_c": 1.0, - "atp_c": -1.0, - "f6p_c": -1.0, - "fdp_c": 1.0, - "h_c": 1.0 - }, - "name": "phosphofructokinase", - "objective_coefficient": 1.0, - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PGI" - }, - "gene_reaction_rule": "b4025", - "id": "PGI", - "lower_bound": -1000.0, - "metabolites": { - "f6p_c": 1.0, - "g6p_c": -1.0 - }, - "name": "glucose-6-phosphate isomerase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PGK" - }, - "gene_reaction_rule": "b2926", - "id": "PGK", - "lower_bound": -1000.0, - "metabolites": { - "13dpg_c": 1.0, - "3pg_c": -1.0, - "adp_c": 1.0, - "atp_c": -1.0 - }, - "name": "phosphoglycerate kinase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PGM" - }, - "gene_reaction_rule": "b4395 or b3612 or b0755", - "id": "PGM", - "lower_bound": -1000.0, - "metabolites": { - "2pg_c": -1.0, - "3pg_c": 1.0 - }, - "name": "phosphoglycerate mutase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PIt2r" - }, - "gene_reaction_rule": "b2987 or b3493", - "id": "PIt2r", - "lower_bound": -1000.0, - "metabolites": { - "h_c": 1.0, - "h_e": -1.0, - "pi_c": 1.0, - "pi_e": -1.0 - }, - "name": "R phosphate reversible transport via - symport", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "PYK" - }, - "gene_reaction_rule": "b1854 or b1676", - "id": "PYK", - "lower_bound": 0.0, - "metabolites": { - "adp_c": -1.0, - "atp_c": 1.0, - "h_c": -1.0, - "pep_c": -1.0, - "pyr_c": 1.0 - }, - "name": "pyruvate kinase", - "upper_bound": 1000.0 - }, - { - "annotation": { - "bigg.reaction": "TPI" - }, - "gene_reaction_rule": "b3919", - "id": "TPI", - "lower_bound": -1000.0, - "metabolites": { - "dhap_c": -1.0, - "g3p_c": 1.0 - }, - "name": "triose-phosphate isomerase", - "upper_bound": 1000.0 - } - ], - "version": "1" + "compartments": [ + { + "id": "c", + "name": "cytosol" + }, + { + "id": "e", + "name": "extracellular" + } + ], + "genes": [ + { + "id": "b0755", + "name": "gpmA" + }, + { + "id": "b0875", + "name": "aqpZ" + }, + { + "id": "b1101", + "name": "ptsG" + }, + { + "id": "b1380", + "name": "ldhA" + }, + { + "id": "b1621", + "name": "malX" + }, + { + "annotation": { + "ncbigi": [ + "GI:1208453", + "GI:1652654" + ] + }, + "id": "b1676", + "name": "pykF" + }, + { + "id": "b1723", + "name": "pfkB" + }, + { + "id": "b1773", + "name": "ydjI" + }, + { + "id": "b1779", + "name": "gapA" + }, + { + "id": "b1817", + "name": "manX" + }, + { + "id": "b1818", + "name": "manY" + }, + { + "id": "b1819", + "name": "manZ" + }, + { + "id": "b1854", + "name": "pykA" + }, + { + "id": "b2097", + "name": "fbaB" + }, + { + "id": "b2133", + "name": "dld" + }, + { + "id": "b2415", + "name": "ptsH" + }, + { + "id": "b2416", + "name": "ptsI" + }, + { + "id": "b2417", + "name": "crr" + }, + { + "annotation": { + "ncbigi": "GI:1653839" + }, + "id": "b2779", + "name": "eno" + }, + { + "id": "b2925", + "name": "fbaA" + }, + { + "annotation": { + "ncbigi": "GI:1653609" + }, + "id": "b2926", + "name": "pgk" + }, + { + "id": "b2975", + "name": "glcA" + }, + { + "id": "b2987", + "name": "pitB" + }, + { + "id": "b3493", + "name": "pitA" + }, + { + "id": "b3603", + "name": "lldP" + }, + { + "id": "b3612", + "name": "gpmM" + }, + { + "annotation": { + "ncbigi": [ + "GI:1006614", + "GI:1651919" + ] + }, + "id": "b3916", + "name": "pfkA" + }, + { + "id": "b3919", + "name": "tpiA" + }, + { + "annotation": { + "ncbigi": "GI:1653253" + }, + "id": "b4025", + "name": "pgi" + }, + { + "id": "b4395", + "name": "ytjC" + }, + { + "id": "s0001", + "name": "G_s0001" + } + ], + "id": "mini_textbook", + "metabolites": [ + { + "annotation": { + "bigg.metabolite": "13dpg", + "biocyc": "DPG", + "chebi": [ + "CHEBI:16001", + "CHEBI:1658", + "CHEBI:20189", + "CHEBI:57604", + "CHEBI:11881" + ], + "hmdb": "HMDB01270", + "kegg.compound": "C00236", + "pubchem.substance": "3535", + "reactome": "REACT_29800", + "seed.compound": "cpd00203", + "unipathway.compound": "UPC00236" + }, + "charge": -4, + "compartment": "c", + "formula": "C3H4O10P2", + "id": "13dpg_c", + "name": "3-Phospho-D-glyceroyl phosphate" + }, + { + "annotation": { + "bigg.metabolite": "2pg", + "biocyc": "2-PG", + "chebi": [ + "CHEBI:1267", + "CHEBI:58289", + "CHEBI:17835", + "CHEBI:21028", + "CHEBI:11651", + "CHEBI:12986", + "CHEBI:24344", + "CHEBI:39868" + ], + "hmdb": [ + "HMDB03391", + "HMDB00362" + ], + "kegg.compound": "C00631", + "pubchem.substance": "3904", + "reactome": "REACT_30485", + "seed.compound": "cpd00482", + "unipathway.compound": "UPC00631" + }, + "charge": -3, + "compartment": "c", + "formula": "C3H4O7P", + "id": "2pg_c", + "name": "D-Glycerate 2-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "3pg", + "biocyc": "G3P", + "chebi": [ + "CHEBI:40016", + "CHEBI:58272", + "CHEBI:57998", + "CHEBI:11879", + "CHEBI:1657", + "CHEBI:1659", + "CHEBI:17050", + "CHEBI:21029", + "CHEBI:11882", + "CHEBI:11880", + "CHEBI:12987", + "CHEBI:17794", + "CHEBI:24345" + ], + "hmdb": "HMDB00807", + "kegg.compound": [ + "C00197", + "C00597" + ], + "pubchem.substance": "3497", + "reactome": "REACT_29728", + "seed.compound": "cpd00169", + "unipathway.compound": [ + "UPC00597", + "UPC00197" + ] + }, + "charge": -3, + "compartment": "c", + "formula": "C3H4O7P", + "id": "3pg_c", + "name": "3-Phospho-D-glycerate" + }, + { + "annotation": { + "bigg.metabolite": "adp", + "biocyc": [ + "ADP", + "ADP-GROUP" + ], + "cas": [ + "58-64-0", + "58-64-0" + ], + "chebi": [ + "CHEBI:13222", + "CHEBI:16761", + "CHEBI:2342", + "CHEBI:22244", + "CHEBI:40553", + "CHEBI:456216" + ], + "hmdb": "HMDB01341", + "kegg.compound": "C00008", + "kegg.glycan": "G11113", + "pubchem.substance": "3310", + "reactome": [ + "REACT_190072", + "REACT_481002", + "REACT_211606", + "REACT_429160", + "REACT_29370", + "REACT_196180", + "REACT_113581", + "REACT_113582", + "REACT_114564", + "REACT_114565", + "REACT_429153" + ], + "seed.compound": "cpd00008", + "unipathway.compound": "UPC00008" + }, + "charge": -3, + "compartment": "c", + "formula": "C10H12N5O10P2", + "id": "adp_c", + "name": "ADP" + }, + { + "annotation": { + "bigg.metabolite": "atp", + "biocyc": "ATP", + "cas": [ + "56-65-5", + "56-65-5" + ], + "chebi": [ + "CHEBI:40938", + "CHEBI:15422", + "CHEBI:57299", + "CHEBI:13236", + "CHEBI:10789", + "CHEBI:30616", + "CHEBI:22249", + "CHEBI:10841", + "CHEBI:2359" + ], + "hmdb": "HMDB00538", + "kegg.compound": "C00002", + "kegg.drug": "D08646", + "pubchem.substance": "3304", + "reactome": [ + "REACT_190078", + "REACT_113592", + "REACT_113593", + "REACT_114570", + "REACT_29358", + "REACT_389573", + "REACT_139836", + "REACT_211579" + ], + "seed.compound": "cpd00002", + "unipathway.compound": "UPC00002" + }, + "charge": -4, + "compartment": "c", + "formula": "C10H12N5O13P3", + "id": "atp_c", + "name": "ATP" + }, + { + "annotation": { + "bigg.metabolite": "dhap", + "biocyc": "DIHYDROXY-ACETONE-PHOSPHATE", + "cas": [ + "57-04-5", + "57-04-5" + ], + "chebi": [ + "CHEBI:14341", + "CHEBI:57642", + "CHEBI:14342", + "CHEBI:16108", + "CHEBI:5454", + "CHEBI:24355", + "CHEBI:39571" + ], + "hmdb": [ + "HMDB01473", + "HMDB11735" + ], + "kegg.compound": "C00111", + "pubchem.substance": "3411", + "reactome": [ + "REACT_188451", + "REACT_75970", + "REACT_390404" + ], + "seed.compound": "cpd00095", + "unipathway.compound": "UPC00111" + }, + "charge": -2, + "compartment": "c", + "formula": "C3H5O6P", + "id": "dhap_c", + "name": "Dihydroxyacetone phosphate" + }, + { + "annotation": { + "bigg.metabolite": "f6p", + "biocyc": "FRUCTOSE-6P", + "cas": [ + "643-13-0", + "643-13-0" + ], + "chebi": [ + "CHEBI:57634", + "CHEBI:12352", + "CHEBI:45804", + "CHEBI:61527", + "CHEBI:61553", + "CHEBI:10375", + "CHEBI:16084", + "CHEBI:42378", + "CHEBI:22768" + ], + "hmdb": "HMDB03971", + "kegg.compound": [ + "C05345", + "C00085" + ], + "pubchem.substance": "3385", + "seed.compound": "cpd00072", + "unipathway.compound": [ + "UPC05345", + "UPC00085" + ] + }, + "charge": -2, + "compartment": "c", + "formula": "C6H11O9P", + "id": "f6p_c", + "name": "D-Fructose 6-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "fdp", + "biocyc": "FRUCTOSE-16-DIPHOSPHATE", + "cas": [ + "488-69-7", + "488-69-7" + ], + "chebi": [ + "CHEBI:32968", + "CHEBI:49299", + "CHEBI:42553", + "CHEBI:32966", + "CHEBI:37736", + "CHEBI:28013", + "CHEBI:32967", + "CHEBI:41014", + "CHEBI:22767", + "CHEBI:10374", + "CHEBI:40595", + "CHEBI:40591" + ], + "kegg.compound": [ + "C05378", + "C00354" + ], + "pubchem.substance": "3647", + "seed.compound": "cpd00290", + "unipathway.compound": "UPC00354" + }, + "charge": -4, + "compartment": "c", + "formula": "C6H10O12P2", + "id": "fdp_c", + "name": "D-Fructose 1,6-bisphosphate" + }, + { + "annotation": { + "bigg.metabolite": "g3p", + "cas": [ + "142-10-9", + "142-10-9" + ], + "chebi": [ + "CHEBI:17138", + "CHEBI:14333", + "CHEBI:5446", + "CHEBI:58027" + ], + "hmdb": "HMDB01112", + "kegg.compound": [ + "C00661", + "C00118" + ], + "pubchem.substance": "3930", + "seed.compound": "cpd00102", + "unipathway.compound": [ + "UPC00661", + "UPC00118" + ] + }, + "charge": -2, + "compartment": "c", + "formula": "C3H5O6P", + "id": "g3p_c", + "name": "Glyceraldehyde 3-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "g6p", + "biocyc": [ + "D-glucose-6-phosphate", + "GLC-6-P" + ], + "cas": [ + "56-73-5", + "56-73-5" + ], + "chebi": [ + "CHEBI:10399", + "CHEBI:22797", + "CHEBI:41041", + "CHEBI:17719", + "CHEBI:4170", + "CHEBI:61548", + "CHEBI:58247", + "CHEBI:12375" + ], + "hmdb": [ + "HMDB03498", + "HMDB06793", + "HMDB01401", + "HMDB01549" + ], + "kegg.compound": [ + "C00092", + "C01172" + ], + "pubchem.substance": "3392", + "reactome": "REACT_1629756", + "seed.compound": "cpd00079", + "unipathway.compound": "UPC00092" + }, + "charge": -2, + "compartment": "c", + "formula": "C6H11O9P", + "id": "g6p_c", + "name": "D-Glucose 6-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "glc__D", + "cas": [ + "50-99-7", + "50-99-7" + ], + "kegg.compound": "C00031", + "pubchem.substance": "3333" + }, + "charge": 0, + "compartment": "e", + "formula": "C6H12O6", + "id": "glc__D_e", + "name": "D-Glucose" + }, + { + "annotation": { + "bigg.metabolite": "h2o", + "biocyc": [ + "WATER", + "OH", + "OXONIUM" + ], + "cas": [ + "7732-18-5", + "7732-18-5" + ], + "chebi": [ + "CHEBI:15377", + "CHEBI:13365", + "CHEBI:41979", + "CHEBI:16234", + "CHEBI:36385", + "CHEBI:42857", + "CHEBI:27313", + "CHEBI:44819", + "CHEBI:29373", + "CHEBI:10743", + "CHEBI:5594", + "CHEBI:29356", + "CHEBI:53442", + "CHEBI:29375", + "CHEBI:29374", + "CHEBI:13419", + "CHEBI:43228", + "CHEBI:44292", + "CHEBI:13352", + "CHEBI:41981", + "CHEBI:29412", + "CHEBI:42043", + "CHEBI:33811", + "CHEBI:33813", + "CHEBI:35511", + "CHEBI:5585", + "CHEBI:44641", + "CHEBI:44701" + ], + "hmdb": [ + "HMDB01039", + "HMDB02111" + ], + "kegg.compound": [ + "C01328", + "C00001", + "C18714", + "C18712" + ], + "kegg.drug": [ + "D00001", + "D06322", + "D03703" + ], + "pubchem.substance": "3303", + "reactome": [ + "REACT_947593", + "REACT_189422", + "REACT_141343", + "REACT_113518", + "REACT_1605715", + "REACT_109276", + "REACT_113521", + "REACT_113519", + "REACT_2022884", + "REACT_351603", + "REACT_29356" + ], + "seed.compound": [ + "cpd15275", + "cpd00001" + ], + "unipathway.compound": [ + "UPC00001", + "UPC01328" + ] + }, + "charge": 0, + "compartment": "c", + "formula": "H2O", + "id": "h2o_c", + "name": "H2O" + }, + { + "annotation": { + "bigg.metabolite": "h2o", + "biocyc": [ + "WATER", + "OH", + "OXONIUM" + ], + "cas": [ + "7732-18-5", + "7732-18-5" + ], + "chebi": [ + "CHEBI:15377", + "CHEBI:13365", + "CHEBI:41979", + "CHEBI:16234", + "CHEBI:36385", + "CHEBI:42857", + "CHEBI:27313", + "CHEBI:44819", + "CHEBI:29373", + "CHEBI:10743", + "CHEBI:5594", + "CHEBI:29356", + "CHEBI:53442", + "CHEBI:29375", + "CHEBI:29374", + "CHEBI:13419", + "CHEBI:43228", + "CHEBI:44292", + "CHEBI:13352", + "CHEBI:41981", + "CHEBI:29412", + "CHEBI:42043", + "CHEBI:33811", + "CHEBI:33813", + "CHEBI:35511", + "CHEBI:5585", + "CHEBI:44641", + "CHEBI:44701" + ], + "hmdb": [ + "HMDB01039", + "HMDB02111" + ], + "kegg.compound": [ + "C01328", + "C00001", + "C18714", + "C18712" + ], + "kegg.drug": [ + "D00001", + "D06322", + "D03703" + ], + "pubchem.substance": "3303", + "reactome": [ + "REACT_947593", + "REACT_189422", + "REACT_141343", + "REACT_113518", + "REACT_1605715", + "REACT_109276", + "REACT_113521", + "REACT_113519", + "REACT_2022884", + "REACT_351603", + "REACT_29356" + ], + "seed.compound": [ + "cpd15275", + "cpd00001" + ], + "unipathway.compound": [ + "UPC00001", + "UPC01328" + ] + }, + "charge": 0, + "compartment": "e", + "formula": "H2O", + "id": "h2o_e", + "name": "H2O" + }, + { + "annotation": { + "bigg.metabolite": "h", + "biocyc": "PROTON", + "cas": [ + "12408-02-5", + "12408-02-5" + ], + "chebi": [ + "CHEBI:24636", + "CHEBI:15378", + "CHEBI:10744", + "CHEBI:13357", + "CHEBI:5584" + ], + "kegg.compound": "C00080", + "pubchem.substance": "3380", + "reactome": [ + "REACT_194688", + "REACT_425978", + "REACT_193465", + "REACT_374900", + "REACT_74722", + "REACT_425999", + "REACT_428040", + "REACT_163953", + "REACT_372511", + "REACT_2000349", + "REACT_70106", + "REACT_1470067", + "REACT_113529", + "REACT_425969", + "REACT_428548", + "REACT_156540", + "REACT_1614597", + "REACT_351626", + "REACT_427899" + ], + "seed.compound": "cpd00067", + "unipathway.compound": "UPC00080" + }, + "charge": 1, + "compartment": "c", + "formula": "H", + "id": "h_c", + "name": "H+" + }, + { + "annotation": { + "bigg.metabolite": "h", + "biocyc": "PROTON", + "cas": [ + "12408-02-5", + "12408-02-5" + ], + "chebi": [ + "CHEBI:24636", + "CHEBI:15378", + "CHEBI:10744", + "CHEBI:13357", + "CHEBI:5584" + ], + "kegg.compound": "C00080", + "pubchem.substance": "3380", + "reactome": [ + "REACT_194688", + "REACT_425978", + "REACT_193465", + "REACT_374900", + "REACT_74722", + "REACT_425999", + "REACT_428040", + "REACT_163953", + "REACT_372511", + "REACT_2000349", + "REACT_70106", + "REACT_1470067", + "REACT_113529", + "REACT_425969", + "REACT_428548", + "REACT_156540", + "REACT_1614597", + "REACT_351626", + "REACT_427899" + ], + "seed.compound": "cpd00067", + "unipathway.compound": "UPC00080" + }, + "charge": 1, + "compartment": "e", + "formula": "H", + "id": "h_e", + "name": "H+" + }, + { + "charge": -1, + "compartment": "c", + "formula": "C3H5O3", + "id": "lac__D_c", + "name": "D-Lactate" + }, + { + "charge": -1, + "compartment": "e", + "formula": "C3H5O3", + "id": "lac__D_e", + "name": "D-Lactate" + }, + { + "annotation": { + "bigg.metabolite": "nad", + "biocyc": "NAD", + "cas": [ + "53-84-9", + "53-84-9" + ], + "chebi": [ + "CHEBI:21901", + "CHEBI:7422", + "CHEBI:44214", + "CHEBI:15846", + "CHEBI:13394", + "CHEBI:13393", + "CHEBI:44215", + "CHEBI:13389", + "CHEBI:57540", + "CHEBI:44281" + ], + "hmdb": "HMDB00902", + "kegg.compound": "C00003", + "kegg.drug": "D00002", + "pubchem.substance": "3305", + "reactome": [ + "REACT_192307", + "REACT_29360", + "REACT_427523", + "REACT_194653", + "REACT_113526" + ], + "seed.compound": "cpd00003", + "unipathway.compound": "UPC00003" + }, + "charge": -1, + "compartment": "c", + "formula": "C21H26N7O14P2", + "id": "nad_c", + "name": "Nicotinamide adenine dinucleotide" + }, + { + "annotation": { + "bigg.metabolite": "nadh", + "biocyc": "NADH", + "cas": [ + "58-68-4", + "58-68-4" + ], + "chebi": [ + "CHEBI:13395", + "CHEBI:21902", + "CHEBI:16908", + "CHEBI:7423", + "CHEBI:44216", + "CHEBI:57945", + "CHEBI:13396" + ], + "hmdb": "HMDB01487", + "kegg.compound": "C00004", + "pubchem.substance": "3306", + "reactome": [ + "REACT_192305", + "REACT_73473", + "REACT_194697", + "REACT_29362" + ], + "seed.compound": "cpd00004", + "unipathway.compound": "UPC00004" + }, + "charge": -2, + "compartment": "c", + "formula": "C21H27N7O14P2", + "id": "nadh_c", + "name": "Nicotinamide adenine dinucleotide - reduced" + }, + { + "annotation": { + "bigg.metabolite": "pep", + "biocyc": "PHOSPHO-ENOL-PYRUVATE", + "cas": [ + "138-08-9", + "138-08-9" + ], + "chebi": [ + "CHEBI:44897", + "CHEBI:44894", + "CHEBI:14812", + "CHEBI:8147", + "CHEBI:26055", + "CHEBI:26054", + "CHEBI:58702", + "CHEBI:18021" + ], + "hmdb": "HMDB00263", + "kegg.compound": "C00074", + "pubchem.substance": "3374", + "reactome": [ + "REACT_29492", + "REACT_372364" + ], + "seed.compound": "cpd00061", + "unipathway.compound": "UPC00074" + }, + "charge": -3, + "compartment": "c", + "formula": "C3H2O6P", + "id": "pep_c", + "name": "Phosphoenolpyruvate" + }, + { + "annotation": { + "bigg.metabolite": "pi", + "biocyc": [ + "Pi", + "PHOSPHATE-GROUP", + "CPD0-1421" + ], + "cas": [ + "14265-44-2", + "14265-44-2" + ], + "chebi": [ + "CHEBI:37583", + "CHEBI:7793", + "CHEBI:37585", + "CHEBI:34683", + "CHEBI:14791", + "CHEBI:34855", + "CHEBI:29137", + "CHEBI:29139", + "CHEBI:63036", + "CHEBI:26020", + "CHEBI:39739", + "CHEBI:32597", + "CHEBI:32596", + "CHEBI:43474", + "CHEBI:63051", + "CHEBI:43470", + "CHEBI:9679", + "CHEBI:35433", + "CHEBI:4496", + "CHEBI:45024", + "CHEBI:18367", + "CHEBI:26078", + "CHEBI:39745", + "CHEBI:24838" + ], + "hmdb": "HMDB02142", + "kegg.compound": [ + "C13556", + "C13558", + "C00009" + ], + "kegg.drug": "D05467", + "pubchem.substance": "3311", + "reactome": [ + "REACT_947590", + "REACT_109277", + "REACT_113548", + "REACT_2255331", + "REACT_29372", + "REACT_113550", + "REACT_113551" + ], + "seed.compound": [ + "cpd09464", + "cpd09463", + "cpd00009" + ], + "unipathway.compound": "UPC00009" + }, + "charge": -2, + "compartment": "c", + "formula": "HO4P", + "id": "pi_c", + "name": "Phosphate" + }, + { + "annotation": { + "bigg.metabolite": "pi", + "biocyc": [ + "Pi", + "PHOSPHATE-GROUP", + "CPD0-1421" + ], + "cas": [ + "14265-44-2", + "14265-44-2" + ], + "chebi": [ + "CHEBI:37583", + "CHEBI:7793", + "CHEBI:37585", + "CHEBI:34683", + "CHEBI:14791", + "CHEBI:34855", + "CHEBI:29137", + "CHEBI:29139", + "CHEBI:63036", + "CHEBI:26020", + "CHEBI:39739", + "CHEBI:32597", + "CHEBI:32596", + "CHEBI:43474", + "CHEBI:63051", + "CHEBI:43470", + "CHEBI:9679", + "CHEBI:35433", + "CHEBI:4496", + "CHEBI:45024", + "CHEBI:18367", + "CHEBI:26078", + "CHEBI:39745", + "CHEBI:24838" + ], + "hmdb": "HMDB02142", + "kegg.compound": [ + "C13556", + "C13558", + "C00009" + ], + "kegg.drug": "D05467", + "pubchem.substance": "3311", + "reactome": [ + "REACT_947590", + "REACT_109277", + "REACT_113548", + "REACT_2255331", + "REACT_29372", + "REACT_113550", + "REACT_113551" + ], + "seed.compound": [ + "cpd09464", + "cpd09463", + "cpd00009" + ], + "unipathway.compound": "UPC00009" + }, + "charge": -2, + "compartment": "e", + "formula": "HO4P", + "id": "pi_e", + "name": "Phosphate" + }, + { + "annotation": { + "bigg.metabolite": "pyr", + "biocyc": "PYRUVATE", + "cas": [ + "127-17-3", + "127-17-3" + ], + "chebi": [ + "CHEBI:15361", + "CHEBI:14987", + "CHEBI:8685", + "CHEBI:32816", + "CHEBI:45253", + "CHEBI:26466", + "CHEBI:26462" + ], + "hmdb": "HMDB00243", + "kegg.compound": "C00022", + "lipidmaps": "LMFA01060077", + "pubchem.substance": "3324", + "reactome": [ + "REACT_113557", + "REACT_389680", + "REACT_29398" + ], + "seed.compound": "cpd00020", + "unipathway.compound": "UPC00022" + }, + "charge": -1, + "compartment": "c", + "formula": "C3H3O3", + "id": "pyr_c", + "name": "Pyruvate" + } + ], + "reactions": [ + { + "annotation": { + "bigg.reaction": "ATPM" + }, + "gene_reaction_rule": "", + "id": "ATPM", + "lower_bound": 8.39, + "metabolites": { + "adp_c": 1.0, + "atp_c": -1.0, + "h2o_c": -1.0, + "h_c": 1.0, + "pi_c": 1.0 + }, + "name": "ATP maintenance requirement", + "objective_coefficient": 1.0, + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "b3603 or b2975", + "id": "D_LACt2", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1, + "h_e": -1, + "lac__D_c": 1, + "lac__D_e": -1 + }, + "name": "", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "ENO" + }, + "gene_reaction_rule": "b2779", + "id": "ENO", + "lower_bound": -1000.0, + "metabolites": { + "2pg_c": -1.0, + "h2o_c": 1.0, + "pep_c": 1.0 + }, + "name": "enolase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "SBO": "SBO:0000627", + "bigg.reaction": "glc" + }, + "gene_reaction_rule": "", + "id": "EX_glc__D_e", + "lower_bound": -10.0, + "metabolites": { + "glc__D_e": -1.0 + }, + "name": "D-Glucose exchange", + "upper_bound": 1000.0 + }, + { + "annotation": { + "SBO": "SBO:0000627", + "bigg.reaction": "h" + }, + "gene_reaction_rule": "", + "id": "EX_h_e", + "lower_bound": -1000.0, + "metabolites": { + "h_e": -1.0 + }, + "name": "H+ exchange", + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "", + "id": "EX_lac__D_e", + "lower_bound": 0.0, + "metabolites": { + "lac__D_e": -1.0 + }, + "name": "D-lactate exchange", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "FBA" + }, + "gene_reaction_rule": "b1773 or b2097 or b2925", + "id": "FBA", + "lower_bound": -1000.0, + "metabolites": { + "dhap_c": 1.0, + "fdp_c": -1.0, + "g3p_c": 1.0 + }, + "name": "fructose-bisphosphate aldolase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "GAPD" + }, + "gene_reaction_rule": "b1779", + "id": "GAPD", + "lower_bound": -1000.0, + "metabolites": { + "13dpg_c": 1.0, + "g3p_c": -1.0, + "h_c": 1.0, + "nad_c": -1.0, + "nadh_c": 1.0, + "pi_c": -1.0 + }, + "name": "glyceraldehyde-3-phosphate dehydrogenase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "GLCpts" + }, + "gene_reaction_rule": "( b2417 and b1621 and b2415 and b2416 ) or ( b2417 and b1101 and b2415 and b2416 ) or ( b1817 and b1818 and b1819 and b2415 and b2416 )", + "id": "GLCpts", + "lower_bound": 0.0, + "metabolites": { + "g6p_c": 1.0, + "glc__D_e": -1.0, + "pep_c": -1.0, + "pyr_c": 1.0 + }, + "name": "D-glucose transport via PEP:Pyr PTS", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "H2Ot" + }, + "gene_reaction_rule": "b0875 or s0001", + "id": "H2Ot", + "lower_bound": -1000.0, + "metabolites": { + "h2o_c": 1.0, + "h2o_e": -1.0 + }, + "name": "R H2O transport via - diffusion", + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "b2133 or b1380", + "id": "LDH_D", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1.0, + "lac__D_c": -1.0, + "nad_c": -1.0, + "nadh_c": 1.0, + "pyr_c": 1.0 + }, + "name": "D-lactate dehydrogenase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PFK" + }, + "gene_reaction_rule": "b3916 or b1723", + "id": "PFK", + "lower_bound": 0.0, + "metabolites": { + "adp_c": 1.0, + "atp_c": -1.0, + "f6p_c": -1.0, + "fdp_c": 1.0, + "h_c": 1.0 + }, + "name": "phosphofructokinase", + "objective_coefficient": 1.0, + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGI" + }, + "gene_reaction_rule": "b4025", + "id": "PGI", + "lower_bound": -1000.0, + "metabolites": { + "f6p_c": 1.0, + "g6p_c": -1.0 + }, + "name": "glucose-6-phosphate isomerase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGK" + }, + "gene_reaction_rule": "b2926", + "id": "PGK", + "lower_bound": -1000.0, + "metabolites": { + "13dpg_c": 1.0, + "3pg_c": -1.0, + "adp_c": 1.0, + "atp_c": -1.0 + }, + "name": "phosphoglycerate kinase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGM" + }, + "gene_reaction_rule": "b4395 or b3612 or b0755", + "id": "PGM", + "lower_bound": -1000.0, + "metabolites": { + "2pg_c": -1.0, + "3pg_c": 1.0 + }, + "name": "phosphoglycerate mutase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PIt2r" + }, + "gene_reaction_rule": "b2987 or b3493", + "id": "PIt2r", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1.0, + "h_e": -1.0, + "pi_c": 1.0, + "pi_e": -1.0 + }, + "name": "R phosphate reversible transport via - symport", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PYK" + }, + "gene_reaction_rule": "b1854 or b1676", + "id": "PYK", + "lower_bound": 0.0, + "metabolites": { + "adp_c": -1.0, + "atp_c": 1.0, + "h_c": -1.0, + "pep_c": -1.0, + "pyr_c": 1.0 + }, + "name": "pyruvate kinase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "TPI" + }, + "gene_reaction_rule": "b3919", + "id": "TPI", + "lower_bound": -1000.0, + "metabolites": { + "dhap_c": -1.0, + "g3p_c": 1.0 + }, + "name": "triose-phosphate isomerase", + "upper_bound": 1000.0 + } + ], + "version": "1" } \ No newline at end of file diff --git a/cobra/test/data/mini.mat b/cobra/test/data/mini.mat index 6726342d3..627b56033 100644 Binary files a/cobra/test/data/mini.mat and b/cobra/test/data/mini.mat differ diff --git a/cobra/test/data/mini.pickle b/cobra/test/data/mini.pickle index af9ef9ccc..7feb9419d 100644 Binary files a/cobra/test/data/mini.pickle and b/cobra/test/data/mini.pickle differ diff --git a/cobra/test/data/mini.yml b/cobra/test/data/mini.yml index 9c1455a68..a8c5ba6bf 100644 --- a/cobra/test/data/mini.yml +++ b/cobra/test/data/mini.yml @@ -6,38 +6,31 @@ - compartment: c - charge: -4 - formula: C3H4O10P2 - - annotation: - pubchem.substance: '3535' - biocyc: DPG - kegg.compound: C00236 - seed.compound: cpd00203 - reactome: REACT_29800 - bigg.metabolite: 13dpg - hmdb: HMDB01270 - chebi: + - annotation: !!omap + - bigg.metabolite: 13dpg + - biocyc: DPG + - chebi: - CHEBI:16001 - CHEBI:1658 - CHEBI:20189 - CHEBI:57604 - CHEBI:11881 - unipathway.compound: UPC00236 + - hmdb: HMDB01270 + - kegg.compound: C00236 + - pubchem.substance: '3535' + - reactome: REACT_29800 + - seed.compound: cpd00203 + - unipathway.compound: UPC00236 - !!omap - id: 2pg_c - name: D-Glycerate 2-phosphate - compartment: c - charge: -3 - formula: C3H4O7P - - annotation: - pubchem.substance: '3904' - biocyc: 2-PG - kegg.compound: C00631 - seed.compound: cpd00482 - reactome: REACT_30485 - bigg.metabolite: 2pg - hmdb: - - HMDB03391 - - HMDB00362 - chebi: + - annotation: !!omap + - bigg.metabolite: 2pg + - biocyc: 2-PG + - chebi: - CHEBI:1267 - CHEBI:58289 - CHEBI:17835 @@ -46,24 +39,24 @@ - CHEBI:12986 - CHEBI:24344 - CHEBI:39868 - unipathway.compound: UPC00631 + - hmdb: + - HMDB03391 + - HMDB00362 + - kegg.compound: C00631 + - pubchem.substance: '3904' + - reactome: REACT_30485 + - seed.compound: cpd00482 + - unipathway.compound: UPC00631 - !!omap - id: 3pg_c - name: 3-Phospho-D-glycerate - compartment: c - charge: -3 - formula: C3H4O7P - - annotation: - pubchem.substance: '3497' - biocyc: G3P - kegg.compound: - - C00197 - - C00597 - seed.compound: cpd00169 - reactome: REACT_29728 - bigg.metabolite: 3pg - hmdb: HMDB00807 - chebi: + - annotation: !!omap + - bigg.metabolite: 3pg + - biocyc: G3P + - chebi: - CHEBI:40016 - CHEBI:58272 - CHEBI:57998 @@ -77,7 +70,14 @@ - CHEBI:12987 - CHEBI:17794 - CHEBI:24345 - unipathway.compound: + - hmdb: HMDB00807 + - kegg.compound: + - C00197 + - C00597 + - pubchem.substance: '3497' + - reactome: REACT_29728 + - seed.compound: cpd00169 + - unipathway.compound: - UPC00597 - UPC00197 - !!omap @@ -86,21 +86,26 @@ - compartment: c - charge: -3 - formula: C10H12N5O10P2 - - annotation: - kegg.glycan: G11113 - biocyc: + - annotation: !!omap + - bigg.metabolite: adp + - biocyc: - ADP - ADP-GROUP - chebi: + - cas: + - 58-64-0 + - 58-64-0 + - chebi: - CHEBI:13222 - CHEBI:16761 - CHEBI:2342 - CHEBI:22244 - CHEBI:40553 - CHEBI:456216 - unipathway.compound: UPC00008 - seed.compound: cpd00008 - reactome: + - hmdb: HMDB01341 + - kegg.compound: C00008 + - kegg.glycan: G11113 + - pubchem.substance: '3310' + - reactome: - REACT_190072 - REACT_481002 - REACT_211606 @@ -112,23 +117,21 @@ - REACT_114564 - REACT_114565 - REACT_429153 - bigg.metabolite: adp - hmdb: HMDB01341 - pubchem.substance: '3310' - cas: - - 58-64-0 - - 58-64-0 - kegg.compound: C00008 + - seed.compound: cpd00008 + - unipathway.compound: UPC00008 - !!omap - id: atp_c - name: ATP - compartment: c - charge: -4 - formula: C10H12N5O13P3 - - annotation: - pubchem.substance: '3304' - biocyc: ATP - chebi: + - annotation: !!omap + - bigg.metabolite: atp + - biocyc: ATP + - cas: + - 56-65-5 + - 56-65-5 + - chebi: - CHEBI:40938 - CHEBI:15422 - CHEBI:57299 @@ -138,9 +141,11 @@ - CHEBI:22249 - CHEBI:10841 - CHEBI:2359 - unipathway.compound: UPC00002 - seed.compound: cpd00002 - reactome: + - hmdb: HMDB00538 + - kegg.compound: C00002 + - kegg.drug: D08646 + - pubchem.substance: '3304' + - reactome: - REACT_190078 - REACT_113592 - REACT_113593 @@ -149,23 +154,21 @@ - REACT_389573 - REACT_139836 - REACT_211579 - bigg.metabolite: atp - hmdb: HMDB00538 - kegg.drug: D08646 - cas: - - 56-65-5 - - 56-65-5 - kegg.compound: C00002 + - seed.compound: cpd00002 + - unipathway.compound: UPC00002 - !!omap - id: dhap_c - name: Dihydroxyacetone phosphate - compartment: c - charge: -2 - formula: C3H5O6P - - annotation: - pubchem.substance: '3411' - biocyc: DIHYDROXY-ACETONE-PHOSPHATE - chebi: + - annotation: !!omap + - bigg.metabolite: dhap + - biocyc: DIHYDROXY-ACETONE-PHOSPHATE + - cas: + - 57-04-5 + - 57-04-5 + - chebi: - CHEBI:14341 - CHEBI:57642 - CHEBI:14342 @@ -173,30 +176,30 @@ - CHEBI:5454 - CHEBI:24355 - CHEBI:39571 - unipathway.compound: UPC00111 - seed.compound: cpd00095 - reactome: + - hmdb: + - HMDB01473 + - HMDB11735 + - kegg.compound: C00111 + - pubchem.substance: '3411' + - reactome: - REACT_188451 - REACT_75970 - REACT_390404 - bigg.metabolite: dhap - hmdb: - - HMDB01473 - - HMDB11735 - cas: - - 57-04-5 - - 57-04-5 - kegg.compound: C00111 + - seed.compound: cpd00095 + - unipathway.compound: UPC00111 - !!omap - id: f6p_c - name: D-Fructose 6-phosphate - compartment: c - charge: -2 - formula: C6H11O9P - - annotation: - pubchem.substance: '3385' - biocyc: FRUCTOSE-6P - chebi: + - annotation: !!omap + - bigg.metabolite: f6p + - biocyc: FRUCTOSE-6P + - cas: + - 643-13-0 + - 643-13-0 + - chebi: - CHEBI:57634 - CHEBI:12352 - CHEBI:45804 @@ -206,28 +209,28 @@ - CHEBI:16084 - CHEBI:42378 - CHEBI:22768 - unipathway.compound: - - UPC05345 - - UPC00085 - seed.compound: cpd00072 - bigg.metabolite: f6p - hmdb: HMDB03971 - cas: - - 643-13-0 - - 643-13-0 - kegg.compound: + - hmdb: HMDB03971 + - kegg.compound: - C05345 - C00085 + - pubchem.substance: '3385' + - seed.compound: cpd00072 + - unipathway.compound: + - UPC05345 + - UPC00085 - !!omap - id: fdp_c - name: D-Fructose 1,6-bisphosphate - compartment: c - charge: -4 - formula: C6H10O12P2 - - annotation: - pubchem.substance: '3647' - biocyc: FRUCTOSE-16-DIPHOSPHATE - chebi: + - annotation: !!omap + - bigg.metabolite: fdp + - biocyc: FRUCTOSE-16-DIPHOSPHATE + - cas: + - 488-69-7 + - 488-69-7 + - chebi: - CHEBI:32968 - CHEBI:49299 - CHEBI:42553 @@ -240,52 +243,52 @@ - CHEBI:10374 - CHEBI:40595 - CHEBI:40591 - unipathway.compound: UPC00354 - seed.compound: cpd00290 - bigg.metabolite: fdp - cas: - - 488-69-7 - - 488-69-7 - kegg.compound: + - kegg.compound: - C05378 - C00354 + - pubchem.substance: '3647' + - seed.compound: cpd00290 + - unipathway.compound: UPC00354 - !!omap - id: g3p_c - name: Glyceraldehyde 3-phosphate - compartment: c - charge: -2 - formula: C3H5O6P - - annotation: - pubchem.substance: '3930' - chebi: + - annotation: !!omap + - bigg.metabolite: g3p + - cas: + - 142-10-9 + - 142-10-9 + - chebi: - CHEBI:17138 - CHEBI:14333 - CHEBI:5446 - CHEBI:58027 - unipathway.compound: - - UPC00661 - - UPC00118 - seed.compound: cpd00102 - bigg.metabolite: g3p - hmdb: HMDB01112 - cas: - - 142-10-9 - - 142-10-9 - kegg.compound: + - hmdb: HMDB01112 + - kegg.compound: - C00661 - C00118 + - pubchem.substance: '3930' + - seed.compound: cpd00102 + - unipathway.compound: + - UPC00661 + - UPC00118 - !!omap - id: g6p_c - name: D-Glucose 6-phosphate - compartment: c - charge: -2 - formula: C6H11O9P - - annotation: - pubchem.substance: '3392' - biocyc: + - annotation: !!omap + - bigg.metabolite: g6p + - biocyc: - D-glucose-6-phosphate - GLC-6-P - chebi: + - cas: + - 56-73-5 + - 56-73-5 + - chebi: - CHEBI:10399 - CHEBI:22797 - CHEBI:41041 @@ -294,47 +297,47 @@ - CHEBI:61548 - CHEBI:58247 - CHEBI:12375 - unipathway.compound: UPC00092 - seed.compound: cpd00079 - reactome: REACT_1629756 - bigg.metabolite: g6p - hmdb: + - hmdb: - HMDB03498 - HMDB06793 - HMDB01401 - HMDB01549 - cas: - - 56-73-5 - - 56-73-5 - kegg.compound: + - kegg.compound: - C00092 - C01172 + - pubchem.substance: '3392' + - reactome: REACT_1629756 + - seed.compound: cpd00079 + - unipathway.compound: UPC00092 - !!omap - id: glc__D_e - name: D-Glucose - compartment: e - charge: 0 - formula: C6H12O6 - - annotation: - bigg.metabolite: glc__D - pubchem.substance: '3333' - cas: + - annotation: !!omap + - bigg.metabolite: glc__D + - cas: - 50-99-7 - 50-99-7 - kegg.compound: C00031 + - kegg.compound: C00031 + - pubchem.substance: '3333' - !!omap - id: h2o_c - name: H2O - compartment: c - charge: 0 - formula: H2O - - annotation: - pubchem.substance: '3303' - biocyc: + - annotation: !!omap + - bigg.metabolite: h2o + - biocyc: - WATER - OH - OXONIUM - chebi: + - cas: + - 7732-18-5 + - 7732-18-5 + - chebi: - CHEBI:15377 - CHEBI:13365 - CHEBI:41979 @@ -363,13 +366,20 @@ - CHEBI:5585 - CHEBI:44641 - CHEBI:44701 - unipathway.compound: - - UPC00001 - - UPC01328 - seed.compound: - - cpd15275 - - cpd00001 - reactome: + - hmdb: + - HMDB01039 + - HMDB02111 + - kegg.compound: + - C01328 + - C00001 + - C18714 + - C18712 + - kegg.drug: + - D00001 + - D06322 + - D03703 + - pubchem.substance: '3303' + - reactome: - REACT_947593 - REACT_189422 - REACT_141343 @@ -381,35 +391,28 @@ - REACT_2022884 - REACT_351603 - REACT_29356 - bigg.metabolite: h2o - hmdb: - - HMDB01039 - - HMDB02111 - kegg.drug: - - D00001 - - D06322 - - D03703 - cas: - - 7732-18-5 - - 7732-18-5 - kegg.compound: - - C01328 - - C00001 - - C18714 - - C18712 + - seed.compound: + - cpd15275 + - cpd00001 + - unipathway.compound: + - UPC00001 + - UPC01328 - !!omap - id: h2o_e - name: H2O - compartment: e - charge: 0 - formula: H2O - - annotation: - pubchem.substance: '3303' - biocyc: + - annotation: !!omap + - bigg.metabolite: h2o + - biocyc: - WATER - OH - OXONIUM - chebi: + - cas: + - 7732-18-5 + - 7732-18-5 + - chebi: - CHEBI:15377 - CHEBI:13365 - CHEBI:41979 @@ -438,13 +441,20 @@ - CHEBI:5585 - CHEBI:44641 - CHEBI:44701 - unipathway.compound: - - UPC00001 - - UPC01328 - seed.compound: - - cpd15275 - - cpd00001 - reactome: + - hmdb: + - HMDB01039 + - HMDB02111 + - kegg.compound: + - C01328 + - C00001 + - C18714 + - C18712 + - kegg.drug: + - D00001 + - D06322 + - D03703 + - pubchem.substance: '3303' + - reactome: - REACT_947593 - REACT_189422 - REACT_141343 @@ -456,40 +466,33 @@ - REACT_2022884 - REACT_351603 - REACT_29356 - bigg.metabolite: h2o - hmdb: - - HMDB01039 - - HMDB02111 - kegg.drug: - - D00001 - - D06322 - - D03703 - cas: - - 7732-18-5 - - 7732-18-5 - kegg.compound: - - C01328 - - C00001 - - C18714 - - C18712 + - seed.compound: + - cpd15275 + - cpd00001 + - unipathway.compound: + - UPC00001 + - UPC01328 - !!omap - id: h_c - name: H+ - compartment: c - charge: 1 - formula: H - - annotation: - pubchem.substance: '3380' - biocyc: PROTON - chebi: + - annotation: !!omap + - bigg.metabolite: h + - biocyc: PROTON + - cas: + - 12408-02-5 + - 12408-02-5 + - chebi: - CHEBI:24636 - CHEBI:15378 - CHEBI:10744 - CHEBI:13357 - CHEBI:5584 - unipathway.compound: UPC00080 - seed.compound: cpd00067 - reactome: + - kegg.compound: C00080 + - pubchem.substance: '3380' + - reactome: - REACT_194688 - REACT_425978 - REACT_193465 @@ -509,29 +512,29 @@ - REACT_1614597 - REACT_351626 - REACT_427899 - bigg.metabolite: h - cas: - - 12408-02-5 - - 12408-02-5 - kegg.compound: C00080 + - seed.compound: cpd00067 + - unipathway.compound: UPC00080 - !!omap - id: h_e - name: H+ - compartment: e - charge: 1 - formula: H - - annotation: - pubchem.substance: '3380' - biocyc: PROTON - chebi: + - annotation: !!omap + - bigg.metabolite: h + - biocyc: PROTON + - cas: + - 12408-02-5 + - 12408-02-5 + - chebi: - CHEBI:24636 - CHEBI:15378 - CHEBI:10744 - CHEBI:13357 - CHEBI:5584 - unipathway.compound: UPC00080 - seed.compound: cpd00067 - reactome: + - kegg.compound: C00080 + - pubchem.substance: '3380' + - reactome: - REACT_194688 - REACT_425978 - REACT_193465 @@ -551,11 +554,8 @@ - REACT_1614597 - REACT_351626 - REACT_427899 - bigg.metabolite: h - cas: - - 12408-02-5 - - 12408-02-5 - kegg.compound: C00080 + - seed.compound: cpd00067 + - unipathway.compound: UPC00080 - !!omap - id: lac__D_c - name: D-Lactate @@ -574,10 +574,13 @@ - compartment: c - charge: -1 - formula: C21H26N7O14P2 - - annotation: - pubchem.substance: '3305' - biocyc: NAD - chebi: + - annotation: !!omap + - bigg.metabolite: nad + - biocyc: NAD + - cas: + - 53-84-9 + - 53-84-9 + - chebi: - CHEBI:21901 - CHEBI:7422 - CHEBI:44214 @@ -588,31 +591,31 @@ - CHEBI:13389 - CHEBI:57540 - CHEBI:44281 - unipathway.compound: UPC00003 - seed.compound: cpd00003 - reactome: + - hmdb: HMDB00902 + - kegg.compound: C00003 + - kegg.drug: D00002 + - pubchem.substance: '3305' + - reactome: - REACT_192307 - REACT_29360 - REACT_427523 - REACT_194653 - REACT_113526 - bigg.metabolite: nad - hmdb: HMDB00902 - kegg.drug: D00002 - cas: - - 53-84-9 - - 53-84-9 - kegg.compound: C00003 + - seed.compound: cpd00003 + - unipathway.compound: UPC00003 - !!omap - id: nadh_c - name: Nicotinamide adenine dinucleotide - reduced - compartment: c - charge: -2 - formula: C21H27N7O14P2 - - annotation: - pubchem.substance: '3306' - biocyc: NADH - chebi: + - annotation: !!omap + - bigg.metabolite: nadh + - biocyc: NADH + - cas: + - 58-68-4 + - 58-68-4 + - chebi: - CHEBI:13395 - CHEBI:21902 - CHEBI:16908 @@ -620,29 +623,29 @@ - CHEBI:44216 - CHEBI:57945 - CHEBI:13396 - unipathway.compound: UPC00004 - seed.compound: cpd00004 - reactome: + - hmdb: HMDB01487 + - kegg.compound: C00004 + - pubchem.substance: '3306' + - reactome: - REACT_192305 - REACT_73473 - REACT_194697 - REACT_29362 - bigg.metabolite: nadh - hmdb: HMDB01487 - cas: - - 58-68-4 - - 58-68-4 - kegg.compound: C00004 + - seed.compound: cpd00004 + - unipathway.compound: UPC00004 - !!omap - id: pep_c - name: Phosphoenolpyruvate - compartment: c - charge: -3 - formula: C3H2O6P - - annotation: - pubchem.substance: '3374' - biocyc: PHOSPHO-ENOL-PYRUVATE - chebi: + - annotation: !!omap + - bigg.metabolite: pep + - biocyc: PHOSPHO-ENOL-PYRUVATE + - cas: + - 138-08-9 + - 138-08-9 + - chebi: - CHEBI:44897 - CHEBI:44894 - CHEBI:14812 @@ -651,30 +654,30 @@ - CHEBI:26054 - CHEBI:58702 - CHEBI:18021 - unipathway.compound: UPC00074 - seed.compound: cpd00061 - reactome: + - hmdb: HMDB00263 + - kegg.compound: C00074 + - pubchem.substance: '3374' + - reactome: - REACT_29492 - REACT_372364 - bigg.metabolite: pep - hmdb: HMDB00263 - cas: - - 138-08-9 - - 138-08-9 - kegg.compound: C00074 + - seed.compound: cpd00061 + - unipathway.compound: UPC00074 - !!omap - id: pi_c - name: Phosphate - compartment: c - charge: -2 - formula: HO4P - - annotation: - pubchem.substance: '3311' - biocyc: + - annotation: !!omap + - bigg.metabolite: pi + - biocyc: - Pi - PHOSPHATE-GROUP - CPD0-1421 - chebi: + - cas: + - 14265-44-2 + - 14265-44-2 + - chebi: - CHEBI:37583 - CHEBI:7793 - CHEBI:37585 @@ -699,12 +702,14 @@ - CHEBI:26078 - CHEBI:39745 - CHEBI:24838 - unipathway.compound: UPC00009 - seed.compound: - - cpd09464 - - cpd09463 - - cpd00009 - reactome: + - hmdb: HMDB02142 + - kegg.compound: + - C13556 + - C13558 + - C00009 + - kegg.drug: D05467 + - pubchem.substance: '3311' + - reactome: - REACT_947590 - REACT_109277 - REACT_113548 @@ -712,29 +717,27 @@ - REACT_29372 - REACT_113550 - REACT_113551 - bigg.metabolite: pi - hmdb: HMDB02142 - kegg.drug: D05467 - cas: - - 14265-44-2 - - 14265-44-2 - kegg.compound: - - C13556 - - C13558 - - C00009 + - seed.compound: + - cpd09464 + - cpd09463 + - cpd00009 + - unipathway.compound: UPC00009 - !!omap - id: pi_e - name: Phosphate - compartment: e - charge: -2 - formula: HO4P - - annotation: - pubchem.substance: '3311' - biocyc: + - annotation: !!omap + - bigg.metabolite: pi + - biocyc: - Pi - PHOSPHATE-GROUP - CPD0-1421 - chebi: + - cas: + - 14265-44-2 + - 14265-44-2 + - chebi: - CHEBI:37583 - CHEBI:7793 - CHEBI:37585 @@ -759,12 +762,14 @@ - CHEBI:26078 - CHEBI:39745 - CHEBI:24838 - unipathway.compound: UPC00009 - seed.compound: - - cpd09464 - - cpd09463 - - cpd00009 - reactome: + - hmdb: HMDB02142 + - kegg.compound: + - C13556 + - C13558 + - C00009 + - kegg.drug: D05467 + - pubchem.substance: '3311' + - reactome: - REACT_947590 - REACT_109277 - REACT_113548 @@ -772,26 +777,24 @@ - REACT_29372 - REACT_113550 - REACT_113551 - bigg.metabolite: pi - hmdb: HMDB02142 - kegg.drug: D05467 - cas: - - 14265-44-2 - - 14265-44-2 - kegg.compound: - - C13556 - - C13558 - - C00009 + - seed.compound: + - cpd09464 + - cpd09463 + - cpd00009 + - unipathway.compound: UPC00009 - !!omap - id: pyr_c - name: Pyruvate - compartment: c - charge: -1 - formula: C3H3O3 - - annotation: - pubchem.substance: '3324' - biocyc: PYRUVATE - chebi: + - annotation: !!omap + - bigg.metabolite: pyr + - biocyc: PYRUVATE + - cas: + - 127-17-3 + - 127-17-3 + - chebi: - CHEBI:15361 - CHEBI:14987 - CHEBI:8685 @@ -799,19 +802,16 @@ - CHEBI:45253 - CHEBI:26466 - CHEBI:26462 - lipidmaps: LMFA01060077 - seed.compound: cpd00020 - kegg.compound: C00022 - reactome: + - hmdb: HMDB00243 + - kegg.compound: C00022 + - lipidmaps: LMFA01060077 + - pubchem.substance: '3324' + - reactome: - REACT_113557 - REACT_389680 - REACT_29398 - bigg.metabolite: pyr - hmdb: HMDB00243 - cas: - - 127-17-3 - - 127-17-3 - unipathway.compound: UPC00022 + - seed.compound: cpd00020 + - unipathway.compound: UPC00022 - reactions: - !!omap - id: ATPM @@ -826,8 +826,8 @@ - upper_bound: 1000.0 - gene_reaction_rule: '' - objective_coefficient: 1.0 - - annotation: - bigg.reaction: ATPM + - annotation: !!omap + - bigg.reaction: ATPM - !!omap - id: D_LACt2 - name: '' @@ -849,8 +849,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b2779 - - annotation: - bigg.reaction: ENO + - annotation: !!omap + - bigg.reaction: ENO - !!omap - id: EX_glc__D_e - name: D-Glucose exchange @@ -859,9 +859,9 @@ - lower_bound: -10.0 - upper_bound: 1000.0 - gene_reaction_rule: '' - - annotation: - bigg.reaction: glc - SBO: SBO:0000627 + - annotation: !!omap + - SBO: SBO:0000627 + - bigg.reaction: glc - !!omap - id: EX_h_e - name: H+ exchange @@ -870,9 +870,9 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: '' - - annotation: - bigg.reaction: h - SBO: SBO:0000627 + - annotation: !!omap + - SBO: SBO:0000627 + - bigg.reaction: h - !!omap - id: EX_lac__D_e - name: D-lactate exchange @@ -891,8 +891,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b1773 or b2097 or b2925 - - annotation: - bigg.reaction: FBA + - annotation: !!omap + - bigg.reaction: FBA - !!omap - id: GAPD - name: glyceraldehyde-3-phosphate dehydrogenase @@ -906,8 +906,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b1779 - - annotation: - bigg.reaction: GAPD + - annotation: !!omap + - bigg.reaction: GAPD - !!omap - id: GLCpts - name: D-glucose transport via PEP:Pyr PTS @@ -920,8 +920,8 @@ - upper_bound: 1000.0 - gene_reaction_rule: ( b2417 and b1621 and b2415 and b2416 ) or ( b2417 and b1101 and b2415 and b2416 ) or ( b1817 and b1818 and b1819 and b2415 and b2416 ) - - annotation: - bigg.reaction: GLCpts + - annotation: !!omap + - bigg.reaction: GLCpts - !!omap - id: H2Ot - name: R H2O transport via - diffusion @@ -931,8 +931,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b0875 or s0001 - - annotation: - bigg.reaction: H2Ot + - annotation: !!omap + - bigg.reaction: H2Ot - !!omap - id: LDH_D - name: D-lactate dehydrogenase @@ -958,8 +958,8 @@ - upper_bound: 1000.0 - gene_reaction_rule: b3916 or b1723 - objective_coefficient: 1.0 - - annotation: - bigg.reaction: PFK + - annotation: !!omap + - bigg.reaction: PFK - !!omap - id: PGI - name: glucose-6-phosphate isomerase @@ -969,8 +969,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b4025 - - annotation: - bigg.reaction: PGI + - annotation: !!omap + - bigg.reaction: PGI - !!omap - id: PGK - name: phosphoglycerate kinase @@ -982,8 +982,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b2926 - - annotation: - bigg.reaction: PGK + - annotation: !!omap + - bigg.reaction: PGK - !!omap - id: PGM - name: phosphoglycerate mutase @@ -993,8 +993,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b4395 or b3612 or b0755 - - annotation: - bigg.reaction: PGM + - annotation: !!omap + - bigg.reaction: PGM - !!omap - id: PIt2r - name: R phosphate reversible transport via - symport @@ -1006,8 +1006,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b2987 or b3493 - - annotation: - bigg.reaction: PIt2r + - annotation: !!omap + - bigg.reaction: PIt2r - !!omap - id: PYK - name: pyruvate kinase @@ -1020,8 +1020,8 @@ - lower_bound: 0.0 - upper_bound: 1000.0 - gene_reaction_rule: b1854 or b1676 - - annotation: - bigg.reaction: PYK + - annotation: !!omap + - bigg.reaction: PYK - !!omap - id: TPI - name: triose-phosphate isomerase @@ -1031,8 +1031,8 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b3919 - - annotation: - bigg.reaction: TPI + - annotation: !!omap + - bigg.reaction: TPI - genes: - !!omap - id: b0755 @@ -1052,8 +1052,8 @@ - !!omap - id: b1676 - name: pykF - - annotation: - ncbigi: + - annotation: !!omap + - ncbigi: - GI:1208453 - GI:1652654 - !!omap @@ -1095,16 +1095,16 @@ - !!omap - id: b2779 - name: eno - - annotation: - ncbigi: GI:1653839 + - annotation: !!omap + - ncbigi: GI:1653839 - !!omap - id: b2925 - name: fbaA - !!omap - id: b2926 - name: pgk - - annotation: - ncbigi: GI:1653609 + - annotation: !!omap + - ncbigi: GI:1653609 - !!omap - id: b2975 - name: glcA @@ -1123,8 +1123,8 @@ - !!omap - id: b3916 - name: pfkA - - annotation: - ncbigi: + - annotation: !!omap + - ncbigi: - GI:1006614 - GI:1651919 - !!omap @@ -1133,16 +1133,20 @@ - !!omap - id: b4025 - name: pgi - - annotation: - ncbigi: GI:1653253 + - annotation: !!omap + - ncbigi: GI:1653253 - !!omap - id: b4395 - name: ytjC - !!omap - id: s0001 - name: G_s0001 +- compartments: + - !!omap + - id: c + - name: cytosol + - !!omap + - id: e + - name: extracellular - id: mini_textbook -- compartments: !!omap - - c: cytosol - - e: extracellular - version: '1.2' diff --git a/cobra/test/data/mini_cobra.xml b/cobra/test/data/mini_cobra.xml index 48b02294b..edfccd336 100644 --- a/cobra/test/data/mini_cobra.xml +++ b/cobra/test/data/mini_cobra.xml @@ -201,22 +201,22 @@ - + + - FLUX_VALUE + - @@ -240,9 +240,9 @@ FLUX_VALUE + - @@ -265,9 +265,9 @@ FLUX_VALUE + - @@ -284,9 +284,9 @@ FLUX_VALUE + - @@ -303,9 +303,9 @@ FLUX_VALUE + - @@ -322,9 +322,9 @@ FLUX_VALUE + - @@ -347,9 +347,9 @@ FLUX_VALUE + - @@ -366,18 +366,18 @@ - - + + FLUX_VALUE + - @@ -401,9 +401,9 @@ FLUX_VALUE + - @@ -425,9 +425,9 @@ FLUX_VALUE + - @@ -452,9 +452,9 @@ FLUX_VALUE + - @@ -466,22 +466,22 @@ - + - + FLUX_VALUE + - @@ -503,9 +503,9 @@ FLUX_VALUE + - @@ -517,21 +517,21 @@ - + - + FLUX_VALUE + - @@ -553,9 +553,9 @@ FLUX_VALUE + - @@ -571,17 +571,17 @@ - + FLUX_VALUE + - @@ -598,17 +598,17 @@ - + FLUX_VALUE + - @@ -630,9 +630,9 @@ FLUX_VALUE + - diff --git a/cobra/test/data/mini_fbc1.xml b/cobra/test/data/mini_fbc1.xml index 58fb4bc9c..eddeda5e7 100644 --- a/cobra/test/data/mini_fbc1.xml +++ b/cobra/test/data/mini_fbc1.xml @@ -308,13 +308,13 @@ - + + - @@ -396,9 +396,9 @@ - - + + @@ -452,13 +452,13 @@ - + - + @@ -481,12 +481,12 @@ - + - + @@ -513,8 +513,8 @@ - + @@ -529,8 +529,8 @@ - + diff --git a/cobra/test/data/mini_fbc2.xml.gz b/cobra/test/data/mini_fbc2.xml.gz index 16d383c00..301215565 100644 Binary files a/cobra/test/data/mini_fbc2.xml.gz and b/cobra/test/data/mini_fbc2.xml.gz differ diff --git a/cobra/test/data/mini_legacy.json b/cobra/test/data/mini_legacy.json new file mode 100644 index 000000000..51d719f2e --- /dev/null +++ b/cobra/test/data/mini_legacy.json @@ -0,0 +1,1367 @@ +{ + "compartments": { + "c": "cytosol", + "e": "extracellular" + }, + "genes": [ + { + "id": "b0755", + "name": "gpmA" + }, + { + "id": "b0875", + "name": "aqpZ" + }, + { + "id": "b1101", + "name": "ptsG" + }, + { + "id": "b1380", + "name": "ldhA" + }, + { + "id": "b1621", + "name": "malX" + }, + { + "annotation": { + "ncbigi": [ + "GI:1208453", + "GI:1652654" + ] + }, + "id": "b1676", + "name": "pykF" + }, + { + "id": "b1723", + "name": "pfkB" + }, + { + "id": "b1773", + "name": "ydjI" + }, + { + "id": "b1779", + "name": "gapA" + }, + { + "id": "b1817", + "name": "manX" + }, + { + "id": "b1818", + "name": "manY" + }, + { + "id": "b1819", + "name": "manZ" + }, + { + "id": "b1854", + "name": "pykA" + }, + { + "id": "b2097", + "name": "fbaB" + }, + { + "id": "b2133", + "name": "dld" + }, + { + "id": "b2415", + "name": "ptsH" + }, + { + "id": "b2416", + "name": "ptsI" + }, + { + "id": "b2417", + "name": "crr" + }, + { + "annotation": { + "ncbigi": "GI:1653839" + }, + "id": "b2779", + "name": "eno" + }, + { + "id": "b2925", + "name": "fbaA" + }, + { + "annotation": { + "ncbigi": "GI:1653609" + }, + "id": "b2926", + "name": "pgk" + }, + { + "id": "b2975", + "name": "glcA" + }, + { + "id": "b2987", + "name": "pitB" + }, + { + "id": "b3493", + "name": "pitA" + }, + { + "id": "b3603", + "name": "lldP" + }, + { + "id": "b3612", + "name": "gpmM" + }, + { + "annotation": { + "ncbigi": [ + "GI:1006614", + "GI:1651919" + ] + }, + "id": "b3916", + "name": "pfkA" + }, + { + "id": "b3919", + "name": "tpiA" + }, + { + "annotation": { + "ncbigi": "GI:1653253" + }, + "id": "b4025", + "name": "pgi" + }, + { + "id": "b4395", + "name": "ytjC" + }, + { + "id": "s0001", + "name": "G_s0001" + } + ], + "id": "mini_textbook", + "metabolites": [ + { + "annotation": { + "bigg.metabolite": "13dpg", + "biocyc": "DPG", + "chebi": [ + "CHEBI:16001", + "CHEBI:1658", + "CHEBI:20189", + "CHEBI:57604", + "CHEBI:11881" + ], + "hmdb": "HMDB01270", + "kegg.compound": "C00236", + "pubchem.substance": "3535", + "reactome": "REACT_29800", + "seed.compound": "cpd00203", + "unipathway.compound": "UPC00236" + }, + "charge": -4, + "compartment": "c", + "formula": "C3H4O10P2", + "id": "13dpg_c", + "name": "3-Phospho-D-glyceroyl phosphate" + }, + { + "annotation": { + "bigg.metabolite": "2pg", + "biocyc": "2-PG", + "chebi": [ + "CHEBI:1267", + "CHEBI:58289", + "CHEBI:17835", + "CHEBI:21028", + "CHEBI:11651", + "CHEBI:12986", + "CHEBI:24344", + "CHEBI:39868" + ], + "hmdb": [ + "HMDB03391", + "HMDB00362" + ], + "kegg.compound": "C00631", + "pubchem.substance": "3904", + "reactome": "REACT_30485", + "seed.compound": "cpd00482", + "unipathway.compound": "UPC00631" + }, + "charge": -3, + "compartment": "c", + "formula": "C3H4O7P", + "id": "2pg_c", + "name": "D-Glycerate 2-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "3pg", + "biocyc": "G3P", + "chebi": [ + "CHEBI:40016", + "CHEBI:58272", + "CHEBI:57998", + "CHEBI:11879", + "CHEBI:1657", + "CHEBI:1659", + "CHEBI:17050", + "CHEBI:21029", + "CHEBI:11882", + "CHEBI:11880", + "CHEBI:12987", + "CHEBI:17794", + "CHEBI:24345" + ], + "hmdb": "HMDB00807", + "kegg.compound": [ + "C00197", + "C00597" + ], + "pubchem.substance": "3497", + "reactome": "REACT_29728", + "seed.compound": "cpd00169", + "unipathway.compound": [ + "UPC00597", + "UPC00197" + ] + }, + "charge": -3, + "compartment": "c", + "formula": "C3H4O7P", + "id": "3pg_c", + "name": "3-Phospho-D-glycerate" + }, + { + "annotation": { + "bigg.metabolite": "adp", + "biocyc": [ + "ADP", + "ADP-GROUP" + ], + "cas": [ + "58-64-0", + "58-64-0" + ], + "chebi": [ + "CHEBI:13222", + "CHEBI:16761", + "CHEBI:2342", + "CHEBI:22244", + "CHEBI:40553", + "CHEBI:456216" + ], + "hmdb": "HMDB01341", + "kegg.compound": "C00008", + "kegg.glycan": "G11113", + "pubchem.substance": "3310", + "reactome": [ + "REACT_190072", + "REACT_481002", + "REACT_211606", + "REACT_429160", + "REACT_29370", + "REACT_196180", + "REACT_113581", + "REACT_113582", + "REACT_114564", + "REACT_114565", + "REACT_429153" + ], + "seed.compound": "cpd00008", + "unipathway.compound": "UPC00008" + }, + "charge": -3, + "compartment": "c", + "formula": "C10H12N5O10P2", + "id": "adp_c", + "name": "ADP" + }, + { + "annotation": { + "bigg.metabolite": "atp", + "biocyc": "ATP", + "cas": [ + "56-65-5", + "56-65-5" + ], + "chebi": [ + "CHEBI:40938", + "CHEBI:15422", + "CHEBI:57299", + "CHEBI:13236", + "CHEBI:10789", + "CHEBI:30616", + "CHEBI:22249", + "CHEBI:10841", + "CHEBI:2359" + ], + "hmdb": "HMDB00538", + "kegg.compound": "C00002", + "kegg.drug": "D08646", + "pubchem.substance": "3304", + "reactome": [ + "REACT_190078", + "REACT_113592", + "REACT_113593", + "REACT_114570", + "REACT_29358", + "REACT_389573", + "REACT_139836", + "REACT_211579" + ], + "seed.compound": "cpd00002", + "unipathway.compound": "UPC00002" + }, + "charge": -4, + "compartment": "c", + "formula": "C10H12N5O13P3", + "id": "atp_c", + "name": "ATP" + }, + { + "annotation": { + "bigg.metabolite": "dhap", + "biocyc": "DIHYDROXY-ACETONE-PHOSPHATE", + "cas": [ + "57-04-5", + "57-04-5" + ], + "chebi": [ + "CHEBI:14341", + "CHEBI:57642", + "CHEBI:14342", + "CHEBI:16108", + "CHEBI:5454", + "CHEBI:24355", + "CHEBI:39571" + ], + "hmdb": [ + "HMDB01473", + "HMDB11735" + ], + "kegg.compound": "C00111", + "pubchem.substance": "3411", + "reactome": [ + "REACT_188451", + "REACT_75970", + "REACT_390404" + ], + "seed.compound": "cpd00095", + "unipathway.compound": "UPC00111" + }, + "charge": -2, + "compartment": "c", + "formula": "C3H5O6P", + "id": "dhap_c", + "name": "Dihydroxyacetone phosphate" + }, + { + "annotation": { + "bigg.metabolite": "f6p", + "biocyc": "FRUCTOSE-6P", + "cas": [ + "643-13-0", + "643-13-0" + ], + "chebi": [ + "CHEBI:57634", + "CHEBI:12352", + "CHEBI:45804", + "CHEBI:61527", + "CHEBI:61553", + "CHEBI:10375", + "CHEBI:16084", + "CHEBI:42378", + "CHEBI:22768" + ], + "hmdb": "HMDB03971", + "kegg.compound": [ + "C05345", + "C00085" + ], + "pubchem.substance": "3385", + "seed.compound": "cpd00072", + "unipathway.compound": [ + "UPC05345", + "UPC00085" + ] + }, + "charge": -2, + "compartment": "c", + "formula": "C6H11O9P", + "id": "f6p_c", + "name": "D-Fructose 6-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "fdp", + "biocyc": "FRUCTOSE-16-DIPHOSPHATE", + "cas": [ + "488-69-7", + "488-69-7" + ], + "chebi": [ + "CHEBI:32968", + "CHEBI:49299", + "CHEBI:42553", + "CHEBI:32966", + "CHEBI:37736", + "CHEBI:28013", + "CHEBI:32967", + "CHEBI:41014", + "CHEBI:22767", + "CHEBI:10374", + "CHEBI:40595", + "CHEBI:40591" + ], + "kegg.compound": [ + "C05378", + "C00354" + ], + "pubchem.substance": "3647", + "seed.compound": "cpd00290", + "unipathway.compound": "UPC00354" + }, + "charge": -4, + "compartment": "c", + "formula": "C6H10O12P2", + "id": "fdp_c", + "name": "D-Fructose 1,6-bisphosphate" + }, + { + "annotation": { + "bigg.metabolite": "g3p", + "cas": [ + "142-10-9", + "142-10-9" + ], + "chebi": [ + "CHEBI:17138", + "CHEBI:14333", + "CHEBI:5446", + "CHEBI:58027" + ], + "hmdb": "HMDB01112", + "kegg.compound": [ + "C00661", + "C00118" + ], + "pubchem.substance": "3930", + "seed.compound": "cpd00102", + "unipathway.compound": [ + "UPC00661", + "UPC00118" + ] + }, + "charge": -2, + "compartment": "c", + "formula": "C3H5O6P", + "id": "g3p_c", + "name": "Glyceraldehyde 3-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "g6p", + "biocyc": [ + "D-glucose-6-phosphate", + "GLC-6-P" + ], + "cas": [ + "56-73-5", + "56-73-5" + ], + "chebi": [ + "CHEBI:10399", + "CHEBI:22797", + "CHEBI:41041", + "CHEBI:17719", + "CHEBI:4170", + "CHEBI:61548", + "CHEBI:58247", + "CHEBI:12375" + ], + "hmdb": [ + "HMDB03498", + "HMDB06793", + "HMDB01401", + "HMDB01549" + ], + "kegg.compound": [ + "C00092", + "C01172" + ], + "pubchem.substance": "3392", + "reactome": "REACT_1629756", + "seed.compound": "cpd00079", + "unipathway.compound": "UPC00092" + }, + "charge": -2, + "compartment": "c", + "formula": "C6H11O9P", + "id": "g6p_c", + "name": "D-Glucose 6-phosphate" + }, + { + "annotation": { + "bigg.metabolite": "glc__D", + "cas": [ + "50-99-7", + "50-99-7" + ], + "kegg.compound": "C00031", + "pubchem.substance": "3333" + }, + "charge": 0, + "compartment": "e", + "formula": "C6H12O6", + "id": "glc__D_e", + "name": "D-Glucose" + }, + { + "annotation": { + "bigg.metabolite": "h2o", + "biocyc": [ + "WATER", + "OH", + "OXONIUM" + ], + "cas": [ + "7732-18-5", + "7732-18-5" + ], + "chebi": [ + "CHEBI:15377", + "CHEBI:13365", + "CHEBI:41979", + "CHEBI:16234", + "CHEBI:36385", + "CHEBI:42857", + "CHEBI:27313", + "CHEBI:44819", + "CHEBI:29373", + "CHEBI:10743", + "CHEBI:5594", + "CHEBI:29356", + "CHEBI:53442", + "CHEBI:29375", + "CHEBI:29374", + "CHEBI:13419", + "CHEBI:43228", + "CHEBI:44292", + "CHEBI:13352", + "CHEBI:41981", + "CHEBI:29412", + "CHEBI:42043", + "CHEBI:33811", + "CHEBI:33813", + "CHEBI:35511", + "CHEBI:5585", + "CHEBI:44641", + "CHEBI:44701" + ], + "hmdb": [ + "HMDB01039", + "HMDB02111" + ], + "kegg.compound": [ + "C01328", + "C00001", + "C18714", + "C18712" + ], + "kegg.drug": [ + "D00001", + "D06322", + "D03703" + ], + "pubchem.substance": "3303", + "reactome": [ + "REACT_947593", + "REACT_189422", + "REACT_141343", + "REACT_113518", + "REACT_1605715", + "REACT_109276", + "REACT_113521", + "REACT_113519", + "REACT_2022884", + "REACT_351603", + "REACT_29356" + ], + "seed.compound": [ + "cpd15275", + "cpd00001" + ], + "unipathway.compound": [ + "UPC00001", + "UPC01328" + ] + }, + "charge": 0, + "compartment": "c", + "formula": "H2O", + "id": "h2o_c", + "name": "H2O" + }, + { + "annotation": { + "bigg.metabolite": "h2o", + "biocyc": [ + "WATER", + "OH", + "OXONIUM" + ], + "cas": [ + "7732-18-5", + "7732-18-5" + ], + "chebi": [ + "CHEBI:15377", + "CHEBI:13365", + "CHEBI:41979", + "CHEBI:16234", + "CHEBI:36385", + "CHEBI:42857", + "CHEBI:27313", + "CHEBI:44819", + "CHEBI:29373", + "CHEBI:10743", + "CHEBI:5594", + "CHEBI:29356", + "CHEBI:53442", + "CHEBI:29375", + "CHEBI:29374", + "CHEBI:13419", + "CHEBI:43228", + "CHEBI:44292", + "CHEBI:13352", + "CHEBI:41981", + "CHEBI:29412", + "CHEBI:42043", + "CHEBI:33811", + "CHEBI:33813", + "CHEBI:35511", + "CHEBI:5585", + "CHEBI:44641", + "CHEBI:44701" + ], + "hmdb": [ + "HMDB01039", + "HMDB02111" + ], + "kegg.compound": [ + "C01328", + "C00001", + "C18714", + "C18712" + ], + "kegg.drug": [ + "D00001", + "D06322", + "D03703" + ], + "pubchem.substance": "3303", + "reactome": [ + "REACT_947593", + "REACT_189422", + "REACT_141343", + "REACT_113518", + "REACT_1605715", + "REACT_109276", + "REACT_113521", + "REACT_113519", + "REACT_2022884", + "REACT_351603", + "REACT_29356" + ], + "seed.compound": [ + "cpd15275", + "cpd00001" + ], + "unipathway.compound": [ + "UPC00001", + "UPC01328" + ] + }, + "charge": 0, + "compartment": "e", + "formula": "H2O", + "id": "h2o_e", + "name": "H2O" + }, + { + "annotation": { + "bigg.metabolite": "h", + "biocyc": "PROTON", + "cas": [ + "12408-02-5", + "12408-02-5" + ], + "chebi": [ + "CHEBI:24636", + "CHEBI:15378", + "CHEBI:10744", + "CHEBI:13357", + "CHEBI:5584" + ], + "kegg.compound": "C00080", + "pubchem.substance": "3380", + "reactome": [ + "REACT_194688", + "REACT_425978", + "REACT_193465", + "REACT_374900", + "REACT_74722", + "REACT_425999", + "REACT_428040", + "REACT_163953", + "REACT_372511", + "REACT_2000349", + "REACT_70106", + "REACT_1470067", + "REACT_113529", + "REACT_425969", + "REACT_428548", + "REACT_156540", + "REACT_1614597", + "REACT_351626", + "REACT_427899" + ], + "seed.compound": "cpd00067", + "unipathway.compound": "UPC00080" + }, + "charge": 1, + "compartment": "c", + "formula": "H", + "id": "h_c", + "name": "H+" + }, + { + "annotation": { + "bigg.metabolite": "h", + "biocyc": "PROTON", + "cas": [ + "12408-02-5", + "12408-02-5" + ], + "chebi": [ + "CHEBI:24636", + "CHEBI:15378", + "CHEBI:10744", + "CHEBI:13357", + "CHEBI:5584" + ], + "kegg.compound": "C00080", + "pubchem.substance": "3380", + "reactome": [ + "REACT_194688", + "REACT_425978", + "REACT_193465", + "REACT_374900", + "REACT_74722", + "REACT_425999", + "REACT_428040", + "REACT_163953", + "REACT_372511", + "REACT_2000349", + "REACT_70106", + "REACT_1470067", + "REACT_113529", + "REACT_425969", + "REACT_428548", + "REACT_156540", + "REACT_1614597", + "REACT_351626", + "REACT_427899" + ], + "seed.compound": "cpd00067", + "unipathway.compound": "UPC00080" + }, + "charge": 1, + "compartment": "e", + "formula": "H", + "id": "h_e", + "name": "H+" + }, + { + "charge": -1, + "compartment": "c", + "formula": "C3H5O3", + "id": "lac__D_c", + "name": "D-Lactate" + }, + { + "charge": -1, + "compartment": "e", + "formula": "C3H5O3", + "id": "lac__D_e", + "name": "D-Lactate" + }, + { + "annotation": { + "bigg.metabolite": "nad", + "biocyc": "NAD", + "cas": [ + "53-84-9", + "53-84-9" + ], + "chebi": [ + "CHEBI:21901", + "CHEBI:7422", + "CHEBI:44214", + "CHEBI:15846", + "CHEBI:13394", + "CHEBI:13393", + "CHEBI:44215", + "CHEBI:13389", + "CHEBI:57540", + "CHEBI:44281" + ], + "hmdb": "HMDB00902", + "kegg.compound": "C00003", + "kegg.drug": "D00002", + "pubchem.substance": "3305", + "reactome": [ + "REACT_192307", + "REACT_29360", + "REACT_427523", + "REACT_194653", + "REACT_113526" + ], + "seed.compound": "cpd00003", + "unipathway.compound": "UPC00003" + }, + "charge": -1, + "compartment": "c", + "formula": "C21H26N7O14P2", + "id": "nad_c", + "name": "Nicotinamide adenine dinucleotide" + }, + { + "annotation": { + "bigg.metabolite": "nadh", + "biocyc": "NADH", + "cas": [ + "58-68-4", + "58-68-4" + ], + "chebi": [ + "CHEBI:13395", + "CHEBI:21902", + "CHEBI:16908", + "CHEBI:7423", + "CHEBI:44216", + "CHEBI:57945", + "CHEBI:13396" + ], + "hmdb": "HMDB01487", + "kegg.compound": "C00004", + "pubchem.substance": "3306", + "reactome": [ + "REACT_192305", + "REACT_73473", + "REACT_194697", + "REACT_29362" + ], + "seed.compound": "cpd00004", + "unipathway.compound": "UPC00004" + }, + "charge": -2, + "compartment": "c", + "formula": "C21H27N7O14P2", + "id": "nadh_c", + "name": "Nicotinamide adenine dinucleotide - reduced" + }, + { + "annotation": { + "bigg.metabolite": "pep", + "biocyc": "PHOSPHO-ENOL-PYRUVATE", + "cas": [ + "138-08-9", + "138-08-9" + ], + "chebi": [ + "CHEBI:44897", + "CHEBI:44894", + "CHEBI:14812", + "CHEBI:8147", + "CHEBI:26055", + "CHEBI:26054", + "CHEBI:58702", + "CHEBI:18021" + ], + "hmdb": "HMDB00263", + "kegg.compound": "C00074", + "pubchem.substance": "3374", + "reactome": [ + "REACT_29492", + "REACT_372364" + ], + "seed.compound": "cpd00061", + "unipathway.compound": "UPC00074" + }, + "charge": -3, + "compartment": "c", + "formula": "C3H2O6P", + "id": "pep_c", + "name": "Phosphoenolpyruvate" + }, + { + "annotation": { + "bigg.metabolite": "pi", + "biocyc": [ + "Pi", + "PHOSPHATE-GROUP", + "CPD0-1421" + ], + "cas": [ + "14265-44-2", + "14265-44-2" + ], + "chebi": [ + "CHEBI:37583", + "CHEBI:7793", + "CHEBI:37585", + "CHEBI:34683", + "CHEBI:14791", + "CHEBI:34855", + "CHEBI:29137", + "CHEBI:29139", + "CHEBI:63036", + "CHEBI:26020", + "CHEBI:39739", + "CHEBI:32597", + "CHEBI:32596", + "CHEBI:43474", + "CHEBI:63051", + "CHEBI:43470", + "CHEBI:9679", + "CHEBI:35433", + "CHEBI:4496", + "CHEBI:45024", + "CHEBI:18367", + "CHEBI:26078", + "CHEBI:39745", + "CHEBI:24838" + ], + "hmdb": "HMDB02142", + "kegg.compound": [ + "C13556", + "C13558", + "C00009" + ], + "kegg.drug": "D05467", + "pubchem.substance": "3311", + "reactome": [ + "REACT_947590", + "REACT_109277", + "REACT_113548", + "REACT_2255331", + "REACT_29372", + "REACT_113550", + "REACT_113551" + ], + "seed.compound": [ + "cpd09464", + "cpd09463", + "cpd00009" + ], + "unipathway.compound": "UPC00009" + }, + "charge": -2, + "compartment": "c", + "formula": "HO4P", + "id": "pi_c", + "name": "Phosphate" + }, + { + "annotation": { + "bigg.metabolite": "pi", + "biocyc": [ + "Pi", + "PHOSPHATE-GROUP", + "CPD0-1421" + ], + "cas": [ + "14265-44-2", + "14265-44-2" + ], + "chebi": [ + "CHEBI:37583", + "CHEBI:7793", + "CHEBI:37585", + "CHEBI:34683", + "CHEBI:14791", + "CHEBI:34855", + "CHEBI:29137", + "CHEBI:29139", + "CHEBI:63036", + "CHEBI:26020", + "CHEBI:39739", + "CHEBI:32597", + "CHEBI:32596", + "CHEBI:43474", + "CHEBI:63051", + "CHEBI:43470", + "CHEBI:9679", + "CHEBI:35433", + "CHEBI:4496", + "CHEBI:45024", + "CHEBI:18367", + "CHEBI:26078", + "CHEBI:39745", + "CHEBI:24838" + ], + "hmdb": "HMDB02142", + "kegg.compound": [ + "C13556", + "C13558", + "C00009" + ], + "kegg.drug": "D05467", + "pubchem.substance": "3311", + "reactome": [ + "REACT_947590", + "REACT_109277", + "REACT_113548", + "REACT_2255331", + "REACT_29372", + "REACT_113550", + "REACT_113551" + ], + "seed.compound": [ + "cpd09464", + "cpd09463", + "cpd00009" + ], + "unipathway.compound": "UPC00009" + }, + "charge": -2, + "compartment": "e", + "formula": "HO4P", + "id": "pi_e", + "name": "Phosphate" + }, + { + "annotation": { + "bigg.metabolite": "pyr", + "biocyc": "PYRUVATE", + "cas": [ + "127-17-3", + "127-17-3" + ], + "chebi": [ + "CHEBI:15361", + "CHEBI:14987", + "CHEBI:8685", + "CHEBI:32816", + "CHEBI:45253", + "CHEBI:26466", + "CHEBI:26462" + ], + "hmdb": "HMDB00243", + "kegg.compound": "C00022", + "lipidmaps": "LMFA01060077", + "pubchem.substance": "3324", + "reactome": [ + "REACT_113557", + "REACT_389680", + "REACT_29398" + ], + "seed.compound": "cpd00020", + "unipathway.compound": "UPC00022" + }, + "charge": -1, + "compartment": "c", + "formula": "C3H3O3", + "id": "pyr_c", + "name": "Pyruvate" + } + ], + "reactions": [ + { + "annotation": { + "bigg.reaction": "ATPM" + }, + "gene_reaction_rule": "", + "id": "ATPM", + "lower_bound": 8.39, + "metabolites": { + "adp_c": 1.0, + "atp_c": -1.0, + "h2o_c": -1.0, + "h_c": 1.0, + "pi_c": 1.0 + }, + "name": "ATP maintenance requirement", + "objective_coefficient": 1.0, + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "b3603 or b2975", + "id": "D_LACt2", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1, + "h_e": -1, + "lac__D_c": 1, + "lac__D_e": -1 + }, + "name": "", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "ENO" + }, + "gene_reaction_rule": "b2779", + "id": "ENO", + "lower_bound": -1000.0, + "metabolites": { + "2pg_c": -1.0, + "h2o_c": 1.0, + "pep_c": 1.0 + }, + "name": "enolase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "SBO": "SBO:0000627", + "bigg.reaction": "glc" + }, + "gene_reaction_rule": "", + "id": "EX_glc__D_e", + "lower_bound": -10.0, + "metabolites": { + "glc__D_e": -1.0 + }, + "name": "D-Glucose exchange", + "upper_bound": 1000.0 + }, + { + "annotation": { + "SBO": "SBO:0000627", + "bigg.reaction": "h" + }, + "gene_reaction_rule": "", + "id": "EX_h_e", + "lower_bound": -1000.0, + "metabolites": { + "h_e": -1.0 + }, + "name": "H+ exchange", + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "", + "id": "EX_lac__D_e", + "lower_bound": 0.0, + "metabolites": { + "lac__D_e": -1.0 + }, + "name": "D-lactate exchange", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "FBA" + }, + "gene_reaction_rule": "b1773 or b2097 or b2925", + "id": "FBA", + "lower_bound": -1000.0, + "metabolites": { + "dhap_c": 1.0, + "fdp_c": -1.0, + "g3p_c": 1.0 + }, + "name": "fructose-bisphosphate aldolase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "GAPD" + }, + "gene_reaction_rule": "b1779", + "id": "GAPD", + "lower_bound": -1000.0, + "metabolites": { + "13dpg_c": 1.0, + "g3p_c": -1.0, + "h_c": 1.0, + "nad_c": -1.0, + "nadh_c": 1.0, + "pi_c": -1.0 + }, + "name": "glyceraldehyde-3-phosphate dehydrogenase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "GLCpts" + }, + "gene_reaction_rule": "( b2417 and b1621 and b2415 and b2416 ) or ( b2417 and b1101 and b2415 and b2416 ) or ( b1817 and b1818 and b1819 and b2415 and b2416 )", + "id": "GLCpts", + "lower_bound": 0.0, + "metabolites": { + "g6p_c": 1.0, + "glc__D_e": -1.0, + "pep_c": -1.0, + "pyr_c": 1.0 + }, + "name": "D-glucose transport via PEP:Pyr PTS", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "H2Ot" + }, + "gene_reaction_rule": "b0875 or s0001", + "id": "H2Ot", + "lower_bound": -1000.0, + "metabolites": { + "h2o_c": 1.0, + "h2o_e": -1.0 + }, + "name": "R H2O transport via - diffusion", + "upper_bound": 1000.0 + }, + { + "gene_reaction_rule": "b2133 or b1380", + "id": "LDH_D", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1.0, + "lac__D_c": -1.0, + "nad_c": -1.0, + "nadh_c": 1.0, + "pyr_c": 1.0 + }, + "name": "D-lactate dehydrogenase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PFK" + }, + "gene_reaction_rule": "b3916 or b1723", + "id": "PFK", + "lower_bound": 0.0, + "metabolites": { + "adp_c": 1.0, + "atp_c": -1.0, + "f6p_c": -1.0, + "fdp_c": 1.0, + "h_c": 1.0 + }, + "name": "phosphofructokinase", + "objective_coefficient": 1.0, + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGI" + }, + "gene_reaction_rule": "b4025", + "id": "PGI", + "lower_bound": -1000.0, + "metabolites": { + "f6p_c": 1.0, + "g6p_c": -1.0 + }, + "name": "glucose-6-phosphate isomerase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGK" + }, + "gene_reaction_rule": "b2926", + "id": "PGK", + "lower_bound": -1000.0, + "metabolites": { + "13dpg_c": 1.0, + "3pg_c": -1.0, + "adp_c": 1.0, + "atp_c": -1.0 + }, + "name": "phosphoglycerate kinase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PGM" + }, + "gene_reaction_rule": "b4395 or b3612 or b0755", + "id": "PGM", + "lower_bound": -1000.0, + "metabolites": { + "2pg_c": -1.0, + "3pg_c": 1.0 + }, + "name": "phosphoglycerate mutase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PIt2r" + }, + "gene_reaction_rule": "b2987 or b3493", + "id": "PIt2r", + "lower_bound": -1000.0, + "metabolites": { + "h_c": 1.0, + "h_e": -1.0, + "pi_c": 1.0, + "pi_e": -1.0 + }, + "name": "R phosphate reversible transport via - symport", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "PYK" + }, + "gene_reaction_rule": "b1854 or b1676", + "id": "PYK", + "lower_bound": 0.0, + "metabolites": { + "adp_c": -1.0, + "atp_c": 1.0, + "h_c": -1.0, + "pep_c": -1.0, + "pyr_c": 1.0 + }, + "name": "pyruvate kinase", + "upper_bound": 1000.0 + }, + { + "annotation": { + "bigg.reaction": "TPI" + }, + "gene_reaction_rule": "b3919", + "id": "TPI", + "lower_bound": -1000.0, + "metabolites": { + "dhap_c": -1.0, + "g3p_c": 1.0 + }, + "name": "triose-phosphate isomerase", + "upper_bound": 1000.0 + } + ], + "version": 1 +} \ No newline at end of file diff --git a/cobra/test/data/mini_legacy.yml b/cobra/test/data/mini_legacy.yml new file mode 100644 index 000000000..88327a35f --- /dev/null +++ b/cobra/test/data/mini_legacy.yml @@ -0,0 +1,1148 @@ +!!omap +- reactions: + - !!omap + - id: ATPM + - name: ATP maintenance requirement + - metabolites: !!omap + - adp_c: 1.0 + - atp_c: -1.0 + - h_c: 1.0 + - h2o_c: -1.0 + - pi_c: 1.0 + - lower_bound: 8.39 + - upper_bound: 1000.0 + - gene_reaction_rule: '' + - objective_coefficient: 1.0 + - annotation: + bigg.reaction: ATPM + - !!omap + - id: D_LACt2 + - name: '' + - metabolites: !!omap + - h_e: -1 + - lac__D_e: -1 + - h_c: 1 + - lac__D_c: 1 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b3603 or b2975 + - !!omap + - id: ENO + - name: enolase + - metabolites: !!omap + - pep_c: 1.0 + - h2o_c: 1.0 + - 2pg_c: -1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b2779 + - annotation: + bigg.reaction: ENO + - !!omap + - id: EX_glc__D_e + - name: D-Glucose exchange + - metabolites: !!omap + - glc__D_e: -1.0 + - lower_bound: -10.0 + - upper_bound: 1000.0 + - gene_reaction_rule: '' + - annotation: + bigg.reaction: glc + SBO: SBO:0000627 + - !!omap + - id: EX_h_e + - name: H+ exchange + - metabolites: !!omap + - h_e: -1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: '' + - annotation: + bigg.reaction: h + SBO: SBO:0000627 + - !!omap + - id: EX_lac__D_e + - name: D-lactate exchange + - metabolites: !!omap + - lac__D_e: -1.0 + - lower_bound: 0.0 + - upper_bound: 1000.0 + - gene_reaction_rule: '' + - !!omap + - id: FBA + - name: fructose-bisphosphate aldolase + - metabolites: !!omap + - dhap_c: 1.0 + - fdp_c: -1.0 + - g3p_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b1773 or b2097 or b2925 + - annotation: + bigg.reaction: FBA + - !!omap + - id: GAPD + - name: glyceraldehyde-3-phosphate dehydrogenase + - metabolites: !!omap + - nad_c: -1.0 + - 13dpg_c: 1.0 + - g3p_c: -1.0 + - nadh_c: 1.0 + - h_c: 1.0 + - pi_c: -1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b1779 + - annotation: + bigg.reaction: GAPD + - !!omap + - id: GLCpts + - name: D-glucose transport via PEP:Pyr PTS + - metabolites: !!omap + - pep_c: -1.0 + - g6p_c: 1.0 + - glc__D_e: -1.0 + - pyr_c: 1.0 + - lower_bound: 0.0 + - upper_bound: 1000.0 + - gene_reaction_rule: ( b2417 and b1621 and b2415 and b2416 ) or ( b2417 and b1101 + and b2415 and b2416 ) or ( b1817 and b1818 and b1819 and b2415 and b2416 ) + - annotation: + bigg.reaction: GLCpts + - !!omap + - id: H2Ot + - name: R H2O transport via - diffusion + - metabolites: !!omap + - h2o_e: -1.0 + - h2o_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b0875 or s0001 + - annotation: + bigg.reaction: H2Ot + - !!omap + - id: LDH_D + - name: D-lactate dehydrogenase + - metabolites: !!omap + - nad_c: -1.0 + - lac__D_c: -1.0 + - h_c: 1.0 + - nadh_c: 1.0 + - pyr_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b2133 or b1380 + - !!omap + - id: PFK + - name: phosphofructokinase + - metabolites: !!omap + - f6p_c: -1.0 + - atp_c: -1.0 + - fdp_c: 1.0 + - h_c: 1.0 + - adp_c: 1.0 + - lower_bound: 0.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b3916 or b1723 + - objective_coefficient: 1.0 + - annotation: + bigg.reaction: PFK + - !!omap + - id: PGI + - name: glucose-6-phosphate isomerase + - metabolites: !!omap + - f6p_c: 1.0 + - g6p_c: -1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b4025 + - annotation: + bigg.reaction: PGI + - !!omap + - id: PGK + - name: phosphoglycerate kinase + - metabolites: !!omap + - 3pg_c: -1.0 + - atp_c: -1.0 + - 13dpg_c: 1.0 + - adp_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b2926 + - annotation: + bigg.reaction: PGK + - !!omap + - id: PGM + - name: phosphoglycerate mutase + - metabolites: !!omap + - 3pg_c: 1.0 + - 2pg_c: -1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b4395 or b3612 or b0755 + - annotation: + bigg.reaction: PGM + - !!omap + - id: PIt2r + - name: R phosphate reversible transport via - symport + - metabolites: !!omap + - h_c: 1.0 + - pi_e: -1.0 + - h_e: -1.0 + - pi_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b2987 or b3493 + - annotation: + bigg.reaction: PIt2r + - !!omap + - id: PYK + - name: pyruvate kinase + - metabolites: !!omap + - pep_c: -1.0 + - h_c: -1.0 + - atp_c: 1.0 + - pyr_c: 1.0 + - adp_c: -1.0 + - lower_bound: 0.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b1854 or b1676 + - annotation: + bigg.reaction: PYK + - !!omap + - id: TPI + - name: triose-phosphate isomerase + - metabolites: !!omap + - dhap_c: -1.0 + - g3p_c: 1.0 + - lower_bound: -1000.0 + - upper_bound: 1000.0 + - gene_reaction_rule: b3919 + - annotation: + bigg.reaction: TPI +- metabolites: + - !!omap + - id: 13dpg_c + - name: 3-Phospho-D-glyceroyl phosphate + - compartment: c + - charge: -4 + - formula: C3H4O10P2 + - annotation: + pubchem.substance: '3535' + biocyc: DPG + kegg.compound: C00236 + seed.compound: cpd00203 + reactome: REACT_29800 + bigg.metabolite: 13dpg + hmdb: HMDB01270 + chebi: + - CHEBI:16001 + - CHEBI:1658 + - CHEBI:20189 + - CHEBI:57604 + - CHEBI:11881 + unipathway.compound: UPC00236 + - !!omap + - id: 2pg_c + - name: D-Glycerate 2-phosphate + - compartment: c + - charge: -3 + - formula: C3H4O7P + - annotation: + pubchem.substance: '3904' + biocyc: 2-PG + kegg.compound: C00631 + seed.compound: cpd00482 + reactome: REACT_30485 + bigg.metabolite: 2pg + hmdb: + - HMDB03391 + - HMDB00362 + chebi: + - CHEBI:1267 + - CHEBI:58289 + - CHEBI:17835 + - CHEBI:21028 + - CHEBI:11651 + - CHEBI:12986 + - CHEBI:24344 + - CHEBI:39868 + unipathway.compound: UPC00631 + - !!omap + - id: 3pg_c + - name: 3-Phospho-D-glycerate + - compartment: c + - charge: -3 + - formula: C3H4O7P + - annotation: + pubchem.substance: '3497' + biocyc: G3P + kegg.compound: + - C00197 + - C00597 + seed.compound: cpd00169 + reactome: REACT_29728 + bigg.metabolite: 3pg + hmdb: HMDB00807 + chebi: + - CHEBI:40016 + - CHEBI:58272 + - CHEBI:57998 + - CHEBI:11879 + - CHEBI:1657 + - CHEBI:1659 + - CHEBI:17050 + - CHEBI:21029 + - CHEBI:11882 + - CHEBI:11880 + - CHEBI:12987 + - CHEBI:17794 + - CHEBI:24345 + unipathway.compound: + - UPC00597 + - UPC00197 + - !!omap + - id: adp_c + - name: ADP + - compartment: c + - charge: -3 + - formula: C10H12N5O10P2 + - annotation: + kegg.glycan: G11113 + biocyc: + - ADP + - ADP-GROUP + chebi: + - CHEBI:13222 + - CHEBI:16761 + - CHEBI:2342 + - CHEBI:22244 + - CHEBI:40553 + - CHEBI:456216 + unipathway.compound: UPC00008 + seed.compound: cpd00008 + reactome: + - REACT_190072 + - REACT_481002 + - REACT_211606 + - REACT_429160 + - REACT_29370 + - REACT_196180 + - REACT_113581 + - REACT_113582 + - REACT_114564 + - REACT_114565 + - REACT_429153 + bigg.metabolite: adp + hmdb: HMDB01341 + pubchem.substance: '3310' + cas: + - 58-64-0 + - 58-64-0 + kegg.compound: C00008 + - !!omap + - id: atp_c + - name: ATP + - compartment: c + - charge: -4 + - formula: C10H12N5O13P3 + - annotation: + pubchem.substance: '3304' + biocyc: ATP + chebi: + - CHEBI:40938 + - CHEBI:15422 + - CHEBI:57299 + - CHEBI:13236 + - CHEBI:10789 + - CHEBI:30616 + - CHEBI:22249 + - CHEBI:10841 + - CHEBI:2359 + unipathway.compound: UPC00002 + seed.compound: cpd00002 + reactome: + - REACT_190078 + - REACT_113592 + - REACT_113593 + - REACT_114570 + - REACT_29358 + - REACT_389573 + - REACT_139836 + - REACT_211579 + bigg.metabolite: atp + hmdb: HMDB00538 + kegg.drug: D08646 + cas: + - 56-65-5 + - 56-65-5 + kegg.compound: C00002 + - !!omap + - id: dhap_c + - name: Dihydroxyacetone phosphate + - compartment: c + - charge: -2 + - formula: C3H5O6P + - annotation: + pubchem.substance: '3411' + biocyc: DIHYDROXY-ACETONE-PHOSPHATE + chebi: + - CHEBI:14341 + - CHEBI:57642 + - CHEBI:14342 + - CHEBI:16108 + - CHEBI:5454 + - CHEBI:24355 + - CHEBI:39571 + unipathway.compound: UPC00111 + seed.compound: cpd00095 + reactome: + - REACT_188451 + - REACT_75970 + - REACT_390404 + bigg.metabolite: dhap + hmdb: + - HMDB01473 + - HMDB11735 + cas: + - 57-04-5 + - 57-04-5 + kegg.compound: C00111 + - !!omap + - id: f6p_c + - name: D-Fructose 6-phosphate + - compartment: c + - charge: -2 + - formula: C6H11O9P + - annotation: + pubchem.substance: '3385' + biocyc: FRUCTOSE-6P + chebi: + - CHEBI:57634 + - CHEBI:12352 + - CHEBI:45804 + - CHEBI:61527 + - CHEBI:61553 + - CHEBI:10375 + - CHEBI:16084 + - CHEBI:42378 + - CHEBI:22768 + unipathway.compound: + - UPC05345 + - UPC00085 + seed.compound: cpd00072 + bigg.metabolite: f6p + hmdb: HMDB03971 + cas: + - 643-13-0 + - 643-13-0 + kegg.compound: + - C05345 + - C00085 + - !!omap + - id: fdp_c + - name: D-Fructose 1,6-bisphosphate + - compartment: c + - charge: -4 + - formula: C6H10O12P2 + - annotation: + pubchem.substance: '3647' + biocyc: FRUCTOSE-16-DIPHOSPHATE + chebi: + - CHEBI:32968 + - CHEBI:49299 + - CHEBI:42553 + - CHEBI:32966 + - CHEBI:37736 + - CHEBI:28013 + - CHEBI:32967 + - CHEBI:41014 + - CHEBI:22767 + - CHEBI:10374 + - CHEBI:40595 + - CHEBI:40591 + unipathway.compound: UPC00354 + seed.compound: cpd00290 + bigg.metabolite: fdp + cas: + - 488-69-7 + - 488-69-7 + kegg.compound: + - C05378 + - C00354 + - !!omap + - id: g3p_c + - name: Glyceraldehyde 3-phosphate + - compartment: c + - charge: -2 + - formula: C3H5O6P + - annotation: + pubchem.substance: '3930' + chebi: + - CHEBI:17138 + - CHEBI:14333 + - CHEBI:5446 + - CHEBI:58027 + unipathway.compound: + - UPC00661 + - UPC00118 + seed.compound: cpd00102 + bigg.metabolite: g3p + hmdb: HMDB01112 + cas: + - 142-10-9 + - 142-10-9 + kegg.compound: + - C00661 + - C00118 + - !!omap + - id: g6p_c + - name: D-Glucose 6-phosphate + - compartment: c + - charge: -2 + - formula: C6H11O9P + - annotation: + pubchem.substance: '3392' + biocyc: + - D-glucose-6-phosphate + - GLC-6-P + chebi: + - CHEBI:10399 + - CHEBI:22797 + - CHEBI:41041 + - CHEBI:17719 + - CHEBI:4170 + - CHEBI:61548 + - CHEBI:58247 + - CHEBI:12375 + unipathway.compound: UPC00092 + seed.compound: cpd00079 + reactome: REACT_1629756 + bigg.metabolite: g6p + hmdb: + - HMDB03498 + - HMDB06793 + - HMDB01401 + - HMDB01549 + cas: + - 56-73-5 + - 56-73-5 + kegg.compound: + - C00092 + - C01172 + - !!omap + - id: glc__D_e + - name: D-Glucose + - compartment: e + - charge: 0 + - formula: C6H12O6 + - annotation: + bigg.metabolite: glc__D + pubchem.substance: '3333' + cas: + - 50-99-7 + - 50-99-7 + kegg.compound: C00031 + - !!omap + - id: h2o_c + - name: H2O + - compartment: c + - charge: 0 + - formula: H2O + - annotation: + pubchem.substance: '3303' + biocyc: + - WATER + - OH + - OXONIUM + chebi: + - CHEBI:15377 + - CHEBI:13365 + - CHEBI:41979 + - CHEBI:16234 + - CHEBI:36385 + - CHEBI:42857 + - CHEBI:27313 + - CHEBI:44819 + - CHEBI:29373 + - CHEBI:10743 + - CHEBI:5594 + - CHEBI:29356 + - CHEBI:53442 + - CHEBI:29375 + - CHEBI:29374 + - CHEBI:13419 + - CHEBI:43228 + - CHEBI:44292 + - CHEBI:13352 + - CHEBI:41981 + - CHEBI:29412 + - CHEBI:42043 + - CHEBI:33811 + - CHEBI:33813 + - CHEBI:35511 + - CHEBI:5585 + - CHEBI:44641 + - CHEBI:44701 + unipathway.compound: + - UPC00001 + - UPC01328 + seed.compound: + - cpd15275 + - cpd00001 + reactome: + - REACT_947593 + - REACT_189422 + - REACT_141343 + - REACT_113518 + - REACT_1605715 + - REACT_109276 + - REACT_113521 + - REACT_113519 + - REACT_2022884 + - REACT_351603 + - REACT_29356 + bigg.metabolite: h2o + hmdb: + - HMDB01039 + - HMDB02111 + kegg.drug: + - D00001 + - D06322 + - D03703 + cas: + - 7732-18-5 + - 7732-18-5 + kegg.compound: + - C01328 + - C00001 + - C18714 + - C18712 + - !!omap + - id: h2o_e + - name: H2O + - compartment: e + - charge: 0 + - formula: H2O + - annotation: + pubchem.substance: '3303' + biocyc: + - WATER + - OH + - OXONIUM + chebi: + - CHEBI:15377 + - CHEBI:13365 + - CHEBI:41979 + - CHEBI:16234 + - CHEBI:36385 + - CHEBI:42857 + - CHEBI:27313 + - CHEBI:44819 + - CHEBI:29373 + - CHEBI:10743 + - CHEBI:5594 + - CHEBI:29356 + - CHEBI:53442 + - CHEBI:29375 + - CHEBI:29374 + - CHEBI:13419 + - CHEBI:43228 + - CHEBI:44292 + - CHEBI:13352 + - CHEBI:41981 + - CHEBI:29412 + - CHEBI:42043 + - CHEBI:33811 + - CHEBI:33813 + - CHEBI:35511 + - CHEBI:5585 + - CHEBI:44641 + - CHEBI:44701 + unipathway.compound: + - UPC00001 + - UPC01328 + seed.compound: + - cpd15275 + - cpd00001 + reactome: + - REACT_947593 + - REACT_189422 + - REACT_141343 + - REACT_113518 + - REACT_1605715 + - REACT_109276 + - REACT_113521 + - REACT_113519 + - REACT_2022884 + - REACT_351603 + - REACT_29356 + bigg.metabolite: h2o + hmdb: + - HMDB01039 + - HMDB02111 + kegg.drug: + - D00001 + - D06322 + - D03703 + cas: + - 7732-18-5 + - 7732-18-5 + kegg.compound: + - C01328 + - C00001 + - C18714 + - C18712 + - !!omap + - id: h_c + - name: H+ + - compartment: c + - charge: 1 + - formula: H + - annotation: + pubchem.substance: '3380' + biocyc: PROTON + chebi: + - CHEBI:24636 + - CHEBI:15378 + - CHEBI:10744 + - CHEBI:13357 + - CHEBI:5584 + unipathway.compound: UPC00080 + seed.compound: cpd00067 + reactome: + - REACT_194688 + - REACT_425978 + - REACT_193465 + - REACT_374900 + - REACT_74722 + - REACT_425999 + - REACT_428040 + - REACT_163953 + - REACT_372511 + - REACT_2000349 + - REACT_70106 + - REACT_1470067 + - REACT_113529 + - REACT_425969 + - REACT_428548 + - REACT_156540 + - REACT_1614597 + - REACT_351626 + - REACT_427899 + bigg.metabolite: h + cas: + - 12408-02-5 + - 12408-02-5 + kegg.compound: C00080 + - !!omap + - id: h_e + - name: H+ + - compartment: e + - charge: 1 + - formula: H + - annotation: + pubchem.substance: '3380' + biocyc: PROTON + chebi: + - CHEBI:24636 + - CHEBI:15378 + - CHEBI:10744 + - CHEBI:13357 + - CHEBI:5584 + unipathway.compound: UPC00080 + seed.compound: cpd00067 + reactome: + - REACT_194688 + - REACT_425978 + - REACT_193465 + - REACT_374900 + - REACT_74722 + - REACT_425999 + - REACT_428040 + - REACT_163953 + - REACT_372511 + - REACT_2000349 + - REACT_70106 + - REACT_1470067 + - REACT_113529 + - REACT_425969 + - REACT_428548 + - REACT_156540 + - REACT_1614597 + - REACT_351626 + - REACT_427899 + bigg.metabolite: h + cas: + - 12408-02-5 + - 12408-02-5 + kegg.compound: C00080 + - !!omap + - id: lac__D_c + - name: D-Lactate + - compartment: c + - charge: -1 + - formula: C3H5O3 + - !!omap + - id: lac__D_e + - name: D-Lactate + - compartment: e + - charge: -1 + - formula: C3H5O3 + - !!omap + - id: nad_c + - name: Nicotinamide adenine dinucleotide + - compartment: c + - charge: -1 + - formula: C21H26N7O14P2 + - annotation: + pubchem.substance: '3305' + biocyc: NAD + chebi: + - CHEBI:21901 + - CHEBI:7422 + - CHEBI:44214 + - CHEBI:15846 + - CHEBI:13394 + - CHEBI:13393 + - CHEBI:44215 + - CHEBI:13389 + - CHEBI:57540 + - CHEBI:44281 + unipathway.compound: UPC00003 + seed.compound: cpd00003 + reactome: + - REACT_192307 + - REACT_29360 + - REACT_427523 + - REACT_194653 + - REACT_113526 + bigg.metabolite: nad + hmdb: HMDB00902 + kegg.drug: D00002 + cas: + - 53-84-9 + - 53-84-9 + kegg.compound: C00003 + - !!omap + - id: nadh_c + - name: Nicotinamide adenine dinucleotide - reduced + - compartment: c + - charge: -2 + - formula: C21H27N7O14P2 + - annotation: + pubchem.substance: '3306' + biocyc: NADH + chebi: + - CHEBI:13395 + - CHEBI:21902 + - CHEBI:16908 + - CHEBI:7423 + - CHEBI:44216 + - CHEBI:57945 + - CHEBI:13396 + unipathway.compound: UPC00004 + seed.compound: cpd00004 + reactome: + - REACT_192305 + - REACT_73473 + - REACT_194697 + - REACT_29362 + bigg.metabolite: nadh + hmdb: HMDB01487 + cas: + - 58-68-4 + - 58-68-4 + kegg.compound: C00004 + - !!omap + - id: pep_c + - name: Phosphoenolpyruvate + - compartment: c + - charge: -3 + - formula: C3H2O6P + - annotation: + pubchem.substance: '3374' + biocyc: PHOSPHO-ENOL-PYRUVATE + chebi: + - CHEBI:44897 + - CHEBI:44894 + - CHEBI:14812 + - CHEBI:8147 + - CHEBI:26055 + - CHEBI:26054 + - CHEBI:58702 + - CHEBI:18021 + unipathway.compound: UPC00074 + seed.compound: cpd00061 + reactome: + - REACT_29492 + - REACT_372364 + bigg.metabolite: pep + hmdb: HMDB00263 + cas: + - 138-08-9 + - 138-08-9 + kegg.compound: C00074 + - !!omap + - id: pi_c + - name: Phosphate + - compartment: c + - charge: -2 + - formula: HO4P + - annotation: + pubchem.substance: '3311' + biocyc: + - Pi + - PHOSPHATE-GROUP + - CPD0-1421 + chebi: + - CHEBI:37583 + - CHEBI:7793 + - CHEBI:37585 + - CHEBI:34683 + - CHEBI:14791 + - CHEBI:34855 + - CHEBI:29137 + - CHEBI:29139 + - CHEBI:63036 + - CHEBI:26020 + - CHEBI:39739 + - CHEBI:32597 + - CHEBI:32596 + - CHEBI:43474 + - CHEBI:63051 + - CHEBI:43470 + - CHEBI:9679 + - CHEBI:35433 + - CHEBI:4496 + - CHEBI:45024 + - CHEBI:18367 + - CHEBI:26078 + - CHEBI:39745 + - CHEBI:24838 + unipathway.compound: UPC00009 + seed.compound: + - cpd09464 + - cpd09463 + - cpd00009 + reactome: + - REACT_947590 + - REACT_109277 + - REACT_113548 + - REACT_2255331 + - REACT_29372 + - REACT_113550 + - REACT_113551 + bigg.metabolite: pi + hmdb: HMDB02142 + kegg.drug: D05467 + cas: + - 14265-44-2 + - 14265-44-2 + kegg.compound: + - C13556 + - C13558 + - C00009 + - !!omap + - id: pi_e + - name: Phosphate + - compartment: e + - charge: -2 + - formula: HO4P + - annotation: + pubchem.substance: '3311' + biocyc: + - Pi + - PHOSPHATE-GROUP + - CPD0-1421 + chebi: + - CHEBI:37583 + - CHEBI:7793 + - CHEBI:37585 + - CHEBI:34683 + - CHEBI:14791 + - CHEBI:34855 + - CHEBI:29137 + - CHEBI:29139 + - CHEBI:63036 + - CHEBI:26020 + - CHEBI:39739 + - CHEBI:32597 + - CHEBI:32596 + - CHEBI:43474 + - CHEBI:63051 + - CHEBI:43470 + - CHEBI:9679 + - CHEBI:35433 + - CHEBI:4496 + - CHEBI:45024 + - CHEBI:18367 + - CHEBI:26078 + - CHEBI:39745 + - CHEBI:24838 + unipathway.compound: UPC00009 + seed.compound: + - cpd09464 + - cpd09463 + - cpd00009 + reactome: + - REACT_947590 + - REACT_109277 + - REACT_113548 + - REACT_2255331 + - REACT_29372 + - REACT_113550 + - REACT_113551 + bigg.metabolite: pi + hmdb: HMDB02142 + kegg.drug: D05467 + cas: + - 14265-44-2 + - 14265-44-2 + kegg.compound: + - C13556 + - C13558 + - C00009 + - !!omap + - id: pyr_c + - name: Pyruvate + - compartment: c + - charge: -1 + - formula: C3H3O3 + - annotation: + pubchem.substance: '3324' + biocyc: PYRUVATE + chebi: + - CHEBI:15361 + - CHEBI:14987 + - CHEBI:8685 + - CHEBI:32816 + - CHEBI:45253 + - CHEBI:26466 + - CHEBI:26462 + lipidmaps: LMFA01060077 + seed.compound: cpd00020 + kegg.compound: C00022 + reactome: + - REACT_113557 + - REACT_389680 + - REACT_29398 + bigg.metabolite: pyr + hmdb: HMDB00243 + cas: + - 127-17-3 + - 127-17-3 + unipathway.compound: UPC00022 +- genes: + - !!omap + - id: b0755 + - name: gpmA + - !!omap + - id: b0875 + - name: aqpZ + - !!omap + - id: b1101 + - name: ptsG + - !!omap + - id: b1380 + - name: ldhA + - !!omap + - id: b1621 + - name: malX + - !!omap + - id: b1676 + - name: pykF + - annotation: + ncbigi: + - GI:1208453 + - GI:1652654 + - !!omap + - id: b1723 + - name: pfkB + - !!omap + - id: b1773 + - name: ydjI + - !!omap + - id: b1779 + - name: gapA + - !!omap + - id: b1817 + - name: manX + - !!omap + - id: b1818 + - name: manY + - !!omap + - id: b1819 + - name: manZ + - !!omap + - id: b1854 + - name: pykA + - !!omap + - id: b2097 + - name: fbaB + - !!omap + - id: b2133 + - name: dld + - !!omap + - id: b2415 + - name: ptsH + - !!omap + - id: b2416 + - name: ptsI + - !!omap + - id: b2417 + - name: crr + - !!omap + - id: b2779 + - name: eno + - annotation: + ncbigi: GI:1653839 + - !!omap + - id: b2925 + - name: fbaA + - !!omap + - id: b2926 + - name: pgk + - annotation: + ncbigi: GI:1653609 + - !!omap + - id: b2975 + - name: glcA + - !!omap + - id: b2987 + - name: pitB + - !!omap + - id: b3493 + - name: pitA + - !!omap + - id: b3603 + - name: lldP + - !!omap + - id: b3612 + - name: gpmM + - !!omap + - id: b3916 + - name: pfkA + - annotation: + ncbigi: + - GI:1006614 + - GI:1651919 + - !!omap + - id: b3919 + - name: tpiA + - !!omap + - id: b4025 + - name: pgi + - annotation: + ncbigi: GI:1653253 + - !!omap + - id: b4395 + - name: ytjC + - !!omap + - id: s0001 + - name: G_s0001 +- id: mini_textbook +- compartments: + e: extracellular + c: cytosol +- version: 1 diff --git a/cobra/test/data/raven.pickle b/cobra/test/data/raven.pickle index adfaf9b65..b31f252df 100644 Binary files a/cobra/test/data/raven.pickle and b/cobra/test/data/raven.pickle differ diff --git a/cobra/test/data/salmonella.pickle b/cobra/test/data/salmonella.pickle index ba0568c82..e4d65505e 100644 Binary files a/cobra/test/data/salmonella.pickle and b/cobra/test/data/salmonella.pickle differ diff --git a/cobra/test/data/textbook_fva.json b/cobra/test/data/textbook_fva.json index f31092a84..29f5a6db1 100644 --- a/cobra/test/data/textbook_fva.json +++ b/cobra/test/data/textbook_fva.json @@ -1 +1 @@ -{"maximum": {"EX_fum_e": 0.0, "ACALDt": 0.0, "EX_glc__D_e": -10.0, "EX_mal__L_e": -0.0, "ADK1": -0.0, "ICL": -0.0, "TALA": 1.49698, "EX_ac_e": -0.0, "PGI": 4.86086, "ACKr": 0.0, "NADTRHD": -0.0, "SUCCt2_2": -0.0, "O2t": 21.79949, "EX_co2_e": 22.80983, "PTAr": -0.0, "EX_h2o_e": 29.17583, "GLUDy": -4.54186, "ACONTa": 6.00725, "GLCpts": 10.0, "GAPD": 16.02353, "TKT1": 1.49698, "TKT2": 1.1815, "NADH16": 38.53461, "EX_etoh_e": -0.0, "ME1": -0.0, "FBP": -0.0, "GLUt2r": 0.0, "SUCDi": 1000.0, "EX_h_e": 17.53087, "ACt2r": 0.0, "GLUSy": -0.0, "TPI": 7.47738, "PYRt2": 0.0, "PGM": -14.71614, "Biomass_Ecoli_core": 0.87392, "PFL": -0.0, "RPE": 2.67848, "RPI": -2.2815, "EX_succ_e": -0.0, "ACONTb": 6.00725, "EX_lac__D_e": -0.0, "PPC": 2.50431, "ALCD2x": 0.0, "AKGDH": 5.06438, "EX_acald_e": -0.0, "EX_nh4_e": -4.76532, "GLUN": -0.0, "EX_gln__L_e": 0.0, "EX_glu__L_e": -0.0, "GND": 4.95998, "PGL": 4.95998, "PPCK": -0.0, "ENO": 14.71614, "EX_fru_e": -0.0, "AKGt2r": 0.0, "SUCCt3": -0.0, "PDH": 9.28253, "EX_pyr_e": -0.0, "EX_o2_e": -21.79949, "PPS": -0.0, "H2Ot": -29.17583, "GLNabc": 0.0, "MDH": 5.06438, "EX_akg_e": -0.0, "ME2": -0.0, "FORt2": -0.0, "EX_for_e": -0.0, "SUCOAS": -5.06438, "PIt2r": 3.2149, "CS": 6.00725, "MALS": -0.0, "FBA": 7.47738, "FRUpts2": 0.0, "PYK": 1.75818, "ATPM": 8.39, "LDH_D": 0.0, "CYTBD": 43.59899, "NH4t": 4.76532, "CO2t": -22.80983, "THD2": -0.0, "ATPS4r": 45.51401, "D_LACt2": 0.0, "FRD7": 994.93562, "GLNS": 0.22346, "G6PDH2r": 4.95998, "MALt2_2": 0.0, "FORti": -0.0, "PFK": 7.47738, "ETOHt2r": 0.0, "ICDHyr": 6.00725, "PGK": -16.02353, "ACALD": 0.0, "FUMt2_2": 0.0, "FUM": 5.06438, "EX_pi_e": -3.2149}, "minimum": {"EX_fum_e": 0.0, "ACALDt": 0.0, "EX_glc__D_e": -10.0, "EX_mal__L_e": 0.0, "ADK1": 0.0, "ICL": 0.0, "TALA": 1.49698, "EX_ac_e": 0.0, "PGI": 4.86086, "ACKr": 0.0, "NADTRHD": 0.0, "SUCCt2_2": 0.0, "O2t": 21.79949, "EX_co2_e": 22.80983, "PTAr": 0.0, "EX_h2o_e": 29.17583, "GLUDy": -4.54186, "ACONTa": 6.00725, "GLCpts": 10.0, "GAPD": 16.02353, "TKT1": 1.49698, "TKT2": 1.1815, "NADH16": 38.53461, "EX_etoh_e": 0.0, "ME1": 0.0, "FBP": 0.0, "GLUt2r": 0.0, "SUCDi": 5.06438, "EX_h_e": 17.53087, "ACt2r": 0.0, "GLUSy": 0.0, "TPI": 7.47738, "PYRt2": 0.0, "PGM": -14.71614, "Biomass_Ecoli_core": 0.87392, "PFL": 0.0, "RPE": 2.67848, "RPI": -2.2815, "EX_succ_e": 0.0, "ACONTb": 6.00725, "EX_lac__D_e": 0.0, "PPC": 2.50431, "ALCD2x": 0.0, "AKGDH": 5.06438, "EX_acald_e": 0.0, "EX_nh4_e": -4.76532, "GLUN": 0.0, "EX_gln__L_e": 0.0, "EX_glu__L_e": 0.0, "GND": 4.95998, "PGL": 4.95998, "PPCK": 0.0, "ENO": 14.71614, "EX_fru_e": 0.0, "AKGt2r": 0.0, "SUCCt3": 0.0, "PDH": 9.28253, "EX_pyr_e": 0.0, "EX_o2_e": -21.79949, "PPS": 0.0, "H2Ot": -29.17583, "GLNabc": 0.0, "MDH": 5.06438, "EX_akg_e": 0.0, "ME2": 0.0, "FORt2": 0.0, "EX_for_e": 0.0, "SUCOAS": -5.06438, "PIt2r": 3.2149, "CS": 6.00725, "MALS": 0.0, "FBA": 7.47738, "FRUpts2": 0.0, "PYK": 1.75818, "ATPM": 8.39, "LDH_D": 0.0, "CYTBD": 43.59899, "NH4t": 4.76532, "CO2t": -22.80983, "THD2": 0.0, "ATPS4r": 45.51401, "D_LACt2": 0.0, "FRD7": 0.0, "GLNS": 0.22346, "G6PDH2r": 4.95998, "MALt2_2": 0.0, "FORti": -0.0, "PFK": 7.47738, "ETOHt2r": 0.0, "ICDHyr": 6.00725, "PGK": -16.02353, "ACALD": 0.0, "FUMt2_2": 0.0, "FUM": 5.06438, "EX_pi_e": -3.2149}} \ No newline at end of file +{"maximum": {"MDH": 5.06438, "MALS": -0.0, "EX_pyr_e": -0.0, "PYK": 1.75818, "MALt2_2": 0.0, "PPCK": -0.0, "FBA": 7.47738, "RPE": 2.67848, "EX_fum_e": 0.0, "CS": 6.00725, "EX_o2_e": -21.79949, "FRD7": 994.93562, "AKGDH": 5.06438, "FORt2": -0.0, "GLNabc": 0.0, "EX_fru_e": -0.0, "THD2": -0.0, "FUMt2_2": 0.0, "PYRt2": 0.0, "O2t": 21.79949, "ACALDt": 0.0, "EX_acald_e": -0.0, "Biomass_Ecoli_core": 0.87392, "ACONTa": 6.00725, "TKT2": 1.1815, "TKT1": 1.49698, "LDH_D": 0.0, "GLUDy": -4.54186, "ALCD2x": 0.0, "EX_h_e": 17.53087, "EX_mal__L_e": -0.0, "NADH16": 38.53461, "TALA": 1.49698, "ME1": -0.0, "FORti": -0.0, "ME2": -0.0, "EX_nh4_e": -4.76532, "ACKr": 0.0, "ENO": 14.71614, "ACt2r": 0.0, "NH4t": 4.76532, "ACONTb": 6.00725, "EX_akg_e": -0.0, "EX_ac_e": -0.0, "ATPS4r": 45.51401, "GLUN": -0.0, "FRUpts2": 0.0, "CYTBD": 43.59899, "ATPM": 8.39, "GLNS": 0.22346, "PFK": 7.47738, "NADTRHD": -0.0, "PGK": -16.02353, "EX_succ_e": -0.0, "PGL": 4.95998, "EX_gln__L_e": 0.0, "PTAr": -0.0, "RPI": -2.2815, "GAPD": 16.02353, "ICDHyr": 6.00725, "TPI": 7.47738, "EX_glc__D_e": -10.0, "ICL": -0.0, "GLUt2r": 0.0, "ADK1": -0.0, "EX_for_e": -0.0, "EX_etoh_e": -0.0, "EX_lac__D_e": -0.0, "D_LACt2": 0.0, "PGI": 4.86086, "GND": 4.95998, "PDH": 9.28253, "EX_glu__L_e": -0.0, "PIt2r": 3.2149, "SUCDi": 1000.0, "FBP": -0.0, "EX_co2_e": 22.80983, "SUCCt2_2": -0.0, "EX_pi_e": -3.2149, "PPC": 2.50431, "PGM": -14.71614, "FUM": 5.06438, "SUCCt3": -0.0, "EX_h2o_e": 29.17583, "SUCOAS": -5.06438, "ACALD": 0.0, "H2Ot": -29.17583, "PPS": -0.0, "GLUSy": -0.0, "PFL": -0.0, "CO2t": -22.80983, "ETOHt2r": 0.0, "GLCpts": 10.0, "G6PDH2r": 4.95998, "AKGt2r": 0.0}, "minimum": {"MDH": 5.06438, "MALS": 0.0, "EX_pyr_e": 0.0, "PYK": 1.75818, "MALt2_2": 0.0, "PPCK": 0.0, "FBA": 7.47738, "RPE": 2.67848, "EX_fum_e": 0.0, "CS": 6.00725, "EX_o2_e": -21.79949, "FRD7": 0.0, "AKGDH": 5.06438, "FORt2": 0.0, "GLNabc": 0.0, "EX_fru_e": 0.0, "THD2": 0.0, "FUMt2_2": 0.0, "PYRt2": 0.0, "O2t": 21.79949, "ACALDt": 0.0, "EX_acald_e": 0.0, "Biomass_Ecoli_core": 0.87392, "ACONTa": 6.00725, "TKT2": 1.1815, "TKT1": 1.49698, "LDH_D": 0.0, "GLUDy": -4.54186, "ALCD2x": 0.0, "EX_h_e": 17.53087, "EX_mal__L_e": 0.0, "NADH16": 38.53461, "TALA": 1.49698, "ME1": 0.0, "FORti": -0.0, "ME2": 0.0, "EX_nh4_e": -4.76532, "ACKr": 0.0, "ENO": 14.71614, "ACt2r": 0.0, "NH4t": 4.76532, "ACONTb": 6.00725, "EX_akg_e": 0.0, "EX_ac_e": 0.0, "ATPS4r": 45.51401, "GLUN": 0.0, "FRUpts2": 0.0, "CYTBD": 43.59899, "ATPM": 8.39, "GLNS": 0.22346, "PFK": 7.47738, "NADTRHD": 0.0, "PGK": -16.02353, "EX_succ_e": 0.0, "PGL": 4.95998, "EX_gln__L_e": 0.0, "PTAr": 0.0, "RPI": -2.2815, "GAPD": 16.02353, "ICDHyr": 6.00725, "TPI": 7.47738, "EX_glc__D_e": -10.0, "ICL": 0.0, "GLUt2r": 0.0, "ADK1": 0.0, "EX_for_e": 0.0, "EX_etoh_e": 0.0, "EX_lac__D_e": 0.0, "D_LACt2": 0.0, "PGI": 4.86086, "GND": 4.95998, "PDH": 9.28253, "EX_glu__L_e": 0.0, "PIt2r": 3.2149, "SUCDi": 5.06438, "FBP": 0.0, "EX_co2_e": 22.80983, "SUCCt2_2": 0.0, "EX_pi_e": -3.2149, "PPC": 2.50431, "PGM": -14.71614, "FUM": 5.06438, "SUCCt3": 0.0, "EX_h2o_e": 29.17583, "SUCOAS": -5.06438, "ACALD": 0.0, "H2Ot": -29.17583, "PPS": 0.0, "GLUSy": 0.0, "PFL": 0.0, "CO2t": -22.80983, "ETOHt2r": 0.0, "GLCpts": 10.0, "G6PDH2r": 4.95998, "AKGt2r": 0.0}} \ No newline at end of file diff --git a/cobra/test/data/textbook_pfba_fva.json b/cobra/test/data/textbook_pfba_fva.json index c8acb0281..6a357e464 100644 --- a/cobra/test/data/textbook_pfba_fva.json +++ b/cobra/test/data/textbook_pfba_fva.json @@ -1 +1 @@ -{"maximum": {"ACALD": 0.0, "ACALDt": 0.0, "ACKr": 0.0, "ACONTa": 6.00725, "ACONTb": 6.00725, "ACt2r": 0.0, "ADK1": -0.0, "AKGDH": 5.06438, "AKGt2r": 0.0, "ALCD2x": -0.0, "ATPM": 8.39, "ATPS4r": 45.51401, "Biomass_Ecoli_core": 0.87392, "CO2t": -22.80983, "CS": 6.00725, "CYTBD": 43.59899, "D_LACt2": 0.0, "ENO": 14.71614, "ETOHt2r": -0.0, "EX_ac_e": -0.0, "EX_acald_e": -0.0, "EX_akg_e": -0.0, "EX_co2_e": 22.80983, "EX_etoh_e": -0.0, "EX_for_e": -0.0, "EX_fru_e": -0.0, "EX_fum_e": 0.0, "EX_glc__D_e": -10.0, "EX_gln__L_e": 0.0, "EX_glu__L_e": -0.0, "EX_h2o_e": 29.17583, "EX_h_e": 17.53087, "EX_lac__D_e": -0.0, "EX_mal__L_e": -0.0, "EX_nh4_e": -4.76532, "EX_o2_e": -21.79949, "EX_pi_e": -3.2149, "EX_pyr_e": -0.0, "EX_succ_e": -0.0, "FBA": 7.47738, "FBP": -0.0, "FORt2": -0.0, "FORti": -0.0, "FRD7": 25.9211, "FRUpts2": 0.0, "FUM": 5.06438, "FUMt2_2": 0.0, "G6PDH2r": 4.95998, "GAPD": 16.02353, "GLCpts": 10.0, "GLNS": 0.22346, "GLNabc": 0.0, "GLUDy": -4.54186, "GLUN": -0.0, "GLUSy": -0.0, "GLUt2r": 0.0, "GND": 4.95998, "H2Ot": -29.17583, "ICDHyr": 6.00725, "ICL": -0.0, "LDH_D": 0.0, "MALS": -0.0, "MALt2_2": 0.0, "MDH": 5.06438, "ME1": -0.0, "ME2": -0.0, "NADH16": 38.53461, "NADTRHD": -0.0, "NH4t": 4.76532, "O2t": 21.79949, "PDH": 9.28253, "PFK": 7.47738, "PFL": -0.0, "PGI": 4.86086, "PGK": -16.02353, "PGL": 4.95998, "PGM": -14.71614, "PIt2r": 3.2149, "PPC": 2.50431, "PPCK": -0.0, "PPS": -0.0, "PTAr": -0.0, "PYK": 1.75818, "PYRt2": 0.0, "RPE": 2.67848, "RPI": -2.2815, "SUCCt2_2": -0.0, "SUCCt3": -0.0, "SUCDi": 30.98548, "SUCOAS": -5.06438, "TALA": 1.49698, "THD2": -0.0, "TKT1": 1.49698, "TKT2": 1.1815, "TPI": 7.47738}, "minimum": {"ACALD": 0.0, "ACALDt": 0.0, "ACKr": 0.0, "ACONTa": 6.00725, "ACONTb": 6.00725, "ACt2r": 0.0, "ADK1": 0.0, "AKGDH": 5.06438, "AKGt2r": 0.0, "ALCD2x": 0.0, "ATPM": 8.39, "ATPS4r": 45.51401, "Biomass_Ecoli_core": 0.87392, "CO2t": -22.80983, "CS": 6.00725, "CYTBD": 43.59899, "D_LACt2": 0.0, "ENO": 14.71614, "ETOHt2r": 0.0, "EX_ac_e": 0.0, "EX_acald_e": 0.0, "EX_akg_e": 0.0, "EX_co2_e": 22.80983, "EX_etoh_e": 0.0, "EX_for_e": 0.0, "EX_fru_e": 0.0, "EX_fum_e": 0.0, "EX_glc__D_e": -10.0, "EX_gln__L_e": 0.0, "EX_glu__L_e": 0.0, "EX_h2o_e": 29.17583, "EX_h_e": 17.53087, "EX_lac__D_e": 0.0, "EX_mal__L_e": 0.0, "EX_nh4_e": -4.76532, "EX_o2_e": -21.79949, "EX_pi_e": -3.2149, "EX_pyr_e": 0.0, "EX_succ_e": 0.0, "FBA": 7.47738, "FBP": 0.0, "FORt2": 0.0, "FORti": 0.0, "FRD7": 0.0, "FRUpts2": 0.0, "FUM": 5.06438, "FUMt2_2": 0.0, "G6PDH2r": 4.95998, "GAPD": 16.02353, "GLCpts": 10.0, "GLNS": 0.22346, "GLNabc": 0.0, "GLUDy": -4.54186, "GLUN": 0.0, "GLUSy": 0.0, "GLUt2r": 0.0, "GND": 4.95998, "H2Ot": -29.17583, "ICDHyr": 6.00725, "ICL": 0.0, "LDH_D": 0.0, "MALS": 0.0, "MALt2_2": 0.0, "MDH": 5.06438, "ME1": 0.0, "ME2": 0.0, "NADH16": 38.53461, "NADTRHD": 0.0, "NH4t": 4.76532, "O2t": 21.79949, "PDH": 9.28253, "PFK": 7.47738, "PFL": 0.0, "PGI": 4.86086, "PGK": -16.02353, "PGL": 4.95998, "PGM": -14.71614, "PIt2r": 3.2149, "PPC": 2.50431, "PPCK": 0.0, "PPS": 0.0, "PTAr": 0.0, "PYK": 1.75818, "PYRt2": 0.0, "RPE": 2.67848, "RPI": -2.2815, "SUCCt2_2": 0.0, "SUCCt3": 0.0, "SUCDi": 5.06438, "SUCOAS": -5.06438, "TALA": 1.49698, "THD2": 0.0, "TKT1": 1.49698, "TKT2": 1.1815, "TPI": 7.47738}} \ No newline at end of file +{"maximum": {"MDH": 5.06438, "MALS": -0.0, "EX_pyr_e": -0.0, "PYK": 1.75818, "MALt2_2": 0.0, "PPCK": -0.0, "FBA": 7.47738, "RPE": 2.67848, "EX_fum_e": 0.0, "CS": 6.00725, "EX_o2_e": -21.79949, "FRD7": 25.9211, "AKGDH": 5.06438, "FORt2": -0.0, "GLNabc": 0.0, "EX_fru_e": -0.0, "THD2": -0.0, "FUMt2_2": 0.0, "PYRt2": 0.0, "O2t": 21.79949, "ACALDt": 0.0, "EX_acald_e": -0.0, "Biomass_Ecoli_core": 0.87392, "ACONTa": 6.00725, "TKT2": 1.1815, "TKT1": 1.49698, "LDH_D": 0.0, "GLUDy": -4.54186, "ALCD2x": 0.0, "EX_h_e": 17.53087, "EX_mal__L_e": -0.0, "NADH16": 38.53461, "TALA": 1.49698, "ME1": -0.0, "FORti": -0.0, "ME2": -0.0, "EX_nh4_e": -4.76532, "ACKr": 0.0, "ENO": 14.71614, "ACt2r": 0.0, "NH4t": 4.76532, "ACONTb": 6.00725, "EX_akg_e": -0.0, "EX_ac_e": -0.0, "ATPS4r": 45.51401, "GLUN": -0.0, "FRUpts2": 0.0, "CYTBD": 43.59899, "ATPM": 8.39, "GLNS": 0.22346, "PFK": 7.47738, "NADTRHD": -0.0, "PGK": -16.02353, "EX_succ_e": -0.0, "PGL": 4.95998, "EX_gln__L_e": 0.0, "PTAr": -0.0, "RPI": -2.2815, "GAPD": 16.02353, "ICDHyr": 6.00725, "TPI": 7.47738, "EX_glc__D_e": -10.0, "ICL": -0.0, "GLUt2r": 0.0, "ADK1": -0.0, "EX_for_e": -0.0, "EX_etoh_e": -0.0, "EX_lac__D_e": -0.0, "D_LACt2": 0.0, "PGI": 4.86086, "GND": 4.95998, "PDH": 9.28253, "EX_glu__L_e": -0.0, "PIt2r": 3.2149, "SUCDi": 30.98548, "FBP": -0.0, "EX_co2_e": 22.80983, "SUCCt2_2": -0.0, "EX_pi_e": -3.2149, "PPC": 2.50431, "PGM": -14.71614, "FUM": 5.06438, "SUCCt3": -0.0, "EX_h2o_e": 29.17583, "SUCOAS": -5.06438, "ACALD": 0.0, "H2Ot": -29.17583, "PPS": -0.0, "GLUSy": -0.0, "PFL": -0.0, "CO2t": -22.80983, "ETOHt2r": 0.0, "GLCpts": 10.0, "G6PDH2r": 4.95998, "AKGt2r": 0.0}, "minimum": {"MDH": 5.06438, "MALS": 0.0, "EX_pyr_e": 0.0, "PYK": 1.75818, "MALt2_2": 0.0, "PPCK": 0.0, "FBA": 7.47738, "RPE": 2.67848, "EX_fum_e": 0.0, "CS": 6.00725, "EX_o2_e": -21.79949, "FRD7": 0.0, "AKGDH": 5.06438, "FORt2": 0.0, "GLNabc": 0.0, "EX_fru_e": 0.0, "THD2": 0.0, "FUMt2_2": 0.0, "PYRt2": 0.0, "O2t": 21.79949, "ACALDt": 0.0, "EX_acald_e": 0.0, "Biomass_Ecoli_core": 0.87392, "ACONTa": 6.00725, "TKT2": 1.1815, "TKT1": 1.49698, "LDH_D": 0.0, "GLUDy": -4.54186, "ALCD2x": 0.0, "EX_h_e": 17.53087, "EX_mal__L_e": 0.0, "NADH16": 38.53461, "TALA": 1.49698, "ME1": 0.0, "FORti": 0.0, "ME2": 0.0, "EX_nh4_e": -4.76532, "ACKr": 0.0, "ENO": 14.71614, "ACt2r": 0.0, "NH4t": 4.76532, "ACONTb": 6.00725, "EX_akg_e": 0.0, "EX_ac_e": 0.0, "ATPS4r": 45.51401, "GLUN": 0.0, "FRUpts2": 0.0, "CYTBD": 43.59899, "ATPM": 8.39, "GLNS": 0.22346, "PFK": 7.47738, "NADTRHD": 0.0, "PGK": -16.02353, "EX_succ_e": 0.0, "PGL": 4.95998, "EX_gln__L_e": 0.0, "PTAr": 0.0, "RPI": -2.2815, "GAPD": 16.02353, "ICDHyr": 6.00725, "TPI": 7.47738, "EX_glc__D_e": -10.0, "ICL": 0.0, "GLUt2r": 0.0, "ADK1": 0.0, "EX_for_e": 0.0, "EX_etoh_e": 0.0, "EX_lac__D_e": 0.0, "D_LACt2": 0.0, "PGI": 4.86086, "GND": 4.95998, "PDH": 9.28253, "EX_glu__L_e": 0.0, "PIt2r": 3.2149, "SUCDi": 5.06438, "FBP": 0.0, "EX_co2_e": 22.80983, "SUCCt2_2": 0.0, "EX_pi_e": -3.2149, "PPC": 2.50431, "PGM": -14.71614, "FUM": 5.06438, "SUCCt3": 0.0, "EX_h2o_e": 29.17583, "SUCOAS": -5.06438, "ACALD": 0.0, "H2Ot": -29.17583, "PPS": 0.0, "GLUSy": 0.0, "PFL": 0.0, "CO2t": -22.80983, "ETOHt2r": 0.0, "GLCpts": 10.0, "G6PDH2r": 4.95998, "AKGt2r": 0.0}} \ No newline at end of file diff --git a/cobra/test/data/textbook_solution.pickle b/cobra/test/data/textbook_solution.pickle index a9633a37a..ac0e1f9be 100644 Binary files a/cobra/test/data/textbook_solution.pickle and b/cobra/test/data/textbook_solution.pickle differ diff --git a/cobra/test/data/update_pickles.py b/cobra/test/data/update_pickles.py index 5d280250d..69b720db9 100755 --- a/cobra/test/data/update_pickles.py +++ b/cobra/test/data/update_pickles.py @@ -3,38 +3,39 @@ from __future__ import absolute_import +import json from collections import OrderedDict -from json import dump as json_dump +from builtins import open # Python 2 unicode compatibility. import cobra from cobra.io import ( - load_matlab_model, read_sbml_model, save_json_model, save_matlab_model, - write_sbml_model) + load_matlab_model, read_sbml_model, save_json_model, save_yaml_model, + save_matlab_model, write_sbml_model) from cobra.io.sbml3 import write_sbml2 # This script regenerates pickles of cobra Models. Should be # performed after updating core classes to prevent subtle bugs. try: - from cPickle import load, dump -except: - from pickle import load, dump + import cPickle as pickle +except ImportError: + import pickle # ecoli ecoli_model = read_sbml_model("iJO1366.xml") -with open("iJO1366.pickle", "wb") as outfile: - dump(ecoli_model, outfile, protocol=2) +with open("iJO1366.pickle", "wb", encoding=None) as outfile: + pickle.dump(ecoli_model, outfile, protocol=2) # salmonella salmonella = read_sbml_model("salmonella.xml") with open("salmonella.genes", "rb") as infile: - gene_names = load(infile) + gene_names = pickle.load(infile) for gene in salmonella.genes: gene.name = gene_names[gene.id] with open("salmonella.media", "rb") as infile: - salmonella.media_compositions = load(infile) -with open("salmonella.pickle", "wb") as outfile: - dump(salmonella, outfile, protocol=2) + salmonella.media_compositions = pickle.load(infile) +with open("salmonella.pickle", "wb", encoding=None) as outfile: + pickle.dump(salmonella, outfile, protocol=2) # create mini model from textbook textbook = read_sbml_model("textbook.xml.gz") @@ -76,19 +77,21 @@ mini.reactions.sort() mini.genes.sort() mini.metabolites.sort() +mini.compartments.sort() # output to various formats -with open("mini.pickle", "wb") as outfile: - dump(mini, outfile, protocol=2) +with open("mini.pickle", "wb", encoding=None) as outfile: + pickle.dump(mini, outfile, protocol=2) save_matlab_model(mini, "mini.mat") -save_json_model(mini, "mini.json", pretty=True) +save_json_model(mini, "mini.json", sort=True, pretty=True) +save_yaml_model(mini, "mini.yml", sort=True) write_sbml_model(mini, "mini_fbc2.xml") write_sbml_model(mini, "mini_fbc2.xml.bz2") write_sbml_model(mini, "mini_fbc2.xml.gz") write_sbml2(mini, "mini_fbc1.xml", use_fbc_package=True) write_sbml_model(mini, "mini_cobra.xml", use_fbc_package=False) raven = load_matlab_model("raven.mat") -with open("raven.pickle", "wb") as outfile: - dump(raven, outfile, protocol=2) +with open("raven.pickle", "wb", encoding=None) as outfile: + pickle.dump(raven, outfile, protocol=2) # TODO:these need a reference solutions rather than circular solution checking! @@ -98,7 +101,7 @@ for key in sorted(fva_result): clean_result[key] = {k: round(v, 5) for k, v in fva_result[key].items()} with open("textbook_fva.json", "w") as outfile: - json_dump(clean_result, outfile) + json.dump(clean_result, outfile) # fva with pfba constraint fva_result = cobra.flux_analysis.flux_variability_analysis(textbook, @@ -107,9 +110,9 @@ for key in sorted(fva_result): clean_result[key] = {k: round(v, 5) for k, v in fva_result[key].items()} with open("textbook_pfba_fva.json", "w") as outfile: - json_dump(clean_result, outfile) + json.dump(clean_result, outfile) # textbook solution solution = cobra.flux_analysis.parsimonious.pfba(textbook) -with open('textbook_solution.pickle', 'wb') as f: - dump(solution, f, protocol=2) +with open('textbook_solution.pickle', 'wb', encoding=None) as f: + pickle.dump(solution, f, protocol=2) diff --git a/cobra/test/test_compartment.py b/cobra/test/test_compartment.py new file mode 100644 index 000000000..db5869b1c --- /dev/null +++ b/cobra/test/test_compartment.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +import pytest +from cobra.core import Compartment + + +def test__eq__(): + a = b = Compartment("x") + c = "x" + d = Compartment("x") + e = Compartment("z") + assert a.__eq__(b) is True + assert a.__eq__(c) is True + assert a.__eq__(d) is True + assert a.__eq__(e) is False + + +def test__ne__(): + a = b = Compartment("x") + c = "x" + d = Compartment("x") + e = Compartment("z") + assert a.__ne__(b) is False + assert a.__ne__(c) is False + assert a.__ne__(d) is False + assert a.__ne__(e) is True + + +def test_error_with_non_sane_id(): + with pytest.raises(TypeError): + Compartment("Trust Me This ID Is Sane") diff --git a/cobra/test/test_io/__init__.py b/cobra/test/test_io/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/cobra/test/test_io/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/cobra/test/test_io/conftest.py b/cobra/test/test_io/conftest.py index df3dfa197..1a583e773 100644 --- a/cobra/test/test_io/conftest.py +++ b/cobra/test/test_io/conftest.py @@ -19,6 +19,7 @@ def mini_model(data_directory): def compare_models(model_1, model_2): """Compare two models (only for testing purposes).""" + assert len(model_1.compartments) == len(model_2.compartments) assert len(model_1.reactions) == len(model_2.reactions) assert len(model_1.metabolites) == len(model_2.metabolites) assert len(model_1.genes) == len(model_2.genes) diff --git a/cobra/test/test_io/helpers.py b/cobra/test/test_io/helpers.py new file mode 100644 index 000000000..cd0c91391 --- /dev/null +++ b/cobra/test/test_io/helpers.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +"""Define testing helper functions.""" + +from __future__ import absolute_import + +import pytest + + +def assert_equal_models(model_1, model_2): + """Compare two models (only for testing purposes).""" + assert len(model_1.compartments) == len(model_2.compartments) + assert len(model_1.reactions) == len(model_2.reactions) + assert len(model_1.metabolites) == len(model_2.metabolites) + assert len(model_1.genes) == len(model_2.genes) + assert model_1.objective.direction == model_2.objective.direction + + # check Reaction attributes + for attr in ("id", "name", "lower_bound", "upper_bound", + "objective_coefficient", "gene_reaction_rule"): + assert getattr(model_1.reactions[0], attr) == getattr( + model_2.reactions[0], attr) + assert getattr(model_1.reactions[5], attr) == getattr( + model_2.reactions[5], attr) + assert getattr(model_1.reactions[-1], attr) == getattr( + model_2.reactions[-1], attr) + + # check Metabolite attributes + for attr in ("id", "name", "compartment", "formula", "charge"): + assert getattr(model_1.metabolites[0], attr) == getattr( + model_2.metabolites[0], attr) + assert getattr(model_1.metabolites[5], attr) == getattr( + model_2.metabolites[5], attr) + assert getattr(model_1.metabolites[-1], attr) == getattr( + model_2.metabolites[-1], attr) + assert len(model_1.reactions[0].metabolites) == len( + model_2.reactions[0].metabolites) + # TODO: either relax gene attribute checking or fix models for testing. + # check Gene attributes + # for attr in ("id", "name"): + # assert getattr(model_1.genes[0], attr) == getattr(model_2.genes[0], + # attr) + # assert getattr(model_1.genes[10], attr) == getattr(model_2.genes[10], + # attr) + # assert getattr(model_1.genes[-1], attr) == getattr(model_2.genes[-1], + # attr) + + assert len(model_1.reactions[8].metabolites) == len( + model_2.reactions[8].metabolites) + assert len(model_1.reactions[-1].metabolites) == len( + model_2.reactions[-1].metabolites) + assert len(model_1.genes) == len(model_2.genes) + + # ensure they have the same solution max + solution_1 = model_1.optimize() + solution_2 = model_2.optimize() + assert abs(solution_1.objective_value - + solution_2.objective_value) == pytest.approx(0.0) + + # ensure the references are correct + # metabolite -> model reference + assert model_1.metabolites[0]._model is model_1 + assert model_2.metabolites[0]._model is model_2 + + # reaction -> model reference + assert model_1.reactions[0]._model is model_1 + assert model_2.reactions[0]._model is model_2 + + # gene -> model reference + assert model_1.genes[0]._model is model_1 + assert model_2.genes[0]._model is model_2 + + # extra comparisons + # assert model_1.compartments == model_2.compartments + # assert dict(model_1.metabolites[4].annotation) == dict( + # model_2.metabolites[4].annotation) + # assert dict(model_1.reactions[4].annotation) == dict( + # model_2.reactions[4].annotation) + # assert dict(model_1.genes[5].annotation) == dict( + # model_2.genes[5].annotation) diff --git a/cobra/test/test_io/test_io_order.py b/cobra/test/test_io/test_io_order.py index 5d9016bc7..1809410bd 100644 --- a/cobra/test/test_io/test_io_order.py +++ b/cobra/test/test_io/test_io_order.py @@ -26,8 +26,10 @@ def minimized_shuffle(small_model): chosen = sample(list(set(model.reactions) - set(model.exchanges)), 10) new = Model("minimized_shuffle") new.add_reactions(chosen) - LOGGER.debug("'%s' has %d metabolites, %d reactions, and %d genes.", - new.id, new.metabolites, new.reactions, new.genes) + LOGGER.debug("'%s' has %d metabolites, %d reactions, %d genes " + "and %d compartments", + new.id, new.metabolites, new.reactions, new.genes, + new.compartments) return new @@ -39,6 +41,8 @@ def minimized_sorted(minimized_shuffle): sorted(model.metabolites, key=attrgetter("id"))) model.genes = DictList(sorted(model.genes, key=attrgetter("id"))) model.reactions = DictList(sorted(model.reactions, key=attrgetter("id"))) + model.compartments = DictList(sorted(model.compartments, + key=attrgetter("id"))) return model @@ -52,6 +56,8 @@ def minimized_reverse(minimized_shuffle): sorted(model.genes, key=attrgetter("id"), reverse=True)) model.reactions = DictList( sorted(model.reactions, key=attrgetter("id"), reverse=True)) + model.compartments = DictList( + sorted(model.compartments, key=attrgetter("id"), reverse=True)) return model @@ -61,7 +67,8 @@ def template(request, minimized_shuffle, minimized_reverse, minimized_sorted): return locals()[request.param] -@pytest.fixture(scope="module", params=["metabolites", "reactions", "genes"]) +@pytest.fixture(scope="module", params=["metabolites", "reactions", "genes", + "compartments"]) def attribute(request): return request.param diff --git a/cobra/test/test_io/test_json.py b/cobra/test/test_io/test_json.py index 93d7cac91..5300729c4 100644 --- a/cobra/test/test_io/test_json.py +++ b/cobra/test/test_io/test_json.py @@ -1,40 +1,45 @@ # -*- coding: utf-8 -*- -"""Test functionalities of json.py""" +"""Test JSON input and output.""" from __future__ import absolute_import -import json +from builtins import open # Python 2 unicode compatibility. from os.path import join import cobra.io as cio -import pytest -from cobra.test.test_io.conftest import compare_models +import helpers -@pytest.mark.xfail(reason="schema outdated") -def test_validate_json(data_directory): - """Validate file according to JSON-schema.""" - jsonschema = pytest.importorskip("jsonschema") - with open(join(data_directory, "mini.json"), - "r", encoding="utf-8") as infile: - loaded = json.load(infile) - assert jsonschema.validate(loaded, cio.json.json_schema) + +def test_from_json(data_directory, mini_model): + """Test reading a model from a JSON string.""" + with open(join(data_directory, "mini.json"), encoding="utf-8") as handle: + json_model = cio.from_json(handle.read()) + helpers.assert_equal_models(mini_model, json_model) def test_load_json_model(data_directory, mini_model): - """Test the reading of JSON model.""" + """Test reading a model from a JSON file.""" json_model = cio.load_json_model(join(data_directory, "mini.json")) - assert compare_models(mini_model, json_model) is None + helpers.assert_equal_models(mini_model, json_model) + + +def test_to_json(data_directory, mini_model): + """Test writing a model to a JSON string.""" + output = cio.to_json(mini_model, sort=True, pretty=True) + with open(join(data_directory, "mini.json"), encoding="utf-8") as handle: + expected = handle.read() + assert output == expected -@pytest.mark.xfail(reason="schema outdated") -def test_save_json_model(tmpdir, mini_model): - """Test the writing of JSON model.""" - jsonschema = pytest.importorskip("jsonschema") +def test_save_json_model(tmpdir, data_directory, mini_model): + """Test writing a model to a JSON file.""" output_file = tmpdir.join("mini.json") - cio.save_json_model(mini_model, output_file.strpath, pretty=True) - # validate against JSONSchema - with open(output_file, "r") as infile: - loaded = json.load(infile) - assert jsonschema.validate(loaded, cio.json.json_schema) + cio.save_json_model(mini_model, str(output_file), sort=True, pretty=True) + # Validate the written file. + with open(str(output_file), encoding="utf-8") as handle: + output = handle.read() + with open(join(data_directory, "mini.json"), encoding="utf-8") as handle: + expected = handle.read() + assert output == expected diff --git a/cobra/test/test_io/test_mat.py b/cobra/test/test_io/test_mat.py index ab8b6857e..626638fbe 100644 --- a/cobra/test/test_io/test_mat.py +++ b/cobra/test/test_io/test_mat.py @@ -4,27 +4,27 @@ from __future__ import absolute_import +from builtins import open # Python 2 unicode compatibility. from os.path import join from pickle import load import pytest -from cobra import io -from cobra.test.test_io.conftest import compare_models +import cobra.io as cio -try: - import scipy -except ImportError: - scipy = None +import helpers -@pytest.fixture(scope="function") +scipy = pytest.importorskip("scipy") + + +@pytest.fixture(scope="module") def raven_model(data_directory): """Fixture for RAVEN model.""" - with open(join(data_directory, "raven.pickle"), "rb") as infile: + with open(join(data_directory, "raven.pickle"), + "rb", encoding=None) as infile: return load(infile) -@pytest.mark.skipif(scipy is None, reason='scipy unavailable') # @pytest.mark.parametrize("ref_model, filename", # [(pytest.fixture_request("mini_model"), # "mini.mat"), @@ -33,14 +33,12 @@ def raven_model(data_directory): # TODO: wait for pytest.fixture_request() to get approved def test_load_matlab_model(data_directory, mini_model, raven_model): """Test the reading of MAT model.""" - mini_mat_model = io.load_matlab_model(join(data_directory, "mini.mat")) - raven_mat_model = io.load_matlab_model(join(data_directory, "raven.mat")) - assert compare_models(mini_model, mini_mat_model) is None - assert compare_models(raven_model, raven_mat_model) is None + mini_mat_model = cio.load_matlab_model(join(data_directory, "mini.mat")) + raven_mat_model = cio.load_matlab_model(join(data_directory, "raven.mat")) + helpers.assert_equal_models(mini_model, mini_mat_model) + helpers.assert_equal_models(raven_model, raven_mat_model) -# @pytest.mark.xfail(reason="localPath not supported yet") -@pytest.mark.skipif(scipy is None, reason='scipy unavailable') # @pytest.mark.parametrize("model, filename", # [(pytest.fixture_request("mini_model"), # "mini.mat"), @@ -53,7 +51,7 @@ def test_save_matlab_model(tmpdir, mini_model, raven_model): raven_output_file = tmpdir.join("raven.mat") # scipy.io.savemat() doesn't support anything other than # str or file-stream object, hence the str conversion - io.save_matlab_model(mini_model, str(mini_output_file)) - io.save_matlab_model(raven_model, str(raven_output_file)) + cio.save_matlab_model(mini_model, str(mini_output_file)) + cio.save_matlab_model(raven_model, str(raven_output_file)) assert mini_output_file.check() assert raven_output_file.check() diff --git a/cobra/test/test_io/test_pickle.py b/cobra/test/test_io/test_pickle.py index 7f3a921c2..1f2d3d196 100644 --- a/cobra/test/test_io/test_pickle.py +++ b/cobra/test/test_io/test_pickle.py @@ -4,41 +4,32 @@ from __future__ import absolute_import +from builtins import open # Python 2 unicode compatibility. from os.path import join -from pickle import dump, load import pytest -from cobra.test.test_io.conftest import compare_models -try: - import cPickle - cload = cPickle.load - cdump = cPickle.dump -except ImportError: - cload = None - cdump = None +import helpers -@pytest.mark.parametrize("load_function", [load, cload]) -def test_read_pickle(data_directory, mini_model, load_function): - """Test the reading of model from pickle.""" - if load_function is None: - pytest.skip() +PICKLE_MODULES = ["pickle", "cPickle"] - with open(join(data_directory, "mini.pickle"), "rb") as infile: - pickle_model = load_function(infile) - assert compare_models(mini_model, pickle_model) is None +@pytest.mark.parametrize("module", PICKLE_MODULES) +def test_read_pickle(data_directory, mini_model, module): + """Test the reading of model from pickle.""" + pickle = pytest.importorskip(module) + with open(join(data_directory, "mini.pickle"), + "rb", encoding=None) as infile: + pickle_model = pickle.load(infile) + helpers.assert_equal_models(mini_model, pickle_model) -@pytest.mark.parametrize("dump_function", [dump, cdump]) -def test_write_pickle(tmpdir, mini_model, dump_function): +@pytest.mark.parametrize("module", PICKLE_MODULES) +def test_write_pickle(tmpdir, mini_model, module): """Test the writing of model to pickle.""" - if dump_function is None: - pytest.skip() - + pickle = pytest.importorskip(module) output_file = tmpdir.join("mini.pickle") - with open(str(output_file), "wb") as outfile: - dump_function(mini_model, outfile) - + with open(str(output_file), "wb", encoding=None) as outfile: + pickle.dump(mini_model, outfile) assert output_file.check() diff --git a/cobra/test/test_io/test_sbml.py b/cobra/test/test_io/test_sbml.py index 010665fb3..9cae9e805 100644 --- a/cobra/test/test_io/test_sbml.py +++ b/cobra/test/test_io/test_sbml.py @@ -4,52 +4,50 @@ from __future__ import absolute_import -from os.path import getsize, join +from os.path import join import pytest -from cobra import io -from cobra.test.test_io.conftest import compare_models -try: - import libsbml -except ImportError: - libsbml = None +import cobra.io as cio + +import helpers + + +libsbml = pytest.importorskip("libsbml") @pytest.fixture(scope="function") def mini_fbc1_model(data_directory): - return io.read_legacy_sbml(join(data_directory, "mini_fbc1.xml")) + return cio.read_legacy_sbml(join(data_directory, "mini_fbc1.xml")) @pytest.fixture(scope="function") def mini_cobra_model(data_directory): - return io.read_legacy_sbml(join(data_directory, "mini_cobra.xml")) + return cio.read_legacy_sbml(join(data_directory, "mini_cobra.xml")) # TODO: parametrize the arguments after pytest.fixture_request() # is approved -@pytest.mark.skipif(libsbml is None, reason="libsbml unavailable.") def test_read_sbml_model(data_directory, mini_fbc1_model, mini_cobra_model): """Test the reading of a model from SBML v2.""" - mini_fbc1 = io.read_legacy_sbml(join(data_directory, "mini_fbc1.xml")) - mini_cobra = io.read_legacy_sbml(join(data_directory, "mini_cobra.xml")) - assert compare_models(mini_fbc1_model, mini_fbc1) is None - assert compare_models(mini_cobra_model, mini_cobra) is None + mini_fbc1 = cio.read_legacy_sbml(join(data_directory, "mini_fbc1.xml")) + mini_cobra = cio.read_legacy_sbml(join(data_directory, "mini_cobra.xml")) + helpers.assert_equal_models(mini_fbc1_model, mini_fbc1) + helpers.assert_equal_models(mini_cobra_model, mini_cobra) # TODO: parametrize the arguments after pytest.fixture_request() # is approved -@pytest.mark.skipif(libsbml is None, reason="libsbml unavailable.") def test_write_sbml_model(tmpdir, mini_fbc1_model, mini_cobra_model): """Test the writing of a model to SBML v2.""" mini_fbc1_output_file = tmpdir.join("mini_fbc1.xml") mini_cobra_output_file = tmpdir.join("mini_cobra.xml") # convert to str object before passing the filename - io.write_legacy_sbml(mini_fbc1_model, str(mini_fbc1_output_file), - use_fbc_package=True) - io.write_legacy_sbml(mini_cobra_model, str(mini_cobra_output_file), - use_fbc_package=False) + cio.write_legacy_sbml(mini_fbc1_model, str(mini_fbc1_output_file), + use_fbc_package=True) + cio.write_legacy_sbml(mini_cobra_model, str(mini_cobra_output_file), + use_fbc_package=False) assert mini_fbc1_output_file.check() assert mini_cobra_output_file.check() diff --git a/cobra/test/test_io/test_sbml3.py b/cobra/test/test_io/test_sbml3.py index 249f1d1e3..81e88c9e5 100644 --- a/cobra/test/test_io/test_sbml3.py +++ b/cobra/test/test_io/test_sbml3.py @@ -6,36 +6,37 @@ from os.path import join +import pytest from six import itervalues -import pytest -from cobra import io -from cobra.test.test_io.conftest import compare_models +import cobra.io as cio + +import helpers @pytest.fixture(scope="function") def mini_fbc2_model(data_directory): """Return mini_fbc2 model.""" - return io.sbml3.read_sbml_model(join(data_directory, "mini_fbc2.xml")) + return cio.sbml3.read_sbml_model(join(data_directory, "mini_fbc2.xml")) # Benchmarks def test_benchmark_read(data_directory, benchmark): """Benchmark SBML read.""" - benchmark(io.sbml3.read_sbml_model, join(data_directory, "mini_fbc2.xml")) + benchmark(cio.sbml3.read_sbml_model, join(data_directory, "mini_fbc2.xml")) def test_benchmark_write(model, benchmark, tmpdir): """Benchmark SBML write.""" - benchmark(io.sbml3.write_sbml_model, model, tmpdir.join("-bench")) + benchmark(cio.sbml3.write_sbml_model, model, tmpdir.join("-bench")) # Tests def test_sbml3_error(data_directory): """Test invalid SBML read.""" filename = join(data_directory, "invalid0.xml") - with pytest.raises(io.sbml3.CobraSBMLError): - io.read_sbml_model(filename) + with pytest.raises(cio.sbml3.CobraSBMLError): + cio.read_sbml_model(filename) def test_validate_sbml_model(data_directory): @@ -43,12 +44,12 @@ def test_validate_sbml_model(data_directory): # invalid SBML for i in range(3): filename = join(data_directory, "invalid{}.xml".format(i)) - _, errors = io.sbml3.validate_sbml_model(filename) + _, errors = cio.sbml3.validate_sbml_model(filename) assert all(len(v) >= 1 for v in itervalues(errors)) is False # valid SBML filename = join(data_directory, "mini_fbc2.xml") - _, errors = io.sbml3.validate_sbml_model(filename) + _, errors = cio.sbml3.validate_sbml_model(filename) assert all(len(v) == 0 for v in itervalues(errors)) @@ -56,13 +57,13 @@ def test_validate_sbml_model(data_directory): "mini_fbc2.xml.bz2"]) def test_read_sbml_model(data_directory, mini_model, sbml_file): """Test the reading of a model from SBML3.""" - sbml3_model = io.read_sbml_model(join(data_directory, sbml_file)) - assert compare_models(mini_model, sbml3_model) is None + sbml3_model = cio.read_sbml_model(join(data_directory, sbml_file)) + helpers.assert_equal_models(mini_model, sbml3_model) @pytest.mark.parametrize("ext", [".xml", ".xml.gz", ".xml.bz2"]) def test_write_sbml_model(tmpdir, mini_fbc2_model, ext): """Test the writing of model to SBML3.""" output_file = tmpdir.join("mini_fbc2{}".format(ext)) - io.write_sbml_model(mini_fbc2_model, output_file) + cio.write_sbml_model(mini_fbc2_model, output_file) assert output_file.check() diff --git a/cobra/test/test_io/test_yaml.py b/cobra/test/test_io/test_yaml.py index e1832192a..ad13c2cf5 100644 --- a/cobra/test/test_io/test_yaml.py +++ b/cobra/test/test_io/test_yaml.py @@ -1,35 +1,45 @@ # -*- coding: utf-8 -*- -"""Test functionalities provided by yaml.py""" +"""Test YAML input and output.""" from __future__ import absolute_import -import json +from builtins import open # Python 2 unicode compatibility. from os.path import join -from ruamel.yaml import YAML - import cobra.io as cio -import pytest -from cobra.test.test_io.conftest import compare_models + +import helpers + + +def test_from_yaml(data_directory, mini_model): + """Test reading a model from a YAML string.""" + with open(join(data_directory, "mini.yml"), encoding="utf-8") as handle: + yaml_model = cio.from_yaml(handle.read()) + helpers.assert_equal_models(mini_model, yaml_model) def test_load_yaml_model(data_directory, mini_model): - """Test the reading of YAML model.""" + """Test reading a model from a YAML file.""" yaml_model = cio.load_yaml_model(join(data_directory, "mini.yml")) - assert compare_models(mini_model, yaml_model) is None + helpers.assert_equal_models(mini_model, yaml_model) + + +def test_to_yaml(data_directory, mini_model): + """Test writing a model to a YAML string.""" + output = cio.to_yaml(mini_model, sort=True) + with open(join(data_directory, "mini.yml"), encoding="utf-8") as handle: + expected = handle.read() + assert output == expected -@pytest.mark.xfail(reason="schema outdated") -def test_save_yaml_model(tmpdir, mini_model): - jsonschema = pytest.importorskip("jsonschema") - """Test the writing of YAML model.""" +def test_save_yaml_model(tmpdir, data_directory, mini_model): + """Test writing a model to a YAML file.""" output_file = tmpdir.join("mini.yml") - cio.save_yaml_model(mini_model, output_file.strpath, sort=True) - # validate against schema - yaml = YAML(typ="unsafe") - with open(output_file.strpath, "r") as infile: - yaml_to_dict = yaml.load(infile) - dict_to_json = json.dumps(yaml_to_dict) - loaded = json.loads(dict_to_json) - assert jsonschema.validate(loaded, cio.json.json_schema) + cio.save_yaml_model(mini_model, str(output_file), sort=True) + # Validate the written file. + with open(str(output_file), encoding="utf-8") as handle: + output = handle.read() + with open(join(data_directory, "mini.yml"), encoding="utf-8") as handle: + expected = handle.read() + assert output == expected diff --git a/cobra/test/test_metabolite.py b/cobra/test/test_metabolite.py new file mode 100644 index 000000000..263474894 --- /dev/null +++ b/cobra/test/test_metabolite.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +import pytest +from cobra.core import Metabolite, Model, Compartment + + +def test_compartment_setter(): + met = Metabolite('x', compartment=None) + cytosol = Compartment('c') + model = Model() + model.add_compartments([cytosol]) + met2 = Metabolite("y") + met5 = Metabolite("b") + model.add_metabolites([met2, met5]) + met2.compartment = Compartment("c") + met3 = Metabolite('z', compartment=cytosol) + met4 = Metabolite('a', compartment='e') + met5.compartment = 'c' + + assert met.compartment is None + assert met2.compartment is cytosol + assert met3.compartment is cytosol + assert isinstance(met4.compartment, Compartment) + assert met5.compartment is cytosol + with pytest.raises(TypeError): + Metabolite("c", compartment="Sane Compartment, Not!") diff --git a/cobra/test/test_model.py b/cobra/test/test_model.py index ccb6f3c22..173b087e8 100644 --- a/cobra/test/test_model.py +++ b/cobra/test/test_model.py @@ -12,7 +12,7 @@ from optlang.symbolics import Zero import cobra.util.solver as su -from cobra.core import Metabolite, Model, Reaction +from cobra.core import Metabolite, Model, Reaction, Compartment from cobra.util import create_stoichiometric_matrix from cobra.exceptions import OptimizationError @@ -399,17 +399,80 @@ def test_remove_metabolite_destructive(self, model): for reaction in test_reactions: assert reaction in model.reactions - def test_compartments(self, model): - assert set(model.compartments) == {"c", "e"} + def test_compartments(self): model = Model("test", "test") + model.add_compartments([Compartment("test")]) met_c = Metabolite("a_c", compartment="c") met_e = Metabolite("a_e", compartment="e") rxn = Reaction("foo") rxn.add_metabolites({met_e: -1, met_c: 1}) model.add_reactions([rxn]) - assert model.compartments == {'c': '', 'e': ''} - model.compartments = {'c': 'cytosol'} - assert model.compartments == {'c': 'cytosol', 'e': ''} + assert len(model.compartments) == 3 + assert model.compartments.c.id == 'c' + assert model.compartments.e.id == 'e' + assert model.compartments.test.id == 'test' + + def test_compartment_assignment_after_metabolites(self): + model = Model("test") + a_c = Metabolite("a_c", compartment="c") + b_c = Metabolite("b_c", compartment="c") + rxn = Reaction("foo") + rxn.add_metabolites({a_c: -1, b_c: 1}) + model.add_reactions([rxn]) + assert model.compartments.c is not None + assert a_c.compartment is b_c.compartment + + def test_remove_empty_compartment(self): + model = Model("test", "test") + model.add_compartments([Compartment("c")]) + model.add_compartments([Compartment("e")]) + model.remove_compartments([model.compartments.c]) + model.remove_compartments([model.compartments.e], destructive=True) + assert len(model.compartments) == 0 + + def test_get_metabolites_in_compartments_by_id(self): + model = Model("test", "test") + cytosol = Compartment("c", "cytosol") + model.add_compartments([cytosol]) + a_c = Metabolite("a_c", compartment="c") + b_c = Metabolite("b_c", compartment="c") + rxn = Reaction("foo") + rxn.add_metabolites({a_c: -1, b_c: 1}) + model.add_reactions([rxn]) + assert len(model.get_metabolites_in_compartment(cytosol.id)) == 2 + assert a_c in model.get_metabolites_in_compartment(cytosol.id) + assert b_c in model.get_metabolites_in_compartment(cytosol.id) + + def test_adding_and_removing_compartments(self): + model = Model("test", "test") + cytosol = Compartment("c", "cytosol") + model.add_compartments(cytosol) + assert cytosol in model.compartments + model.remove_compartments(cytosol) + assert cytosol not in model.compartments + + @pytest.mark.xfail + def test_remove_populated_compartment(self, model): + model = Model("test", "test") + a_c = Metabolite("a_c", compartment="c") + b_c = Metabolite("b_c", compartment="c") + rxn = Reaction("foo") + rxn.add_metabolites({a_c: -1, b_c: 1}) + model.add_reactions([rxn]) + model.remove_compartments([model.compartments.c]) + assert len(model.compartments) == 0 + + def test_remove_populated_compartment_destructive(self, model): + model = Model("test", "test") + a_c = Metabolite("a_c", compartment="c") + b_c = Metabolite("b_c", compartment="c") + rxn = Reaction("foo") + rxn.add_metabolites({a_c: -1, b_c: 1}) + model.add_reactions([rxn]) + model.remove_compartments([model.compartments.c], destructive=True) + assert len(model.compartments) == 0 + assert model.metabolites.a_c.compartment is None + assert model.metabolites.b_c.compartment is None def test_add_reaction(self, model): old_reaction_count = len(model.reactions) diff --git a/cobra/util/util.py b/cobra/util/util.py index 96b0ed1e6..487e2e035 100644 --- a/cobra/util/util.py +++ b/cobra/util/util.py @@ -3,6 +3,7 @@ from __future__ import absolute_import from depinfo import print_dependencies +from six import string_types def format_long_string(string, max_length=50): @@ -27,3 +28,9 @@ def __getitem__(self, item): def show_versions(): """Print dependency information.""" print_dependencies("cobra") + + +def is_not_sane(id): + """Check if a id is sane to be used for cobra components.""" + return not isinstance(id, string_types) or \ + len(id) < 1 or any(c.isspace() for c in id) diff --git a/documentation_builder/building_model.ipynb b/documentation_builder/building_model.ipynb index a284cec11..80fdbe981 100644 --- a/documentation_builder/building_model.ipynb +++ b/documentation_builder/building_model.ipynb @@ -2,20 +2,14 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "# Building a Model" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "This simple example demonstrates how to create a model, create a reaction, and then add the reaction to the model.\n", "\n", @@ -30,9 +24,7 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -42,14 +34,10 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ - "from cobra import Model, Reaction, Metabolite\n", + "from cobra import Model, Reaction, Metabolite, Compartment\n", "# Best practise: SBML compliant IDs\n", "model = Model('example_model')\n", "\n", @@ -62,10 +50,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We need to create metabolites as well. If we were using an existing model, we could use `Model.get_by_id` to get the appropriate Metabolite objects instead." ] @@ -73,11 +58,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "ACP_c = Metabolite(\n", @@ -106,22 +87,84 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ - "Adding metabolites to a reaction requires using a dictionary of the metabolites and their stoichiometric coefficients. A group of metabolites can be added all at once, or they can be added one at a time." + "Please note: Assigning a compartment to a metabolite can be done by providing a simple ID string such as `c` above. Yet, it is also possible to provide a `Compartment` object." ] }, { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, + "outputs": [], + "source": [ + "cytosol = Compartment(id=\"c\",name=\"cytosol\")\n", + "\n", + "omrsACP_c = Metabolite(\n", + " '3omrsACP_c',\n", + " formula='C25H45N2O9PRS',\n", + " name='3-Oxotetradecanoyl-acyl-carrier-protein',\n", + " compartment=cytosol)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In fact, whenever you create a metabolite with just an ID, a distinct compartment object will be instantiated internally. Metabolites that are not connected to a model can therefore be assigned to different compartment objects despite of the identical IDs!" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ACP_c.compartment.id is omrsACP_c.compartment.id" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ACP_c.compartment is omrsACP_c.compartment" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Adding metabolites to a reaction requires using a dictionary of the metabolites and their stoichiometric coefficients. A group of metabolites can be added all at once, or they can be added one at a time." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, "outputs": [ { "data": { @@ -129,7 +172,7 @@ "'ddcaACP_c + h_c + malACP_c --> 3omrsACP_c + ACP_c + co2_c'" ] }, - "execution_count": 4, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -149,30 +192,23 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The gene_reaction_rule is a boolean representation of the gene requirements for this reaction to be active as described in [Schellenberger et al 2011 Nature Protocols 6(9):1290-307](http://dx.doi.org/doi:10.1038/nprot.2011.308). We will assign the gene reaction rule string, which will automatically create the corresponding gene objects." ] }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 8, + "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "frozenset({, })" + "frozenset({, })" ] }, - "execution_count": 5, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -184,22 +220,15 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "At this point in time, the model is still empty" ] }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 9, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -207,34 +236,84 @@ "text": [ "0 reactions initially\n", "0 metabolites initially\n", - "0 genes initially\n" + "0 genes initially\n", + "0 compartments initially\n" ] } ], "source": [ "print('%i reactions initially' % len(model.reactions))\n", "print('%i metabolites initially' % len(model.metabolites))\n", - "print('%i genes initially' % len(model.genes))" + "print('%i genes initially' % len(model.genes))\n", + "print('%i compartments initially' % len(model.compartments))" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ - "We will add the reaction to the model, which will also add all associated metabolites and genes" + "We will add the reaction to the model, which will also add all associated metabolites, genes and compartments" ] }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "The compartment c of metabolite h_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ddcaACP_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite co2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ACP_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 3omrsACP_c has been replaced with a compartment which already exists in the model the ID of which is identical\n" + ] + } + ], + "source": [ + "model.add_reactions([reaction])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " As you can see in the warnings above, when the metabolites are connected to a model, the compartment of the first metabolite will be assigned to every following metabolite if the compartment of the latter has the same ID." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now the compartment associations for each metabolite are identical." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ACP_c.compartment is omrsACP_c.compartment" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -242,37 +321,30 @@ "text": [ "1 reaction\n", "6 metabolites\n", - "2 genes\n" + "2 genes\n", + "1 compartment\n" ] } ], "source": [ - "model.add_reactions([reaction])\n", - "\n", "# Now there are things in the model\n", "print('%i reaction' % len(model.reactions))\n", "print('%i metabolites' % len(model.metabolites))\n", - "print('%i genes' % len(model.genes))" + "print('%i genes' % len(model.genes))\n", + "print('%i compartment' % len(model.compartments))" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We can iterate through the model objects to observe the contents" ] }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 13, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -284,17 +356,21 @@ "\n", "Metabolites\n", "-----------\n", - " co2_c : CO2\n", " malACP_c : C14H22N2O10PRS\n", " h_c : H\n", - "3omrsACP_c : C25H45N2O9PRS\n", "ddcaACP_c : C23H43N2O8PRS\n", + " co2_c : CO2\n", " ACP_c : C11H21N2O7PRS\n", + "3omrsACP_c : C25H45N2O9PRS\n", "\n", "Genes\n", "-----\n", "STM1197 is associated with reactions: {3OAS140}\n", - "STM2378 is associated with reactions: {3OAS140}\n" + "STM2378 is associated with reactions: {3OAS140}\n", + "\n", + "Compartments\n", + "-----\n", + "The metabolites {co2_c, 3omrsACP_c, malACP_c, h_c, ACP_c, ddcaACP_c} are now all associated with the same compartment c\n" ] } ], @@ -317,27 +393,28 @@ "for x in model.genes:\n", " associated_ids = (i.id for i in x.reactions)\n", " print(\"%s is associated with reactions: %s\" %\n", - " (x.id, \"{\" + \", \".join(associated_ids) + \"}\"))" + " (x.id, \"{\" + \", \".join(associated_ids) + \"}\"))\n", + "\n", + "print(\"\")\n", + "print(\"Compartments\")\n", + "print(\"-----\")\n", + "for x in model.compartments:\n", + " associated_mets = (i.id for i in model.get_metabolites_in_compartment(x))\n", + " print(\"The metabolites %s are now all associated with the same compartment %s\" %\n", + " (\"{\" + \", \".join(associated_mets) + \"}\", x.id))" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Last we need to set the objective of the model. Here, we just want this to be the maximization of the flux in the single reaction we added and we do this by assigning the reaction's identifier to the `objective` property of the model." ] }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 14, + "metadata": {}, "outputs": [], "source": [ "model.objective = '3OAS140'" @@ -345,22 +422,15 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The created objective is a symbolic algebraic expression and we can examine it by printing it" ] }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "execution_count": 15, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -378,10 +448,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "which here shows that the solver will maximize the flux in the forward direction." ] @@ -403,9 +470,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.1" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/documentation_builder/getting_started.ipynb b/documentation_builder/getting_started.ipynb index f5ba87601..e4b1f7687 100644 --- a/documentation_builder/getting_started.ipynb +++ b/documentation_builder/getting_started.ipynb @@ -25,7 +25,92 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "The compartment c of metabolite 13dpg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 2pg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 3pg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 6pgc_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 6pgl_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ac_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite ac_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite acald_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite acald_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite accoa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite acon_C_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite actp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite adp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite akg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite akg_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite amp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite atp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite cit_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite co2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite co2_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite coa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite dhap_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite e4p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite etoh_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite etoh_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite f6p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite fdp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite for_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite for_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite fru_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite fum_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite fum_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite g3p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite g6p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite glc__D_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite gln__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite gln__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite glu__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite glu__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite glx_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite h2o_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite h2o_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite h_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite h_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite icit_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite lac__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite lac__D_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite mal__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite mal__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nad_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadh_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadph_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nh4_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite nh4_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite o2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite o2_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite oaa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pep_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pi_c has been replaced with a compartment which already exists in the model the ID of which is identical\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "The compartment e of metabolite pi_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pyr_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite pyr_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite q8_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite q8h2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite r5p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ru5p__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite s7p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite succ_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite succ_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite succoa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite xu5p__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n" + ] + } + ], "source": [ "from __future__ import print_function\n", "\n", @@ -40,7 +125,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The reactions, metabolites, and genes attributes of the cobrapy model are a special type of list called a `cobra.DictList`, and each one is made up of `cobra.Reaction`, `cobra.Metabolite` and `cobra.Gene` objects respectively." + "The reactions, metabolites, genes and compartments attributes of the cobrapy model are a special type of list called a `cobra.DictList`, and each one is made up of `cobra.Reaction`, `cobra.Metabolite`, `cobra.Gene`, `cobra.Compartment` objects respectively." ] }, { @@ -56,14 +141,16 @@ "text": [ "95\n", "72\n", - "137\n" + "137\n", + "2\n" ] } ], "source": [ "print(len(model.reactions))\n", "print(len(model.metabolites))\n", - "print(len(model.genes))" + "print(len(model.genes))\n", + "print(len(model.compartments))" ] }, { @@ -88,7 +175,7 @@ " e_coli_core\n", " \n", " Memory address\n", - " 0x01116ea9e8\n", + " 0x01056a1fd0\n", " \n", " Number of metabolites\n", " 72\n", @@ -99,13 +186,13 @@ " Objective expression\n", " -1.0*Biomass_Ecoli_core_reverse_2cdba + 1.0*Biomass_Ecoli_core\n", " \n", - " Compartments\n", - " cytosol, extracellular\n", + " 2 compartment(s)\n", + " c : cytosol, e : extracellular\n", " \n", - " " + " " ], "text/plain": [ - "" + "" ] }, "execution_count": 3, @@ -140,7 +227,7 @@ " NameL-Glutamate exchange\n", " \n", " Memory address\n", - " 0x011b8643c8\n", + " 0x0112e5ba90\n", " \n", " Stoichiometry\n", " \n", @@ -158,7 +245,7 @@ " " ], "text/plain": [ - "" + "" ] }, "execution_count": 4, @@ -193,19 +280,19 @@ " NameATP\n", " \n", " Memory address\n", - " 0x011b7f82b0\n", + " 0x0112da3048\n", " \n", " FormulaC10H12N5O13P3\n", " \n", " Compartmentc\n", " \n", " In 13 reaction(s)\n", - " PYK, GLNS, ATPS4r, SUCOAS, PPCK, GLNabc, ATPM, ACKr, Biomass_Ecoli_core, ADK1, PPS, PFK, PGK\n", + " ACKr, PPCK, GLNabc, GLNS, PYK, SUCOAS, PGK, ADK1, Biomass_Ecoli_core, ATPS4r, PPS, PFK, ATPM\n", " \n", " " ], "text/plain": [ - "" + "" ] }, "execution_count": 5, @@ -274,7 +361,7 @@ " Nameglucose-6-phosphate isomerase\n", " \n", " Memory address\n", - " 0x011b886a90\n", + " 0x0112ee0160\n", " \n", " Stoichiometry\n", " \n", @@ -292,7 +379,7 @@ " " ], "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -421,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -430,7 +517,7 @@ "{'H': -1.0, 'charge': -1.0}" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -448,7 +535,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -475,7 +562,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -493,7 +580,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -502,7 +589,7 @@ "'g6p_c --> f6p_c + green_eggs + h_c + ham'" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -513,7 +600,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -522,7 +609,7 @@ "'g6p_c <=> f6p_c'" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -548,7 +635,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -562,22 +649,22 @@ " NameATP\n", " \n", " Memory address\n", - " 0x011b7f82b0\n", + " 0x0112da3048\n", " \n", " FormulaC10H12N5O13P3\n", " \n", " Compartmentc\n", " \n", " In 13 reaction(s)\n", - " PYK, GLNS, ATPS4r, SUCOAS, PPCK, GLNabc, ATPM, ACKr, Biomass_Ecoli_core, ADK1, PPS, PFK, PGK\n", + " ACKr, PPCK, GLNabc, GLNS, PYK, SUCOAS, PGK, ADK1, Biomass_Ecoli_core, ATPS4r, PPS, PFK, ATPM\n", " \n", " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 16, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -596,7 +683,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -622,7 +709,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -631,7 +718,7 @@ "-4" ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -649,7 +736,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -673,7 +760,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -682,7 +769,7 @@ "13" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -700,19 +787,19 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "frozenset({,\n", - " ,\n", - " ,\n", - " })" + "frozenset({,\n", + " ,\n", + " ,\n", + " })" ] }, - "execution_count": 21, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -739,7 +826,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -748,7 +835,7 @@ "'b4025'" ] }, - "execution_count": 22, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -767,16 +854,16 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "frozenset({})" + "frozenset({})" ] }, - "execution_count": 23, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -787,7 +874,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -801,7 +888,7 @@ " Namepgi\n", " \n", " Memory address\n", - " 0x011b844cc0\n", + " 0x0112e02748\n", " \n", " FunctionalTrue\n", " \n", @@ -811,10 +898,10 @@ " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 24, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -833,16 +920,16 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "frozenset({})" + "frozenset({})" ] }, - "execution_count": 25, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -860,16 +947,16 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "frozenset({, })" + "frozenset({, })" ] }, - "execution_count": 26, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -881,7 +968,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -890,7 +977,7 @@ "frozenset()" ] }, - "execution_count": 27, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -908,7 +995,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -922,7 +1009,7 @@ " Name\n", " \n", " Memory address\n", - " 0x011b850908\n", + " 0x0112ee03c8\n", " \n", " FunctionalTrue\n", " \n", @@ -932,10 +1019,10 @@ " " ], "text/plain": [ - "" + "" ] }, - "execution_count": 28, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -953,7 +1040,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -984,7 +1071,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -1000,6 +1087,138 @@ "print(pgi.lower_bound, \"< pgi <\", pgi.upper_bound)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Compartments" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Like any other component of a cobra.Model, compartments, too, are objects. We will consider the extracellular compartment for now." + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Compartment identifiere
Nameextracellular
Memory address0x0112d7a3c8
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model.compartments.e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "It is possible to provide additional information that further describes this compartment in the annotation attribute." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "model.compartments.e.annotation = {'sbo': 'SBO:0000247',\n", + "'ImaginaryCompDB':'SpecificCompIdentifier'}" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'SBO:0000247'" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model.compartments.e.annotation[\"sbo\"]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To obtain a list of all the metabolites within a compartment use the function `model.get_metabolites_in_compartments()`." + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " }" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model.get_metabolites_in_compartment(model.compartments.e)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1011,14 +1230,100 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Quite often, one wants to make small changes to a model and evaluate the impacts of these. For example, we may want to knock-out all reactions sequentially, and see what the impact of this is on the objective function. One way of doing this would be to create a new copy of the model before each knock-out with `model.copy()`. However, even with small models, this is a very slow approach as models are quite complex objects. Better then would be to do the knock-out, optimizing and then manually resetting the reaction bounds before proceeding with the next reaction. Since this is such a common scenario however, cobrapy allows us to use the model as a context, to have changes reverted automatically." + "Quite often, one wants to make small changes to a model and evaluate the impacts of these. For example, we may want to knock-out all reactions sequentially, and see what the impact of this is on the objective function. One way of doing this would be to create a new copy of the model before each knock-out with `model.copy()`. However, even with small models, this is a very slow approach as models are quite complex objects. Better then would be to do the knock-out, optimizing and then manually resetting the reaction bounds before proceeding with the next reaction. Since this is such a common scenario however, cobrapy allows us to use the model as a context, to have changes reverted automatically.\n", + "\n", + "Please note: Currently, compartment manipulations are not reverted automatically." ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 36, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "The compartment c of metabolite 13dpg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 2pg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 3pg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 6pgc_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite 6pgl_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ac_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite ac_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite acald_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite acald_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite accoa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite acon_C_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite actp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite adp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite akg_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite akg_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite amp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite atp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite cit_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite co2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite co2_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite coa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite dhap_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite e4p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite etoh_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite etoh_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite f6p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite fdp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite for_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite for_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite fru_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite fum_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite fum_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite g3p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite g6p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite glc__D_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite gln__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite gln__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite glu__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite glu__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite glx_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite h2o_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite h2o_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite h_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite h_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite icit_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite lac__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite lac__D_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite mal__L_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite mal__L_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nad_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadh_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadp_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nadph_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite nh4_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite nh4_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite o2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite o2_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite oaa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pep_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pi_c has been replaced with a compartment which already exists in the model the ID of which is identical\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "The compartment e of metabolite pi_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite pyr_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite pyr_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite q8_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite q8h2_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite r5p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite ru5p__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite s7p_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite succ_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment e of metabolite succ_e has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite succoa_c has been replaced with a compartment which already exists in the model the ID of which is identical\n", + "The compartment c of metabolite xu5p__D_c has been replaced with a compartment which already exists in the model the ID of which is identical\n" + ] + }, { "name": "stdout", "output_type": "stream", @@ -1050,7 +1355,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 37, "metadata": {}, "outputs": [ { @@ -1063,7 +1368,7 @@ " (-1000.0, 1000.0)]" ] }, - "execution_count": 32, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1081,7 +1386,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 38, "metadata": {}, "outputs": [ { @@ -1125,7 +1430,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 39, "metadata": { "collapsed": true }, @@ -1152,7 +1457,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.0" + "version": "3.6.1" } }, "nbformat": 4, diff --git a/setup.py b/setup.py index 7655b2428..3a19b1306 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,8 @@ "pandas>=0.17.0", "optlang>=1.4.2", "tabulate", - "depinfo" + "depinfo", + "importlib-resources" ], tests_require=[ "jsonschema > 2.5",