当前位置: 首页>>代码示例>>Python>>正文


Python database.DictDatabase类代码示例

本文整理汇总了Python中psamm.database.DictDatabase的典型用法代码示例。如果您正苦于以下问题:Python DictDatabase类的具体用法?Python DictDatabase怎么用?Python DictDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DictDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestFastcoreTinyBiomassModel

class TestFastcoreTinyBiomassModel(unittest.TestCase):
    """Test fastcore using a model with tiny values in biomass reaction

    This model is consistent mathematically since there is a flux solution
    within the flux bounds. However, the numerical nature of the fastcore
    algorithm requires an epsilon-parameter indicating the minimum flux that
    is considered non-zero. For this reason, some models with reactions where
    tiny stoichiometric values appear can be seen as inconsistent by
    fastcore.

    In this particular model, rxn_2 can take a maximum flux of 1000. At the
    same time rxn_1 will have to take a flux of 1e-4. This is the maximum
    possible flux for rxn_1 so running fastcore with an epsilon larger than
    1e-4 will indicate that the model is not consistent.
    """

    def setUp(self):
        # TODO use mock model instead of actual model
        self.database = DictDatabase()
        self.database.set_reaction("rxn_1", parse_reaction("=> |A|"))
        self.database.set_reaction("rxn_2", parse_reaction("(0.000001) |A| =>"))
        self.model = MetabolicModel.load_model(self.database, self.database.reactions)
        self.solver = cplex.Solver()

    def test_fastcc_is_consistent(self):
        self.assertTrue(fastcore.fastcc_is_consistent(self.model, 0.001, solver=self.solver))

    def test_fastcore_induced_model(self):
        core = {"rxn_2"}
        self.assertEquals(set(fastcore.fastcore(self.model, core, 0.001, solver=self.solver)), {"rxn_1", "rxn_2"})

    def test_fastcore_induced_model_high_epsilon(self):
        core = {"rxn_2"}
        self.assertEquals(set(fastcore.fastcore(self.model, core, 0.1, solver=self.solver)), {"rxn_1", "rxn_2"})
开发者ID:gitter-badger,项目名称:psamm,代码行数:34,代码来源:test_fastcore.py

示例2: TestMassConsistencyZeroMass

class TestMassConsistencyZeroMass(unittest.TestCase):
    """Test mass consistency using a model with zero-mass compound"""

    def setUp(self):
        self.database = DictDatabase()
        self.database.set_reaction('rxn_1', parse_reaction(
            '|A| + |B| => |C|'))
        self.database.set_reaction('rxn_2', parse_reaction(
            '|C| + |Z| => |A| + |B|'))
        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)

        try:
            self.solver = generic.Solver()
        except generic.RequirementsError:
            self.skipTest('Unable to find an LP solver for tests')

    def test_is_consistent_with_zeromass(self):
        consistent = massconsistency.is_consistent(
            self.model, solver=self.solver, zeromass={Compound('Z')})
        self.assertTrue(consistent)

    def test_compound_consistency_with_zeromass(self):
        compounds = dict(massconsistency.check_compound_consistency(
            self.model, solver=self.solver, zeromass={Compound('Z')}))
        for c, value in iteritems(compounds):
            self.assertGreaterEqual(value, 1)

    def test_reaction_consistency_with_zeromass(self):
        reactions, _ = massconsistency.check_reaction_consistency(
            self.model, solver=self.solver, zeromass={Compound('Z')})
        reactions = dict(reactions)

        for r, value in iteritems(reactions):
            self.assertAlmostEqual(value, 0)
开发者ID:keitht547,项目名称:psamm,代码行数:35,代码来源:test_massconsistency.py

示例3: TestFluxBalanceThermodynamic

class TestFluxBalanceThermodynamic(unittest.TestCase):
    def setUp(self):
        self.database = DictDatabase()
        self.database.set_reaction('ex_A', parse_reaction('|A| <=>'))
        self.database.set_reaction('ex_D', parse_reaction('|D| <=>'))
        self.database.set_reaction('rxn_1', parse_reaction('|A| => |B|'))
        self.database.set_reaction('rxn_2', parse_reaction('|B| <=> |C|'))
        self.database.set_reaction('rxn_3', parse_reaction('|C| <=> |D|'))
        self.database.set_reaction('rxn_4', parse_reaction('|D| <=> |E|'))
        self.database.set_reaction('rxn_5', parse_reaction('|E| => |B|'))

        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)
        self.model.limits['ex_A'].lower = -10 # Low uptake
        self.model.limits['ex_D'].lower = 0 # No uptake

        try:
            self.solver = generic.Solver(integer=True)
        except generic.RequirementsError:
            self.skipTest('Unable to find an MILP solver for tests')

    def test_flux_balance_tfba_exchange_d(self):
        fluxes = dict(fluxanalysis.flux_balance(
            self.model, 'ex_D', tfba=True, solver=self.solver))
        self.assertAlmostEqual(fluxes['ex_A'], -10)
        self.assertAlmostEqual(fluxes['ex_D'], 10)
        self.assertAlmostEqual(fluxes['rxn_2'], 10)
        self.assertAlmostEqual(fluxes['rxn_4'], 0)
        self.assertAlmostEqual(fluxes['rxn_5'], 0)
开发者ID:ForkBackups,项目名称:psamm,代码行数:29,代码来源:test_fluxanalysis.py

示例4: TestFluxBalanceThermodynamic

class TestFluxBalanceThermodynamic(unittest.TestCase):
    def setUp(self):
        self.database = DictDatabase()
        self.database.set_reaction('ex_A', parse_reaction('|A| <=>'))
        self.database.set_reaction('ex_D', parse_reaction('|D| <=>'))
        self.database.set_reaction('rxn_1', parse_reaction('|A| => |B|'))
        self.database.set_reaction('rxn_2', parse_reaction('|B| <=> |C|'))
        self.database.set_reaction('rxn_3', parse_reaction('|C| <=> |D|'))
        self.database.set_reaction('rxn_4', parse_reaction('|D| <=> |E|'))
        self.database.set_reaction('rxn_5', parse_reaction('|E| => |B|'))

        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)
        self.model.limits['ex_A'].lower = -10 # Low uptake
        self.model.limits['ex_D'].lower = 0 # No uptake

        self.solver = cplex.Solver()

    def test_flux_balance_tfba_exchange_d(self):
        fluxes = dict(fluxanalysis.flux_balance(
            self.model, 'ex_D', tfba=True, solver=self.solver))
        self.assertEquals(fluxes['ex_A'], -10)
        self.assertEquals(fluxes['ex_D'], 10)
        self.assertEquals(fluxes['rxn_2'], 10)
        self.assertEquals(fluxes['rxn_4'], 0)
        self.assertEquals(fluxes['rxn_5'], 0)
开发者ID:gitter-badger,项目名称:psamm,代码行数:26,代码来源:test_fluxanalysis.py

示例5: TestMassConsistencyZeroMass

class TestMassConsistencyZeroMass(unittest.TestCase):
    """Test mass consistency using a model with zero-mass compound"""

    def setUp(self):
        # TODO use mock model instead of actual model
        self.database = DictDatabase()
        self.database.set_reaction('rxn_1', parse_reaction(
            '|A| + |B| => |C|'))
        self.database.set_reaction('rxn_2', parse_reaction(
            '|C| + |Z| => |A| + |B|'))
        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)

        self.solver = cplex.Solver()

    def test_is_consistent_with_zeromass(self):
        consistent = massconsistency.is_consistent(
            self.model, solver=self.solver, zeromass={'Z'})
        self.assertTrue(consistent)

    def test_compound_consistency_with_zeromass(self):
        compounds = dict(massconsistency.check_compound_consistency(
            self.model, solver=self.solver, zeromass={'Z'}))
        self.assertEquals(compounds[Compound('Z')], 0)
        for c, value in compounds.iteritems():
            if c.name != 'Z':
                self.assertGreaterEqual(value, 1)

    def test_reaction_consistency_with_zeromass(self):
        reactions, _ = massconsistency.check_reaction_consistency(
            self.model, solver=self.solver, zeromass={'Z'})
        reactions = dict(reactions)

        for r, value in reactions.iteritems():
            self.assertEqual(value, 0)
开发者ID:gitter-badger,项目名称:psamm,代码行数:35,代码来源:test_massconsistency.py

示例6: test_load_model_with_reaction_subset

    def test_load_model_with_reaction_subset(self):
        database = DictDatabase()
        database.set_reaction('rxn_1', parse_reaction('|A| => |B|'))
        database.set_reaction('rxn_2', parse_reaction('|B| => |C|'))
        database.set_reaction('rxn_3', parse_reaction('|C| => |D|'))
        model = MetabolicModel.load_model(database, {'rxn_1'})

        self.assertEqual(set(model.reactions), {'rxn_1'})
开发者ID:amenge,项目名称:psamm,代码行数:8,代码来源:test_metabolicmodel.py

示例7: TestLinearMOMA

class TestLinearMOMA(unittest.TestCase):
    def setUp(self):
        self.database = DictDatabase()
        self.database.set_reaction('rxn_1', parse_reaction('=> (2) |A|'))
        self.database.set_reaction('rxn_2', parse_reaction('|A| <=> |B|'))
        self.database.set_reaction('rxn_3', parse_reaction('|A| => |D|'))
        self.database.set_reaction('rxn_4', parse_reaction('|A| => |C|'))
        self.database.set_reaction('rxn_5', parse_reaction('|C| => |D|'))
        self.database.set_reaction('rxn_6', parse_reaction('|D| =>'))
        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)

        try:
            self.solver = generic.Solver()
        except generic.RequirementsError:
            self.skipTest('Unable to find an LP solver for tests')

    def test_moma_fba(self):
        p = moma.MOMAProblem(self.model, self.solver)
        fluxes = p.get_fba_flux('rxn_6')
        self.assertAlmostEqual(fluxes['rxn_1'], 500)
        self.assertAlmostEqual(fluxes['rxn_2'], 0)
        self.assertAlmostEqual(fluxes['rxn_6'], 1000)

    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_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)

    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)
开发者ID:keitht547,项目名称:psamm,代码行数:56,代码来源:test_moma.py

示例8: TestFastcoreTinyBiomassModel

class TestFastcoreTinyBiomassModel(unittest.TestCase):
    """Test fastcore using a model with tiny values in biomass reaction

    This model is consistent mathematically since there is a flux solution
    within the flux bounds. However, the numerical nature of the fastcore
    algorithm requires an epsilon-parameter indicating the minimum flux that
    is considered non-zero. For this reason, some models with reactions where
    tiny stoichiometric values appear can be seen as inconsistent by
    fastcore.

    In this particular model, rxn_2 can take a maximum flux of 1000. At the
    same time rxn_1 will have to take a flux of 1e-3. This is the maximum
    possible flux for rxn_1 so running fastcore with an epsilon larger than
    1e-3 will indicate that the model is not consistent.
    """

    def setUp(self):
        # TODO use mock model instead of actual model
        self.database = DictDatabase()
        self.database.set_reaction('rxn_1', parse_reaction('=> |A|'))
        self.database.set_reaction('rxn_2',
            parse_reaction('(0.000001) |A| =>'))
        self.model = MetabolicModel.load_model(
            self.database, self.database.reactions)

        try:
            self.solver = generic.Solver()
        except generic.RequirementsError:
            self.skipTest('Unable to find an LP solver for tests')

        # Skip these tests with GLPK because of issue #61.
        if self.solver.properties['name'] == 'glpk':
            self.skipTest('Test has known issue with GLPK')

    def test_fastcc_is_consistent(self):
        self.assertTrue(fastcore.fastcc_is_consistent(
            self.model, 0.0001, solver=self.solver))

    def test_fastcc_is_consistent_high_epsilon(self):
        self.assertFalse(fastcore.fastcc_is_consistent(
            self.model, 0.1, solver=self.solver))

    def test_fastcore_induced_model(self):
        core = {'rxn_2'}
        self.assertEqual(
            set(fastcore.fastcore(
                self.model, core, 0.0001, scaling=1e7, solver=self.solver)),
            {'rxn_1', 'rxn_2'})

    def test_fastcore_induced_model_high_epsilon(self):
        core = {'rxn_2'}
        self.assertEqual(
            set(fastcore.fastcore(
                self.model, core, 0.1, scaling=1e7, solver=self.solver)),
            {'rxn_1', 'rxn_2'})
开发者ID:ForkBackups,项目名称:psamm,代码行数:55,代码来源:test_fastcore.py

示例9: setUp

    def setUp(self):
        self._database = DictDatabase()
        self._database.set_reaction('rxn_1', parse_reaction('A[e] => B[e]'))
        self._database.set_reaction('rxn_2', parse_reaction('B[e] => C[e]'))
        self._database.set_reaction('rxn_3', parse_reaction('B[e] => D[e]'))
        self._database.set_reaction('rxn_4', parse_reaction('C[e] => E[e]'))
        self._database.set_reaction('rxn_5', parse_reaction('D[e] => E[e]'))
        self._database.set_reaction('rxn_6', parse_reaction('E[e] =>'))
        self._database.set_reaction('ex_A', parse_reaction('A[e] <=>'))

        self._mm = MetabolicModel.load_model(
            self._database, self._database.reactions)
        self._assoc = {
            'rxn_1': boolean.Expression('gene_1'),
            'rxn_2': boolean.Expression('gene_2 or gene_3'),
            'rxn_5': boolean.Expression('gene_3 and gene_4')
        }
        self._obj_reaction = 'rxn_6'

        try:
            self._solver = generic.Solver()
        except generic.RequirementsError:
            self.skipTest('Unable to find an LP solver for tests')

        self._prob = fluxanalysis.FluxBalanceProblem(self._mm, self._solver)
开发者ID:spikeliu,项目名称:psamm,代码行数:25,代码来源:test_randomsparse.py

示例10: setUp

 def setUp(self):
     # TODO use mock model instead of actual model
     self.database = DictDatabase()
     self.database.set_reaction("rxn_1", parse_reaction("=> |A|"))
     self.database.set_reaction("rxn_2", parse_reaction("(0.000001) |A| =>"))
     self.model = MetabolicModel.load_model(self.database, self.database.reactions)
     self.solver = cplex.Solver()
开发者ID:gitter-badger,项目名称:psamm,代码行数:7,代码来源:test_fastcore.py

示例11: setUp

 def setUp(self):
     self.database = DictDatabase()
     self.database.set_reaction('rxn_1', parse_reaction('=> (2) |A|'))
     self.database.set_reaction('rxn_2', parse_reaction('|A| <=> |B|'))
     self.database.set_reaction('rxn_3', parse_reaction('|A| => |D[e]|'))
     self.database.set_reaction('rxn_4', parse_reaction('|A| => |C|'))
     self.database.set_reaction('rxn_5', parse_reaction('|C| => |D[e]|'))
     self.database.set_reaction('rxn_6', parse_reaction('|D[e]| =>'))
开发者ID:ForkBackups,项目名称:psamm,代码行数:8,代码来源:test_database.py

示例12: TestRandomSparse

