from groups import GroupContribution from pygibbs.thermodynamic_constants import R from pylab import log, zeros, pinv, dot, plot, show, figure, NaN, isnan, find import csv from pygibbs.kegg_utils import unparse_reaction_formula from pygibbs.kegg_reaction import Reaction G = GroupContribution(sqlite_name="gibbs.sqlite", html_name="acetogens") G.init() reactions = [] # (RID, EC, sparse-reaction, dG0_r, pH, I, T # Drake 2006 #reactions.append([134, '1.2.1.43', {11:-1, 5:-1, 58:1, 6:1}, 22, 7.0, 0, 300]) reactions.append([ 934, '6.3.4.3', { 101: -1, 58: -1, 2: -1, 8: 1, 9: 1, 234: 1 }, -8, 7.0, 0, 300 ]) reactions.append([1655, '3.5.4.9', {234: -1, 445: 1, 1: 1}, -4, 7.0, 0, 300]) reactions.append( [1220, '1.5.1.5', { 445: -1, 5: -1, 143: 1, 6: 1
from nist import Nist import pylab from alberty import Alberty, MissingCompoundFormationEnergy from hatzimanikatis import Hatzi from groups import GroupContribution from thermodynamic_constants import R import logging import sys from toolbox.database import SqliteDatabase from pygibbs.kegg_reaction import Reaction A = Alberty() H = Hatzi() db = SqliteDatabase('../res/gibbs.sqlite') gc = GroupContribution(db) gc.init() nist = Nist() def pH_dependence(): analyze_this_reaction = [] I_mid = [] I_tolerance = [] T_mid = [] T_tolerance = [] analyze_this_reaction += [Reaction(['glucose kinase'], {2:-1, 31:-1, 8:1, 92:1})] I_mid += [0.01] I_tolerance += [0.02] T_mid += [303.1] T_tolerance += [0.1]
for n in range(n_begin, N): (sparse_reaction, pH, I, T, evaluation, dG0_obs) = grad.data[n] n_measurements = min( [nist.cid2count[cid] for cid in sparse_reaction.keys()]) reaction_str = gc.kegg().sparse_reaction_to_string(sparse_reaction, cids=True) dG0_est = grad.reaction_to_dG0(sparse_reaction, pH, I, T) csv_results.writerow([ n, dG0_obs, dG0_est, reaction_str, pH, I, T, evaluation, n_measurements ]) res_file.flush() ################################################################################ if (len(sys.argv) > 1): n_begin = int(sys.argv[1]) else: n_begin = 0 gc = GroupContribution(sqlite_name="gibbs.sqlite", html_name="dG0_test") gc.init() nist = Nist(gc.kegg()) alberty = Alberty() sensitivity_analysis_for_gradient_ascent(gc, nist, alberty.cid2pmap_dict, max_i=250, n_begin=n_begin) #evaluate(gc, nist, alberty.cid2pmap_dict)