Skip to content

Commit

Permalink
Fix gam/ngam bug
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonlloyd committed Nov 22, 2017
1 parent ca1e4ec commit 8224a47
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
12 changes: 8 additions & 4 deletions BOFdat/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ def calculate_gam(model,data,show_GAM):
biomass.lower_bound = 0.
biomass.objective_coefficient = 0.

# remove GAM from biomass function
for key, value in biomass.metabolites.items():
if abs(value) > 50:
biomass.add_metabolites({key: -value})
#Set carbon sources to 0
'''
Will need to prepare the model to run the simulations
'''
#model.reactions.EX_glc_LPAREN_e_RPAREN_.lower_bound = 0
#Optimize for ATP maintenance
model.reactions.ATPM.lower_bound = 0
model.reactions.ATPM.objective_coefficient = 1.

#model.reactions.EX_o2_LPAREN_e_RPAREN_.lower_bound = -1000
Expand Down Expand Up @@ -182,14 +187,12 @@ def calculate_gam(model,data,show_GAM):
return raw_GAM

def show_gam(raw_GAM):

import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

x = raw_GAM['Growth_rate']
y = raw_GAM['ATP']

#Fit with np.polyfit
m, b = np.polyfit(x, y, 1)

Expand All @@ -202,9 +205,10 @@ def show_gam(raw_GAM):
print('R2=', correlation ** 2)
plt.scatter(raw_GAM['Growth_rate'], raw_GAM['ATP'])
# plt.scatter(filtered_data['GR'],filtered_data['ATP'], color=filtered_data['color'], marker=filtered_data['marker'].tolist())
plt.show()

plt.xlim([0, 1.1])
plt.ylim([0, 90])
plt.ylim([0, 110])
plt.show()
#plt.savefig('all_data.png')
#plt.savefig('all_data.svg')
plt.close()
Expand Down
19 changes: 14 additions & 5 deletions Example_usage/maintenance.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ experiment_3,EX_glc__D_e,0.98,0.02,13.51,1.15,0,0,8.43,2.17,0,0,0,0,0,0,0,0
experiment_4,EX_glc__D_e,0.96,0.01,12.19,0.68,0,0,7.89,1.88,0,0,0,0,0,0,0,0
experiment_5,EX_glc__D_e,0.93,0.01,12.77,0.85,0,0,7.11,1.51,0,0,0,0,0,0,0,0
experiment_6,EX_glc__D_e,1.01,0.04,13.13,1.29,0,0,5.12,0.57,0,0,0,0,0,0,0,0
experiment_7,EX_glc__D_e,0.97,0.01,11.01,0.79,0,0,3.97,0.98,0,0,0,0,0,0,0,0
experiment_8,EX_glc__D_e,0.92,0.02,10.43,0.62,0,0,2.36,0.54,0,0,0,0,0,0,0,0
experiment_9,EX_glc__D_e,0.89,0.01,12.59,1.01,0,0,5.05,0.4,0,0,0,0,0,0,0,0
experiment_10,EX_glc__D_e,0.92,0.02,13.13,0.59,0,0,6.99,0.48,0,0,0,0,0,0,0,0
experiment_11,EX_glc__D_e,0.95,0.01,13.98,1.11,0,0,9.27,1.76,0,0,0,0,0,0,0,0
experiment_8,EX_glc__D_e,0.89,0.01,12.59,1.01,0,0,5.05,0.4,0,0,0,0,0,0,0,0
experiment_9,EX_glc__D_e,0.92,0.02,13.13,0.59,0,0,6.99,0.48,0,0,0,0,0,0,0,0
experiment_10,EX_glc__D_e,0.95,0.01,13.98,1.11,0,0,9.27,1.76,0,0,0,0,0,0,0,0
acetate_1,EX_ac_e,0.223,0.011,12.14,0.629,0,0,0,0,0,0,0,0,0,0,0,0
acetate_2,EX_ac_e,0.418,0.013,20.346,0.564,0,0,0,0,0,0,0,0,0,0,0,0
acetate_3,EX_ac_e,0.43,0.01,23.016,0.02,0,0,0,0,0,0,0,0,0,0,0,0
Expand All @@ -19,3 +17,14 @@ xylose_2,EX_xyl__D_e,0.734,0.013,12.722,0.199,0,0,5.013,0.288,0,0,0,0,0,0,0,0
xylose_3,EX_xyl__D_e,0.728,0.006,11.413,0.026,0,0,1.813,0.155,0,0,0,0,0,0,0,0
xylose_4,EX_xyl__D_e,0.724,0.003,12.202,0.258,0,0,5.739,0.203,0,0,0,0,0,0,0,0
xylose_5,EX_xyl__D_e,0.76,0.011,13.179,0.154,0,0,3.209,0.112,0,0,0,0,0,0,0,0
monk_1,EX_glc__D_e,0.73,0.01,9.67,0.27,0,0,3.49,0.5,0,0,0,0,0,0,0,0
monk_2,EX_glc__D_e,0.46,0.02,16.69,0.24,0,0,11.71,1.14,0,0,22.17,1.69,11.22,0.6,1.86,0.04
WT_Feist,EX_glyc_e,0.442,0.002,11.178,0.039,0,0,0,0,0,0,0,0,0,0,0,0
WT_McCloskey_aer_1,EX_glc__D_e,0.59,0.01,7.81,0.27,0,0,3.26,0.23,0,0,0,0.33,0.12,0,0,0
WT_McCloskey_aer_2,EX_glc__D_e,0.61,0.02,7.54,0.56,0,0,2.72,0.24,0,0,0,0.82,0.25,0,0,0
WT_McCloskey_anaer_1,EX_glc__D_e,0.38,0,15.07,2.78,1.56,0.36,9.61,0.5,0.1,0.16,19.03,0.59,12.1,0.93,1.46,0.14
WT_McCloskey_anaer_2_fix,EX_glc__D_e,0.38,0,16.2,2.11,1.39,0.11,12.04,0.18,0.33,0.07,22.41,0.28,11.4,1.86,2.01,0.11
Glyc_1,EX_glyc_e,0.733,0.003,18.398,0.378,0,0,5.141,0.139,0,0,0,0,0,0,0,0
Glyc_2,EX_glyc_e,0.73,0.018,18.579,0.738,0,0,5.256,0.118,0,0,0,0,0,0,0,0
Glyc_3,EX_glyc_e,0.767,0.003,17.984,0.08,0,0,3.098,0.018,0,0,0,0,0,0,0,0
Glyc_4,EX_glyc_e,0.749,0.005,18.484,1.028,0,0,3.248,0.12,0,0,0,0,0,0,0,0

0 comments on commit 8224a47

Please sign in to comment.