class TestRandomSparse(unittest.TestCase):
    def setUp(self):
        self._database = DictDatabase()
        self._database.set_reaction('rxn_1', parse_reaction('A[e] => B[e]'))
        self._database.set_reaction('rxn_2', parse_reaction('B[e] => C[e]'))
        self._database.set_reaction('rxn_3', parse_reaction('B[e] => D[e]'))
        self._database.set_reaction('rxn_4', parse_reaction('C[e] => E[e]'))
        self._database.set_reaction('rxn_5', parse_reaction('D[e] => E[e]'))
        self._database.set_reaction('rxn_6', parse_reaction('E[e] =>'))
        self._database.set_reaction('ex_A', parse_reaction('A[e] <=>'))

        self._mm = MetabolicModel.load_model(
            self._database, self._database.reactions)
        self._assoc = {
            'rxn_1': boolean.Expression('gene_1'),
            'rxn_2': boolean.Expression('gene_2 or gene_3'),
            'rxn_5': boolean.Expression('gene_3 and gene_4')
        }
        self._obj_reaction = 'rxn_6'

        try:
            self._solver = generic.Solver()
        except generic.RequirementsError:
            self.skipTest('Unable to find an LP solver for tests')

        self._prob = fluxanalysis.FluxBalanceProblem(self._mm, self._solver)

    def test_random_sparse_reaction_strategy(self):
        expected = [
            ({'rxn_1', 'rxn_6', 'ex_A', 'rxn_2', 'rxn_4'}, {'rxn_3', 'rxn_5'}),
            ({'rxn_1', 'rxn_6', 'ex_A', 'rxn_3', 'rxn_5'}, {'rxn_2', 'rxn_4'})
        ]

        strategy = randomsparse.ReactionDeletionStrategy(self._mm)
        essential, deleted = randomsparse.random_sparse(
            strategy,
            self._prob,
            self._obj_reaction,
            flux_threshold=100)

        self.assertTrue((essential, deleted) in expected)

    def test_random_sparse_gene_strategy(self):
        expected = [
            ({'gene_1', 'gene_2'}, {'gene_3', 'gene_4'}),
            ({'gene_1', 'gene_3'}, {'gene_2', 'gene_4'})
        ]
        strategy = randomsparse.GeneDeletionStrategy(
            self._mm, self._assoc)
        essential, deleted = randomsparse.random_sparse(
            strategy,
            self._prob,
            self._obj_reaction,
            flux_threshold=100)

        self.assertTrue((essential, deleted) in expected)
开发者ID:spikeliu,项目名称:psamm,代码行数:56,代码来源:test_randomsparse.py

示例13: TestMetabolicModelFlipableView

class TestMetabolicModelFlipableView(unittest.TestCase):
    def setUp(self):
        # TODO use mock database instead of actual database
        self.database = DictDatabase()
        self.database.set_reaction('rxn_1', parse_reaction('=> (2) |A|'))
        self.database.set_reaction('rxn_2', parse_reaction('|A| <=> |B|'))
        self.database.set_reaction('rxn_3', parse_reaction('|A| => |D|'))
        self.database.set_reaction('rxn_4', parse_reaction('|A| => |C|'))
        self.database.set_reaction('rxn_5', parse_reaction('|C| => |D|'))
        self.database.set_reaction('rxn_6', parse_reaction('|D| =>'))

        model = MetabolicModel.load_model(self.database, self.database.reactions)
        self.model = FlipableModelView(model)

    def test_flipable_model_view_matrix_get_item_after_flip(self):
        self.model.flip({ 'rxn_4' })
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_1'], 2)
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_2'], -1)
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_4'], 1)
        self.assertEqual(self.model.matrix[Compound('C'), 'rxn_4'], -1)

    def test_flipable_model_view_matrix_get_item_after_double_flip(self):
        self.model.flip({ 'rxn_4', 'rxn_5' })
        self.model.flip({ 'rxn_1', 'rxn_4', 'rxn_2' })
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_1'], -2)
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_2'], 1)
        self.assertEqual(self.model.matrix[Compound('B'), 'rxn_2'], -1)
        self.assertEqual(self.model.matrix[Compound('A'), 'rxn_4'], -1)
        self.assertEqual(self.model.matrix[Compound('C'), 'rxn_4'], 1)
        self.assertEqual(self.model.matrix[Compound('C'), 'rxn_5'], 1)
        self.assertEqual(self.model.matrix[Compound('D'), 'rxn_5'], -1)

    def test_flipable_model_view_limits_get_item_after_flip(self):
        self.model.flip({ 'rxn_1', 'rxn_2' })
        self.assertEqual(self.model.limits['rxn_1'].bounds, (-1000, 0))
        self.assertEqual(self.model.limits['rxn_2'].bounds, (-1000, 1000))
        self.assertEqual(self.model.limits['rxn_3'].bounds, (0, 1000))

    def test_flipable_model_view_limits_set_item_after_flip(self):
        self.model.flip({ 'rxn_1' })
        self.model.limits['rxn_1'].bounds = -20, 500
        self.assertEqual(self.model.limits['rxn_1'].bounds, (-20, 500))

        self.model.flip({ 'rxn_1' })
        self.assertEqual(self.model.limits['rxn_1'].bounds, (-500, 20))
