diff --git a/cobra/__init__.py b/cobra/__init__.py index f4d426c4f..44515c2b8 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.version_info import show_versions __version__ = "0.11.3" 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..c76fabb95 --- /dev/null +++ b/cobra/core/compartment.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +from copy import deepcopy +from cobra.util.util import format_long_string + +from cobra.core.object import Object + + +class Compartment(Object): + """Compartment is a class for holding information regarding + a compartment in a cobra.Model object + + Parameters + ---------- + id : string + An identifier for the compartment + name : string + A human readable name. + """ + def __init__(self, id=None, name=""): + Object.__init__(self, id, name) + + def copy(self): + return deepcopy(self) + + def _repr_html_(self): + return """ + + + + + + + + + +
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/model.py b/cobra/core/model.py index 3cd080519..bd46e2816 100644 --- a/cobra/core/model.py +++ b/cobra/core/model.py @@ -16,6 +16,7 @@ from cobra.exceptions import SolverNotFound from cobra.core.dictlist import DictList from cobra.core.object import Object +from cobra.core.compartment import Compartment from cobra.core.reaction import separate_forward_and_reverse_bounds, Reaction from cobra.core.solution import get_solution from cobra.util.context import HistoryManager, resettable, get_context @@ -90,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() self._contexts = [] # from cameo ... @@ -163,29 +164,17 @@ def get_metabolite_compartments(self): @property def compartments(self): - return {met.compartment: self._compartments.get(met.compartment, '') - for met in self.metabolites if met.compartment is not None} + for met in self.metabolites: + if met.compartment is not None: + try: + self._compartments.append(Compartment(met.compartment)) + except Exception: + pass + return self._compartments @compartments.setter - def compartments(self, value): - """Get or set the dictionary of current compartment descriptions. - - Assigning a dictionary to this property updates the model's - dictionary of compartment descriptions with the new values. - - Parameters - ---------- - value : dict - Dictionary mapping compartments abbreviations to full names. - - 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) + def compartments(self, compartments): + self._compartments = compartments @property def medium(self): @@ -325,12 +314,42 @@ 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): + 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.id not in self.compartments] + + bad_ids = [m for m in compartment_list + if not isinstance(m.id, string_types) or len(m.id) < 1 or + m is ' '] + if len(bad_ids) != 0: + raise ValueError('invalid identifiers in {}'.format(repr(bad_ids))) + + 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. @@ -863,6 +882,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() @@ -1050,15 +1070,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/dict.py b/cobra/io/dict.py index da4369a8d..67db24788 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": {}, } @@ -118,6 +124,23 @@ 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): + 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: @@ -174,6 +197,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 +206,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 +236,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']]) model.add_metabolites( [metabolite_from_dict(metabolite) for metabolite in obj['metabolites']] ) @@ -225,6 +252,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..419d0d91c 100644 --- a/cobra/io/json.py +++ b/cobra/io/json.py @@ -229,10 +229,19 @@ def load_json_model(filename): }, "compartments": { - "type": "object", - "patternProperties": { - "[a-z]{1,2}": {"type": "string"} + "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"}, diff --git a/cobra/io/mat.py b/cobra/io/mat.py index ddcb57b49..36d764235 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(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(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..ea40fcef5 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: 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/manipulation/modify.py b/cobra/manipulation/modify.py index c980dba4e..73e8e4f71 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..7316ea75a 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 51d719f2e..18c5051a1 100644 --- a/cobra/test/data/mini.json +++ b/cobra/test/data/mini.json @@ -1,8 +1,14 @@ { - "compartments": { - "c": "cytosol", - "e": "extracellular" - }, + "compartments": [ + { + "id": "c", + "name": "cytosol" + }, + { + "id": "e", + "name": "extracellular" + } + ], "genes": [ { "id": "b0755", diff --git a/cobra/test/data/mini.mat b/cobra/test/data/mini.mat index 6726342d3..99287abe2 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..2c6c82b42 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 88327a35f..d34b26741 100644 --- a/cobra/test/data/mini.yml +++ b/cobra/test/data/mini.yml @@ -1143,6 +1143,10 @@ - name: G_s0001 - id: mini_textbook - compartments: - e: extracellular - c: cytosol + - !!omap + - id: e + - name: extracellular + - !!omap + - id: c + - name: cytosol - version: 1 diff --git a/cobra/test/data/mini_cobra.xml b/cobra/test/data/mini_cobra.xml index 48b02294b..41be00d38 100644 --- a/cobra/test/data/mini_cobra.xml +++ b/cobra/test/data/mini_cobra.xml @@ -206,8 +206,8 @@ - + @@ -215,16 +215,16 @@ - - + + -

GENE_ASSOCIATION: b3603 or b2975

+

GENE ASSOCIATION: b3603 or b2975

@@ -241,16 +241,16 @@ - - + +
-

GENE_ASSOCIATION: b2779

+

GENE ASSOCIATION: b2779

@@ -266,9 +266,9 @@ - - + +
@@ -285,9 +285,9 @@ - - + + @@ -304,9 +304,9 @@ - - + + @@ -323,24 +323,24 @@ - - + + -

GENE_ASSOCIATION: b1773 or b2097 or b2925

+

GENE ASSOCIATION: b1773 or b2097 or b2925

- + @@ -348,22 +348,22 @@ - - + +
-

GENE_ASSOCIATION: b1779

+

GENE ASSOCIATION: b1779

- + @@ -376,21 +376,21 @@ - - + +
-

GENE_ASSOCIATION: ( 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 )

+

GENE ASSOCIATION: ( 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 )

- + @@ -402,16 +402,16 @@ - - + +
-

GENE_ASSOCIATION: b0875 or s0001

+

GENE ASSOCIATION: b0875 or s0001

@@ -426,16 +426,16 @@ - - + +
-

GENE_ASSOCIATION: b2133 or b1380

+

GENE ASSOCIATION: b2133 or b1380

@@ -444,8 +444,8 @@ - + @@ -453,16 +453,16 @@ - - + +
-

GENE_ASSOCIATION: b3916 or b1723

+

GENE ASSOCIATION: b3916 or b1723

@@ -470,8 +470,8 @@ - + @@ -480,16 +480,16 @@ - - + +
-

GENE_ASSOCIATION: b4025

+

GENE ASSOCIATION: b4025

@@ -504,16 +504,16 @@ - - + +
-

GENE_ASSOCIATION: b2926

+

GENE ASSOCIATION: b2926

@@ -521,8 +521,8 @@ - + @@ -530,16 +530,16 @@ - - + +
-

GENE_ASSOCIATION: b4395 or b3612 or b0755

+

GENE ASSOCIATION: b4395 or b3612 or b0755

@@ -554,25 +554,25 @@ - - + +
-

GENE_ASSOCIATION: b2987 or b3493

+

GENE ASSOCIATION: b2987 or b3493

- + - + @@ -580,26 +580,26 @@ - - + +
-

GENE_ASSOCIATION: b1854 or b1676

+

GENE ASSOCIATION: b1854 or b1676

- + - + @@ -607,16 +607,16 @@ - - + +
-

GENE_ASSOCIATION: b3919

+

GENE ASSOCIATION: b3919

@@ -631,9 +631,9 @@ - - + +
diff --git a/cobra/test/data/mini_fbc1.xml b/cobra/test/data/mini_fbc1.xml index 58fb4bc9c..bf610cbe3 100644 --- a/cobra/test/data/mini_fbc1.xml +++ b/cobra/test/data/mini_fbc1.xml @@ -313,14 +313,14 @@ - + -

GENE_ASSOCIATION: b3603 or b2975

+

GENE ASSOCIATION: b3603 or b2975

@@ -335,7 +335,7 @@ -

GENE_ASSOCIATION: b2779

+

GENE ASSOCIATION: b2779

@@ -373,27 +373,27 @@ -

GENE_ASSOCIATION: b1773 or b2097 or b2925

+

GENE ASSOCIATION: b1773 or b2097 or b2925

- +
-

GENE_ASSOCIATION: b1779

+

GENE ASSOCIATION: b1779

- + @@ -404,12 +404,12 @@ -

GENE_ASSOCIATION: ( 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 )

+

GENE ASSOCIATION: ( 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 )

- + @@ -419,7 +419,7 @@ -

GENE_ASSOCIATION: b0875 or s0001

+

GENE ASSOCIATION: b0875 or s0001

@@ -432,7 +432,7 @@ -

GENE_ASSOCIATION: b2133 or b1380

+

GENE ASSOCIATION: b2133 or b1380

@@ -441,14 +441,14 @@ - +
-

GENE_ASSOCIATION: b3916 or b1723

+

GENE ASSOCIATION: b3916 or b1723

@@ -456,15 +456,15 @@ - +
-

GENE_ASSOCIATION: b4025

+

GENE ASSOCIATION: b4025

@@ -477,7 +477,7 @@ -

GENE_ASSOCIATION: b2926

+

GENE ASSOCIATION: b2926

@@ -485,14 +485,14 @@ - +
-

GENE_ASSOCIATION: b4395 or b3612 or b0755

+

GENE ASSOCIATION: b4395 or b3612 or b0755

@@ -505,38 +505,38 @@ -

GENE_ASSOCIATION: b2987 or b3493

+

GENE ASSOCIATION: b2987 or b3493

- + - +
-

GENE_ASSOCIATION: b1854 or b1676

+

GENE ASSOCIATION: b1854 or b1676

- + - +
-

GENE_ASSOCIATION: b3919

+

GENE ASSOCIATION: b3919

diff --git a/cobra/test/data/mini_fbc2.xml b/cobra/test/data/mini_fbc2.xml index 53ab76d80..05668e676 100644 --- a/cobra/test/data/mini_fbc2.xml +++ b/cobra/test/data/mini_fbc2.xml @@ -1,854 +1,854 @@ - - + + - - - + + + - - + + - - - - - + + + + + - - + + - - - + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -857,513 +857,513 @@ - - - - - - - - + + + + + + + + - + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - + + + + - + - + - - - - - - - - + + + + + + + + - + - - + + - - - - + + + + - + - + - - + + - - - + + + - + - + - - + + - - - + + + - + - - + + - - + + - - + + - - - + + + - + - + - + - - + + - + - - - + + + - + - + - + - - - + + + - + - + - + - + - + - - - + + + - + - + - + - - + + - - - + + + - - - + + + - + - + - - - + + + - - - + + + - + - - - + + + - + - + - - + + - - + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - + - + - + - + - - + + - + - - + + - - - + + + - - + + - - - + + + - + - + - - + + - - - + + + - - + + - - - + + + - + - + - + - + - + - - - + + + - + - + - - + + - - + + - + - - - + + + - + - + - + - + - - - + + + - - - + + + - + - + - - + + - - + + - - + + - - - + + + - + - + - - - + + + - - + + - - + + - - - + + + - + - + - + - + - + diff --git a/cobra/test/data/mini_fbc2.xml.bz2 b/cobra/test/data/mini_fbc2.xml.bz2 index a9b116708..886ad17dd 100644 Binary files a/cobra/test/data/mini_fbc2.xml.bz2 and b/cobra/test/data/mini_fbc2.xml.bz2 differ diff --git a/cobra/test/data/mini_fbc2.xml.gz b/cobra/test/data/mini_fbc2.xml.gz index 16d383c00..dd157e166 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..85c0a5b95 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..68890f4d2 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..145a65775 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": {"G6PDH2r": 4.95998, "AKGDH": 5.06438, "GLNS": 0.22346, "ADK1": 0.0, "EX_co2_e": 22.80983, "EX_lac__D_e": 0.0, "EX_mal__L_e": 0.0, "ATPM": 8.39, "SUCCt2_2": -0.0, "PIt2r": 3.2149, "GAPD": 16.02353, "ACALDt": 0.0, "TPI": 7.47738, "CO2t": -22.80983, "SUCOAS": -5.06438, "ACONTb": 6.00725, "EX_h2o_e": 29.17583, "TKT2": 1.1815, "TKT1": 1.49698, "O2t": 21.79949, "EX_fum_e": 0.0, "PYK": 1.75818, "FORt2": 0.0, "EX_etoh_e": 0.0, "SUCCt3": -0.0, "GLUN": -0.0, "FUMt2_2": 0.0, "FUM": 5.06438, "EX_glu__L_e": 0.0, "EX_h_e": 17.53087, "EX_pyr_e": 0.0, "ACALD": 0.0, "MALS": -0.0, "EX_nh4_e": -4.76532, "CYTBD": 43.59899, "ENO": 14.71614, "EX_pi_e": -3.2149, "PYRt2": 0.0, "FORti": 0.0, "EX_glc__D_e": -10.0, "H2Ot": -29.17583, "LDH_D": 0.0, "FRD7": 994.93562, "EX_for_e": 0.0, "EX_akg_e": 0.0, "ME1": -0.0, "ME2": -0.0, "FRUpts2": 0.0, "MDH": 5.06438, "GLUDy": -4.54186, "ETOHt2r": 0.0, "EX_gln__L_e": 0.0, "EX_ac_e": 0.0, "MALt2_2": 0.0, "PTAr": -0.0, "TALA": 1.49698, "THD2": -0.0, "ICDHyr": 6.00725, "ALCD2x": 0.0, "PDH": 9.28253, "CS": 6.00725, "GLUt2r": 0.0, "GLNabc": 0.0, "FBP": 0.0, "ATPS4r": 45.51401, "EX_o2_e": -21.79949, "AKGt2r": 0.0, "FBA": 7.47738, "Biomass_Ecoli_core": 0.87392, "NH4t": 4.76532, "D_LACt2": 0.0, "GLCpts": 10.0, "GND": 4.95998, "ACKr": 0.0, "NADH16": 38.53461, "SUCDi": 1000.0, "PPC": 2.50431, "GLUSy": -0.0, "PGL": 4.95998, "PGM": -14.71614, "PGK": -16.02353, "PGI": 4.86086, "PPS": -0.0, "RPE": 2.67848, "RPI": -2.2815, "NADTRHD": -0.0, "ICL": -0.0, "EX_acald_e": 0.0, "EX_succ_e": 0.0, "ACONTa": 6.00725, "PPCK": -0.0, "PFK": 7.47738, "PFL": -0.0, "EX_fru_e": 0.0, "ACt2r": 0.0}, "minimum": {"G6PDH2r": 4.95998, "AKGDH": 5.06438, "GLNS": 0.22346, "ADK1": 0.0, "EX_co2_e": 22.80983, "EX_lac__D_e": 0.0, "EX_mal__L_e": 0.0, "ATPM": 8.39, "SUCCt2_2": -0.0, "PIt2r": 3.2149, "GAPD": 16.02353, "ACALDt": -0.0, "TPI": 7.47738, "CO2t": -22.80983, "SUCOAS": -5.06438, "ACONTb": 6.00725, "EX_h2o_e": 29.17583, "TKT2": 1.1815, "TKT1": 1.49698, "O2t": 21.79949, "EX_fum_e": 0.0, "PYK": 1.75818, "FORt2": 0.0, "EX_etoh_e": 0.0, "SUCCt3": 0.0, "GLUN": 0.0, "FUMt2_2": -0.0, "FUM": 5.06438, "EX_glu__L_e": 0.0, "EX_h_e": 17.53087, "EX_pyr_e": 0.0, "ACALD": -0.0, "MALS": 0.0, "EX_nh4_e": -4.76532, "CYTBD": 43.59899, "ENO": 14.71614, "EX_pi_e": -3.2149, "PYRt2": -0.0, "FORti": 0.0, "EX_glc__D_e": -10.0, "H2Ot": -29.17583, "LDH_D": -0.0, "FRD7": 0.0, "EX_for_e": 0.0, "EX_akg_e": 0.0, "ME1": 0.0, "ME2": 0.0, "FRUpts2": -0.0, "MDH": 5.06438, "GLUDy": -4.54186, "ETOHt2r": -0.0, "EX_gln__L_e": 0.0, "EX_ac_e": 0.0, "MALt2_2": -0.0, "PTAr": 0.0, "TALA": 1.49698, "THD2": 0.0, "ICDHyr": 6.00725, "ALCD2x": -0.0, "PDH": 9.28253, "CS": 6.00725, "GLUt2r": -0.0, "GLNabc": 0.0, "FBP": 0.0, "ATPS4r": 45.51401, "EX_o2_e": -21.79949, "AKGt2r": -0.0, "FBA": 7.47738, "Biomass_Ecoli_core": 0.87392, "NH4t": 4.76532, "D_LACt2": -0.0, "GLCpts": 10.0, "GND": 4.95998, "ACKr": -0.0, "NADH16": 38.53461, "SUCDi": 5.06438, "PPC": 2.50431, "GLUSy": 0.0, "PGL": 4.95998, "PGM": -14.71614, "PGK": -16.02353, "PGI": 4.86086, "PPS": 0.0, "RPE": 2.67848, "RPI": -2.2815, "NADTRHD": 0.0, "ICL": 0.0, "EX_acald_e": 0.0, "EX_succ_e": 0.0, "ACONTa": 6.00725, "PPCK": 0.0, "PFK": 7.47738, "PFL": 0.0, "EX_fru_e": 0.0, "ACt2r": -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..6a49ef97b 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": {"G6PDH2r": 4.95998, "AKGDH": 5.06438, "GLNS": 0.22346, "ADK1": -0.0, "EX_co2_e": 22.80983, "EX_lac__D_e": -0.0, "EX_mal__L_e": -0.0, "ATPM": 8.39, "SUCCt2_2": -0.0, "PIt2r": 3.2149, "GAPD": 16.02353, "ACALDt": 0.0, "TPI": 7.47738, "CO2t": -22.80983, "SUCOAS": -5.06438, "ACONTb": 6.00725, "EX_h2o_e": 29.17583, "TKT2": 1.1815, "TKT1": 1.49698, "O2t": 21.79949, "EX_fum_e": 0.0, "PYK": 1.75818, "FORt2": -0.0, "EX_etoh_e": -0.0, "SUCCt3": -0.0, "GLUN": -0.0, "FUMt2_2": 0.0, "FUM": 5.06438, "EX_glu__L_e": -0.0, "EX_h_e": 17.53087, "EX_pyr_e": -0.0, "ACALD": 0.0, "MALS": -0.0, "EX_nh4_e": -4.76532, "CYTBD": 43.59899, "ENO": 14.71614, "EX_pi_e": -3.2149, "PYRt2": 0.0, "FORti": -0.0, "EX_glc__D_e": -10.0, "H2Ot": -29.17583, "LDH_D": 0.0, "FRD7": 25.9211, "EX_for_e": -0.0, "EX_akg_e": -0.0, "ME1": -0.0, "ME2": -0.0, "FRUpts2": 0.0, "MDH": 5.06438, "GLUDy": -4.54186, "ETOHt2r": -0.0, "EX_gln__L_e": 0.0, "EX_ac_e": -0.0, "MALt2_2": 0.0, "PTAr": -0.0, "TALA": 1.49698, "THD2": -0.0, "ICDHyr": 6.00725, "ALCD2x": -0.0, "PDH": 9.28253, "CS": 6.00725, "GLUt2r": 0.0, "GLNabc": 0.0, "FBP": -0.0, "ATPS4r": 45.51401, "EX_o2_e": -21.79949, "AKGt2r": 0.0, "FBA": 7.47738, "Biomass_Ecoli_core": 0.87392, "NH4t": 4.76532, "D_LACt2": 0.0, "GLCpts": 10.0, "GND": 4.95998, "ACKr": 0.0, "NADH16": 38.53461, "SUCDi": 30.98548, "PPC": 2.50431, "GLUSy": -0.0, "PGL": 4.95998, "PGM": -14.71614, "PGK": -16.02353, "PGI": 4.86086, "PPS": -0.0, "RPE": 2.67848, "RPI": -2.2815, "NADTRHD": -0.0, "ICL": -0.0, "EX_acald_e": -0.0, "EX_succ_e": -0.0, "ACONTa": 6.00725, "PPCK": -0.0, "PFK": 7.47738, "PFL": -0.0, "EX_fru_e": -0.0, "ACt2r": 0.0}, "minimum": {"G6PDH2r": 4.95998, "AKGDH": 5.06438, "GLNS": 0.22346, "ADK1": 0.0, "EX_co2_e": 22.80983, "EX_lac__D_e": 0.0, "EX_mal__L_e": 0.0, "ATPM": 8.39, "SUCCt2_2": 0.0, "PIt2r": 3.2149, "GAPD": 16.02353, "ACALDt": 0.0, "TPI": 7.47738, "CO2t": -22.80983, "SUCOAS": -5.06438, "ACONTb": 6.00725, "EX_h2o_e": 29.17583, "TKT2": 1.1815, "TKT1": 1.49698, "O2t": 21.79949, "EX_fum_e": 0.0, "PYK": 1.75818, "FORt2": 0.0, "EX_etoh_e": 0.0, "SUCCt3": 0.0, "GLUN": 0.0, "FUMt2_2": 0.0, "FUM": 5.06438, "EX_glu__L_e": 0.0, "EX_h_e": 17.53087, "EX_pyr_e": 0.0, "ACALD": 0.0, "MALS": 0.0, "EX_nh4_e": -4.76532, "CYTBD": 43.59899, "ENO": 14.71614, "EX_pi_e": -3.2149, "PYRt2": 0.0, "FORti": 0.0, "EX_glc__D_e": -10.0, "H2Ot": -29.17583, "LDH_D": 0.0, "FRD7": 0.0, "EX_for_e": 0.0, "EX_akg_e": 0.0, "ME1": 0.0, "ME2": 0.0, "FRUpts2": 0.0, "MDH": 5.06438, "GLUDy": -4.54186, "ETOHt2r": 0.0, "EX_gln__L_e": 0.0, "EX_ac_e": 0.0, "MALt2_2": 0.0, "PTAr": 0.0, "TALA": 1.49698, "THD2": 0.0, "ICDHyr": 6.00725, "ALCD2x": 0.0, "PDH": 9.28253, "CS": 6.00725, "GLUt2r": 0.0, "GLNabc": 0.0, "FBP": 0.0, "ATPS4r": 45.51401, "EX_o2_e": -21.79949, "AKGt2r": 0.0, "FBA": 7.47738, "Biomass_Ecoli_core": 0.87392, "NH4t": 4.76532, "D_LACt2": 0.0, "GLCpts": 10.0, "GND": 4.95998, "ACKr": 0.0, "NADH16": 38.53461, "SUCDi": 5.06438, "PPC": 2.50431, "GLUSy": 0.0, "PGL": 4.95998, "PGM": -14.71614, "PGK": -16.02353, "PGI": 4.86086, "PPS": 0.0, "RPE": 2.67848, "RPI": -2.2815, "NADTRHD": 0.0, "ICL": 0.0, "EX_acald_e": 0.0, "EX_succ_e": 0.0, "ACONTa": 6.00725, "PPCK": 0.0, "PFK": 7.47738, "PFL": 0.0, "EX_fru_e": 0.0, "ACt2r": 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..25b28898b 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..87bb90e16 100755 --- a/cobra/test/data/update_pickles.py +++ b/cobra/test/data/update_pickles.py @@ -76,6 +76,7 @@ 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) diff --git a/cobra/test/test_io.py b/cobra/test/test_io.py index 08a46a62b..76955d42a 100644 --- a/cobra/test/test_io.py +++ b/cobra/test/test_io.py @@ -129,7 +129,13 @@ def raise_libsbml_errors(): def io_trial(request, data_directory): with open(join(data_directory, request.param.reference_file), "rb") as infile: - reference_model = load(infile) + try: + reference_model = load(infile) + except UnicodeDecodeError: + try: + reference_model = load(infile, encoding='utf-8') + except UnicodeDecodeError: + reference_model = load(infile, encoding='latin1') test_model = request.param.read_function(join(data_directory, request.param.test_file)) test_output_filename = join(gettempdir(), @@ -182,7 +188,7 @@ def compare_models(cls, name, model1, model2): @classmethod def extra_comparisons(cls, name, model1, model2): - assert model1.compartments == model2.compartments + assert len(model1.compartments) == len(model2.compartments) assert dict(model1.metabolites[4].annotation) == dict( model2.metabolites[4].annotation) assert dict(model1.reactions[4].annotation) == dict( diff --git a/cobra/test/test_io_order.py b/cobra/test/test_io_order.py index 5d9016bc7..97e77221b 100644 --- a/cobra/test/test_io_order.py +++ b/cobra/test/test_io_order.py @@ -26,8 +26,9 @@ 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 and %d genes", + new.id, new.metabolites, new.reactions, new.genes, + new.compartments) return new @@ -39,6 +40,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 +55,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 +66,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_model.py b/cobra/test/test_model.py index 660567446..1f1093260 100644 --- a/cobra/test/test_model.py +++ b/cobra/test/test_model.py @@ -400,16 +400,15 @@ def test_remove_metabolite_destructive(self, model): assert reaction in model.reactions def test_compartments(self, model): - assert set(model.compartments) == {"c", "e"} model = Model("test", "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) == 2 + assert model.compartments.c.id == 'c' + assert model.compartments.e.id == 'e' def test_add_reaction(self, model): old_reaction_count = len(model.reactions) diff --git a/cobra/util/version_info.py b/cobra/util/version_info.py index 6b54cc33d..50a706042 100644 --- a/cobra/util/version_info.py +++ b/cobra/util/version_info.py @@ -55,6 +55,7 @@ def get_pkg_info(): # using requirements files that can be read in. dependencies = frozenset(PKG_ORDER) blob = dict() + for dist in pkg_resources.working_set: if dist.project_name in dependencies: blob[dist.project_name] = dist.version diff --git a/test.xml b/test.xml new file mode 100644 index 000000000..05668e676 --- /dev/null +++ b/test.xml @@ -0,0 +1,1371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +