Example #1
0
def test_gecko_adjustment_sanchez_etal():
    mmol_gdw = pd.read_csv(
        os.path.join(os.path.dirname(__file__),
                     '../../src/mewpy/model/data/sanchez-mmol_gdw.csv'))
    PROTEIN_PROPERTIES = ModelList().protein_properties()
    ggdw = pd.Series(PROTEIN_PROPERTIES.loc[mmol_gdw.index, 'mw'] /
                     1000.) * pd.Series(mmol_gdw)
    model = GeckoModel('multi-pool')
    simulation = GeckoSimulation(model)
    result = simulation.simulate()
    growth_rate_unlimited_protein = result.objective_value
    model.limit_proteins(ggdw=pd.Series(ggdw))
    result = simulation.simulate()
    growth_rate_limited_protein = result.objective_value
    # should be smaller, but how much..
    assert growth_rate_limited_protein < 0.8 * growth_rate_unlimited_protein
    measured_in_model = set(mmol_gdw.index).intersection(model.proteins)
    assert sum(model.concentrations[p] - ggdw[p]
               for p in measured_in_model) < 1e-10
Example #2
0
def test_basic_gecko_adjustment():
    """Tests basic adjustments
    """
    in_model = {
        'P00549': 0.1,
        'P31373': 0.1,
        'P31382': 0.1,
        'P39708': 0.1,
        'P39714': 0.1,
        'P39726': 0.1,
        'Q01574': 0.1
    }
    not_in_model = {'P10591': 0.1, 'P31383': 0.1, 'P32471': 0.1}
    measurements = pd.concat([pd.Series(in_model), pd.Series(not_in_model)])
    model = GeckoModel('multi-pool')
    model.limit_proteins(fractions=pd.Series(measurements))
    simul = GeckoSimulation(model)
    sol = simul.simulate()
    assert sol.objective_value > 0.05
    assert len(model.proteins) - len(model.pool_proteins) - len(in_model) == 0
    assert all(model.reactions[rxn].ub > 0
               for rxn in model.individual_protein_exchanges)