开发者ID:amenge,项目名称:psamm,代码行数:45,代码来源:test_metabolicmodel.py

示例14: TestMetabolicModelFlipableView

class TestMetabolicModelFlipableView(unittest.TestCase):
    def setUp(self):
        # TODO use mock database instead of actual database
        self.database = DictDatabase()
        self.database.set_reaction("rxn_1", parse_reaction("=> (2) |A|"))
        self.database.set_reaction("rxn_2", parse_reaction("|A| <=> |B|"))
        self.database.set_reaction("rxn_3", parse_reaction("|A| => |D|"))
        self.database.set_reaction("rxn_4", parse_reaction("|A| => |C|"))
        self.database.set_reaction("rxn_5", parse_reaction("|C| => |D|"))
        self.database.set_reaction("rxn_6", parse_reaction("|D| =>"))

        model = MetabolicModel.load_model(self.database, self.database.reactions)
        self.model = FlipableModelView(model)

    def test_flipable_model_view_matrix_get_item_after_flip(self):
        self.model.flip({"rxn_4"})
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_1"], 2)
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_2"], -1)
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_4"], 1)
        self.assertEqual(self.model.matrix[Compound("C"), "rxn_4"], -1)

    def test_flipable_model_view_matrix_get_item_after_double_flip(self):
        self.model.flip({"rxn_4", "rxn_5"})
        self.model.flip({"rxn_1", "rxn_4", "rxn_2"})
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_1"], -2)
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_2"], 1)
        self.assertEqual(self.model.matrix[Compound("B"), "rxn_2"], -1)
        self.assertEqual(self.model.matrix[Compound("A"), "rxn_4"], -1)
        self.assertEqual(self.model.matrix[Compound("C"), "rxn_4"], 1)
        self.assertEqual(self.model.matrix[Compound("C"), "rxn_5"], 1)
        self.assertEqual(self.model.matrix[Compound("D"), "rxn_5"], -1)

    def test_flipable_model_view_limits_get_item_after_flip(self):
        self.model.flip({"rxn_1", "rxn_2"})
        self.assertEqual(self.model.limits["rxn_1"].bounds, (-1000, 0))
        self.assertEqual(self.model.limits["rxn_2"].bounds, (-1000, 1000))
        self.assertEqual(self.model.limits["rxn_3"].bounds, (0, 1000))

    def test_flipable_model_view_limits_set_item_after_flip(self):
        self.model.flip({"rxn_1"})
        self.model.limits["rxn_1"].bounds = -20, 500
        self.assertEqual(self.model.limits["rxn_1"].bounds, (-20, 500))

        self.model.flip({"rxn_1"})
        self.assertEqual(self.model.limits["rxn_1"].bounds, (-500, 20))
开发者ID:gitter-badger,项目名称:psamm,代码行数:45,代码来源:test_metabolicmodel.py

示例15: setUp

 def setUp(self):
     self.database = DictDatabase()
     self.database.set_reaction('rxn_1', parse_reaction('=> (2) A[c]'))
     self.database.set_reaction('rxn_2', parse_reaction('A[c] <=> B[c]'))
     self.database.set_reaction('rxn_3', parse_reaction('A[c] => D[e]'))
     self.database.set_reaction('rxn_4', parse_reaction('A[c] => C[c]'))
     self.database.set_reaction('rxn_5', parse_reaction('C[c] => D[e]'))
     self.database.set_reaction('rxn_6', parse_reaction('D[e] =>'))
     self.model = MetabolicModel.load_model(
         self.database, self.database.reactions)
开发者ID:keitht547,项目名称:psamm,代码行数:10,代码来源:test_gapfilling.py


注:本文中的psamm.database.DictDatabase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。