def test_moma_minimal_fba(self): p = moma.MOMAProblem(self.model, self.solver) fluxes = p.get_minimal_fba_flux('rxn_6') self.assertAlmostEqual(fluxes['rxn_1'], 500) self.assertAlmostEqual(fluxes['rxn_2'], 0) self.assertAlmostEqual(fluxes['rxn_3'], 1000) self.assertAlmostEqual(fluxes['rxn_6'], 1000)
def test_linear_moma2(self): p = moma.MOMAProblem(self.model, self.solver) with p.constraints(p.get_flux_var('rxn_3') == 0): p.lin_moma2('rxn_6', 1000) self.assertAlmostEqual(p.get_flux('rxn_1'), 500) self.assertAlmostEqual(p.get_flux('rxn_2'), 0) self.assertAlmostEqual(p.get_flux('rxn_3'), 0) self.assertAlmostEqual(p.get_flux('rxn_4'), 1000) self.assertAlmostEqual(p.get_flux('rxn_5'), 1000) self.assertAlmostEqual(p.get_flux('rxn_6'), 1000)
def test_linear_moma(self): p = moma.MOMAProblem(self.model, self.solver) with p.constraints(p.get_flux_var('rxn_3') == 0): p.lin_moma({ 'rxn_3': 1000, 'rxn_4': 0, 'rxn_5': 0, }) # The closest solution when these are constrained is for # rxn_6 to take on a flux of zero. self.assertAlmostEqual(p.get_flux('rxn_6'), 0)