def setUp(self): self._model = NativeModel({ 'name': 'Test model', 'biomass': 'rxn_1', 'reactions': [{ 'id': 'rxn_1', 'name': 'Reaction 1', 'equation': '|A_\u2206[e]| => |B[c]|', 'genes': ['gene_1', 'gene_2'] }, { 'id': 'rxn_2_\u03c0', 'name': 'Reaction 2', 'equation': '|B[c]| <=> |C[e]|', 'genes': 'gene_3 or (gene_4 and gene_5)' }, { 'id': 'rxn_3', 'equation': 'D[c] => E[c]' }], 'compounds': [{ 'id': 'A_\u2206', 'name': 'Compound A', 'charge': 0 }, { 'id': 'B', 'name': 'Compound B', 'formula': 'H2O', 'charge': -1 }, { 'id': 'C', 'charge': -1, 'formula': 'O2' }], 'media': [{ 'compartment': 'e', 'compounds': [{ 'id': 'A_\u2206' }, { 'id': 'C' }] }], 'limits': [{ 'reaction': 'rxn_2_\u03c0', 'upper': 100 }] }) self._infeasible_model = NativeModel({ 'biomass': 'rxn_1', 'reactions': [{ 'id': 'rxn_1', 'equation': 'A[c] => B[c]' }], 'limits': [{ 'reaction': 'rxn_1', 'fixed': 10 }] })
def setUp(self): self._model_dir = tempfile.mkdtemp() path = os.path.join(self._model_dir, 'model.yaml') with codecs.open(path, 'w', 'utf-8') as f: f.write('''--- name: Test model biomass: rxn_1 reactions: - id: rxn_1 equation: '|A_\u2206[e]| => |B[c]|' genes: - gene_1 - gene_2 - id: rxn_2_\u03c0 equation: '|B[c]| => |C[e]|' genes: 'gene_3 or (gene_4 and gene_5)' compounds: - id: A_\u2206 - id: B - id: C media: - compartment: e compounds: - id: A_\u2206 - id: C limits: - reaction: rxn_2_\u03c0 upper: 100 ''') self._model = NativeModel(self._model_dir)
def setUp(self): self._model_dir = tempfile.mkdtemp() with open(os.path.join(self._model_dir, 'model.yaml'), 'w') as f: f.write('\n'.join([ '---', 'reactions:', ' - id: rxn_1', ' equation: A[e] <=> B[c]', ' genes: gene_1 and gene_2', ' - id: rxn_2', ' equation: A[e] => C[c]', ' genes: gene_3', ' - id: rxn_3', ' equation: A[e] => D[e]', ' - id: rxn_4', ' equation: C[c] => D[e]', ' genes: [gene_4, gene_5, gene_6]', 'compounds:', ' - id: A', ' - id: B', ' - id: C', ' - id: D', 'media:', ' - compartment: e', ' compounds:', ' - id: A', ' reaction: rxn_5', ' - id: D', ' reaction: rxn_6', 'model:', ' - reactions:', ' - rxn_3', ' - rxn_4', ])) self._model = NativeModel(self._model_dir)
def setUp(self): self._model_dir = tempfile.mkdtemp() with open(os.path.join(self._model_dir, 'model.yaml'), 'w') as f: f.write('\n'.join([ '---', 'reactions:', ' - id: rxn_1', ' equation: A[e] => B[c]', ' - id: rxn_2', ' equation: B[c] => C[e]', ' - id: rxn_3', ' equation: A[e] + (6) B[c] <=> (6) C[e] + (6) D[c]', 'compounds:', ' - id: A', ' formula: C6H12O6', ' charge: 1', ' - id: B', ' formula: O2', ' charge: 1', ' - id: C', ' formula: CO2', ' charge: -1', ' - id: D', ' formula: H2O', ])) self._model = NativeModel.load_model_from_path(self._model_dir)
def setUp(self): self.dest = tempfile.mkdtemp() self.model = NativeModel({ 'id': 'test_mode', 'name': 'Test model', }) # Compounds self.model.compounds.add_entry( CompoundEntry({ 'id': 'cpd_1', 'formula': Formula.parse('CO2') })) self.model.compounds.add_entry(CompoundEntry({ 'id': 'cpd_2', })) self.model.compounds.add_entry(CompoundEntry({ 'id': 'cpd_3', })) # Compartments self.model.compartments.add_entry(CompartmentEntry({'id': 'c'})) self.model.compartments.add_entry(CompartmentEntry({'id': 'e'})) # Reactions self.model.reactions.add_entry( ReactionEntry({ 'id': 'rxn_1', 'equation': parse_reaction('(2) cpd_1[c] <=> cpd_2[e] + cpd_3[c]'), 'genes': boolean.Expression('g_1 and (g_2 or g_3)'), 'subsystem': 'Some subsystem' })) self.model.reactions.add_entry( ReactionEntry({ 'id': 'rxn_2', 'equation': parse_reaction( '(0.234) cpd_1[c] + (1.34) cpd_2[c] => cpd_3[c]'), 'subsystem': 'Biomass' })) self.model.biomass_reaction = 'rxn_2' self.model.limits['rxn_1'] = 'rxn_1', Decimal(-42), Decimal(1000) self.model.exchange[Compound('cpd_2', 'e')] = (Compound('cpd_2', 'e'), 'EX_cpd_2', -10, 0)