def test_flux_variability_unbounded(self):
        self.model.limits['rxn_7'].upper = float('inf')
        self.model.limits['rxn_8'].upper = float('inf')

        if self.solver.properties['name'] == 'qsoptex':
            # QSopt_ex returns status code 100 for this example. It seems that
            # it is unable to determine whether the problem is unbounded.
            self.skipTest('Skipping because of known issue with QSopt_ex')

        fluxes = dict(
            fluxanalysis.flux_variability(self.model,
                                          self.model.reactions, {'rxn_6': 200},
                                          tfba=False,
                                          solver=self.solver))

        for bounds in itervalues(fluxes):
            self.assertEqual(len(bounds), 2)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertAlmostEqual(fluxes['rxn_7'][0], 0)
        self.assertEqual(fluxes['rxn_7'][1], float('inf'))

        self.assertAlmostEqual(fluxes['rxn_8'][0], 0)
        self.assertEqual(fluxes['rxn_8'][1], float('inf'))
Example #2
0
    def test_flux_variability_thermodynamic(self):
        fluxes = dict(fluxanalysis.flux_variability(
            self.model, self.model.reactions, {'rxn_6': 200},
            tfba=True, solver=self.solver))

        self.assertAlmostEqual(fluxes['rxn_1'][0], 100)

        self.assertAlmostEqual(fluxes['rxn_2'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_2'][1], 0)

        self.assertAlmostEqual(fluxes['rxn_5'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_5'][1], 100)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertAlmostEqual(fluxes['rxn_7'][1], 0)
        self.assertAlmostEqual(fluxes['rxn_8'][1], 0)
Example #3
0
    def test_flux_variability(self):
        fluxes = dict(fluxanalysis.flux_variability(
            self.model, self.model.reactions, {'rxn_6': 200},
            tfba=False, solver=self.solver))

        self.assertEqual(fluxes['rxn_1'][0], 100)

        self.assertEqual(fluxes['rxn_2'][0], 0)
        self.assertEqual(fluxes['rxn_2'][1], 0)

        self.assertEqual(fluxes['rxn_5'][0], 0)
        self.assertEqual(fluxes['rxn_5'][1], 100)

        self.assertEqual(fluxes['rxn_6'][0], 200)

        self.assertGreater(fluxes['rxn_7'][1], 0)
        self.assertGreater(fluxes['rxn_8'][1], 0)
    def test_flux_variability_thermodynamic(self):
        fluxes = dict(
            fluxanalysis.flux_variability(self.model,
                                          self.model.reactions, {'rxn_6': 200},
                                          tfba=True,
                                          solver=self.solver))

        self.assertAlmostEqual(fluxes['rxn_1'][0], 100)

        self.assertAlmostEqual(fluxes['rxn_2'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_2'][1], 0)

        self.assertAlmostEqual(fluxes['rxn_5'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_5'][1], 100)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertAlmostEqual(fluxes['rxn_7'][1], 0)
        self.assertAlmostEqual(fluxes['rxn_8'][1], 0)
Example #5
0
    def test_flux_variability(self):
        fluxes = dict(fluxanalysis.flux_variability(
            self.model, self.model.reactions, {'rxn_6': 200},
            tfba=False, solver=self.solver))

        for bounds in itervalues(fluxes):
            self.assertEqual(len(bounds), 2)

        self.assertAlmostEqual(fluxes['rxn_1'][0], 100)

        self.assertAlmostEqual(fluxes['rxn_2'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_2'][1], 0)

        self.assertAlmostEqual(fluxes['rxn_5'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_5'][1], 100)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertGreater(fluxes['rxn_7'][1], 0)
        self.assertGreater(fluxes['rxn_8'][1], 0)
    def test_flux_variability(self):
        fluxes = dict(
            fluxanalysis.flux_variability(self.model,
                                          self.model.reactions, {'rxn_6': 200},
                                          tfba=False,
                                          solver=self.solver))

        for bounds in itervalues(fluxes):
            self.assertEqual(len(bounds), 2)

        self.assertAlmostEqual(fluxes['rxn_1'][0], 100)

        self.assertAlmostEqual(fluxes['rxn_2'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_2'][1], 0)

        self.assertAlmostEqual(fluxes['rxn_5'][0], 0)
        self.assertAlmostEqual(fluxes['rxn_5'][1], 100)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertGreater(fluxes['rxn_7'][1], 0)
        self.assertGreater(fluxes['rxn_8'][1], 0)
Example #7
0
    def test_flux_variability_unbounded(self):
        self.model.limits['rxn_7'].upper = float('inf')
        self.model.limits['rxn_8'].upper = float('inf')

        if self.solver.properties['name'] == 'qsoptex':
            # QSopt_ex returns status code 100 for this example. It seems that
            # it is unable to determine whether the problem is unbounded.
            self.skipTest('Skipping because of known issue with QSopt_ex')

        fluxes = dict(fluxanalysis.flux_variability(
            self.model, self.model.reactions, {'rxn_6': 200},
            tfba=False, solver=self.solver))

        for bounds in itervalues(fluxes):
            self.assertEqual(len(bounds), 2)

        self.assertAlmostEqual(fluxes['rxn_6'][0], 200)

        self.assertAlmostEqual(fluxes['rxn_7'][0], 0)
        self.assertEqual(fluxes['rxn_7'][1], float('inf'))

        self.assertAlmostEqual(fluxes['rxn_8'][0], 0)
        self.assertEqual(fluxes['rxn_8'][1], float('inf'))