Exemplo n.º 1
0
 def test_incorrect_arguments_raises(self, pathway_predictor):
     model, _ = pathway_predictor
     with pytest.raises(ValueError) as excinfo:
         PathwayPredictor(model, universal_model='Mickey_Mouse')
     assert re.search(r'Provided universal_model.*', str(excinfo.value))
     with pytest.raises(ValueError) as excinfo:
         PathwayPredictor(model, compartment_regexp='Mickey_Mouse')
Exemplo n.º 2
0
def pathway_predictor(request, data_directory, universal_model):
    core_model = load_model(join(data_directory, 'EcoliCore.xml'), sanitize=False)
    core_model.solver = request.param
    predictor = PathwayPredictor(core_model, universal_model=universal_model)
    return core_model, predictor
Exemplo n.º 3
0
 def test_setting_incorrect_universal_model_raises(self):
     with self.assertRaisesRegexp(ValueError, 'Provided universal_model.*'):
         PathwayPredictor(TESTMODEL, universal_model='Mickey_Mouse')
Exemplo n.º 4
0
from __future__ import absolute_import, print_function

import os
import unittest
from cameo import load_model
from cameo.strain_design.pathway_prediction import PathwayPredictor
from cameo.models import universal

TESTDIR = os.path.dirname(__file__)
TESTMODEL = load_model(os.path.join(TESTDIR, 'data/EcoliCore.xml'))
UNIVERSALMODEL = load_model(os.path.join(TESTDIR, 'data/iJO1366.xml'))

TRAVIS = os.getenv('TRAVIS', False)

PATHWAYPREDICTOR = PathwayPredictor(TESTMODEL, universal_model=UNIVERSALMODEL)


class TestPathwayPredictor(unittest.TestCase):
    def setUp(self):
        self.pathway_predictor = PATHWAYPREDICTOR

    def test_setting_incorrect_universal_model_raises(self):
        with self.assertRaisesRegexp(ValueError, 'Provided universal_model.*'):
            PathwayPredictor(TESTMODEL, universal_model='Mickey_Mouse')

    # def test_predict_native_compound_returns_shorter_alternatives(self):
    #     result = self.pathway_predictor.run(product='Phosphoenolpyruvate', max_predictions=1)
    #     self.assertTrue(len(result.pathways) == 1)
    #     self.assertTrue(len(result.pathways[0].pathway) == 3)
    #     self.assertTrue(len(result.pathways[0].adapters) == 0)
Exemplo n.º 5
0
 def setUp(self):
     TESTMODEL.solver = "cplex"
     self.pathway_predictor = PathwayPredictor(
         TESTMODEL, universal_model=UNIVERSALMODEL)
Exemplo n.º 6
0
 def test_setting_incorrect_universal_model_raises(self, pathway_predictor):
     model, predictor = pathway_predictor
     with pytest.raises(ValueError) as excinfo:
         PathwayPredictor(model, universal_model='Mickey_Mouse')
     assert re.search(r'Provided universal_model.*', str(excinfo.value))