Esempio n. 1
0
def remove_blocked_reactions(model):
    epsilon = model.solver.configuration.tolerances.feasibility
    # fva = flux_variability_analysis(model)
    fva = variability_analysis(model, kind='reactions')
    # Blocked reactions have max and min at 0
    df = fva[ (fva.max(axis=1).abs()<1*epsilon)
            & (fva.min(axis=1).abs()<1*epsilon)]
    rid_to_rm = df.index

    model.remove_reactions(rid_to_rm)

    return df
Esempio n. 2
0
## re-prepare the TFA model
m.prepare()
m.convert()  #add_displacement = True)
## Info on the cobra_model
m.print_info()

tfa_solution_sc = m.optimize()
tfa_value_sc = tfa_solution_sc.objective_value
# Report
print('TFA Solution found for NAD-only metabolic model: {0:.5g}'.format(
    tfa_value_sc))

# perform variability analysis on reactions
mytfa.reactions.get_by_id(biomass_rxn).lower_bound = tfa_value - 1e-6
varib_results = variability_analysis(mytfa, kind='reactions')
varib_results.to_csv(out_dir + '/FVA.wt.results.optimal.csv')
print("finished variability analysis on optimal solution for WT model")

# perform variability analysis on reactions
mytfa.reactions.get_by_id(biomass_rxn).lower_bound = 0.1
varib_results = variability_analysis(mytfa, kind='reactions')
varib_results.to_csv(out_dir + '/FVA.wt.results.gtzp1.csv')
print("finished variability analysis with growth rate = 0.1 for WT model")

# perform variability analysis on reactions
mytfa.reactions.get_by_id(biomass_rxn).lower_bound = 0.5
varib_results = variability_analysis(mytfa, kind='reactions')
print("finished variability analysis with growth rate = 0.5 for WT model")
varib_results.to_csv(out_dir + '/FVA.wt.results.gtzp5.csv')
Esempio n. 3
0
    solution = final_model.optimize()
    print('Objective            : {}'.format(
        final_model.solution.objective_value))
    print(' - Glucose uptake    : {}'.format(
        final_model.reactions.EX_glc__D_e.flux))

    filepath = 'models/{}'.format(final_model.name)
    save_json_model(final_model, filepath)

    final_model.logger.info('Build complete for model {}'.format(
        final_model.name))

    return final_model


if __name__ == '__main__':

    tfa_model = create_tfa_model()

    print('Completed')

    from pytfa.analysis.variability import variability_analysis
    tva = variability_analysis(tfa_model)
    tva.to_csv('outputs/tva_iJO1366.csv')

    # Make thermo model
    # make_thermo_model()

    # Save FBA model
    # make_fba_model()