reactions = reactions[1:] tabinput = tabinput[1:] S = np.zeros((len(tabinput), len(tabinput[0]) - 1)) cids = list() for i in range(len(tabinput)): cids.append(float(tabinput[i][0].replace('"', ''))) for j in range(len(tabinput[0]) - 1): S[i, j] = tabinput[i][j + 1] model = KeggModel(S, cids) model = model.check_S_balance() td = TrainingData() cc = ComponentContribution(td) model_dG0, model_cov_dG0 = cc.estimate_kegg_model(model) model_dG0_prime = model_dG0 + model.get_transform_ddG0(pH=7.5, I=0.2, T=298.15) dG0_std = np.sqrt(model_cov_dG0.diagonal()) out_file = '../examples/vz/output/cc_dG.tsv' outf = open(out_file, "w") outf.write("reaction\tdGr\tdGrSD\n") for i in range(len(reactions)): outf.write(reactions[i] + "\t" + str(float(model_dG0_prime[i])) + "\t" + str(float(dG0_std[0, i])) + "\n") outf.close() #out_file = '../examples/vz/output/cc_dG_cov.tsv' #outf = open(out_file, "w") #outf.write("reaction\tdGr\tdGrSD\n")
reactions = reactions[1:] tabinput = tabinput[1:] S = np.zeros((len(tabinput), len(tabinput[0])-1)) cids = list() for i in range(len(tabinput)): cids.append(float(tabinput[i][0].replace('"',''))) for j in range(len(tabinput[0])-1): S[i,j] = tabinput[i][j+1] model = KeggModel(S, cids) model = model.check_S_balance() td = TrainingData() cc = ComponentContribution(td) model_dG0, model_cov_dG0 = cc.estimate_kegg_model(model) model_dG0_prime = model_dG0 + model.get_transform_ddG0(pH=7.5, I=0.2, T=298.15) dG0_std = np.sqrt(model_cov_dG0.diagonal()) out_file = '../examples/vz/output/cc_dG.tsv' outf = open(out_file, "w") outf.write("reaction\tdGr\tdGrSD\n") for i in range(len(reactions)): outf.write(reactions[i] + "\t" + str(float(model_dG0_prime[i])) + "\t" +str(float(dG0_std[0,i]))+ "\n") outf.close() #out_file = '../examples/vz/output/cc_dG_cov.tsv' #outf = open(out_file, "w") #outf.write("reaction\tdGr\tdGrSD\n") #for i in range(len(reactions)):