Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions input/enzyme_S.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
,S_min,S_max
DeadMic,-135,-135
DeadEnz,-131,-131
Cellulose,-133,-133
Hemicellulose,-131,-131
Starch,-131,-131
Chitin,-135,-135
Lignin,-140,-140
Protein1,-131,-131
Protein2,-131,-131
Protein3,-131,-131
OrgP1,-133,-133
OrgP2,-129,-129
50 changes: 49 additions & 1 deletion input/parameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,52 @@ Vmax_Km_int,0
Uptake_Vmax_Km,0.2
Uptake_Vmax_Km_int,0
Km_error,0
Specif_factor,1
Specif_factor,1
AE_max,0.7
AE_min,0.4
Avg_extra_req_enz,0
Cell_maint_C_cost,0.000001
Enz_Cp_max,-3000
Enz_Cp_min,-3001
Enz_H_S_error,0
Enz_H_S_int,0
Enz_H_S_slope,0
Enz_HT0_max,23501
Enz_HT0_min,23500
Enz_Km_temp_sens,0
Enz_max,0
Enz_min,0
Enzymes_per_sub,1
Init_NH4,0
Init_PO4,0
Input_NH4,0
Input_PO4,0
Km_Tref,15
Min_Resp_Temp_Adj,1
mmrt_Km_error,0
mmrt_Vmax_Km_int,0
mmrt_Vmax_Km_slope,1.5
Monomer_Substrate_Ratio,0.0001
NormalizeProd,1
NormalizeUptake,1
Osmolyte_maint_C_cost,0.05
TR_Cp_H_intercept,22375
TR_Cp_H_slope,-0.563
TR_Cp_S_intercept,-169.27
TR_Cp_S_slope,-0.00213
TR_mag_Cp_intercept,-3000
TR_mag_Cp_slope,0
Tref,293
Uptake_Cp_max,-3000
Uptake_Cp_min,-3001
Uptake_H_S_error,0
Uptake_H_S_int,0
Uptake_H_S_slope,0
Uptake_HT0_max,23501
Uptake_HT0_min,23500
Uptake_Km_temp_sens,0
Uptake_mmrt_Vmax_Km_int,0
Uptake_mmrt_Vmax_Km_slope,0.15
Uptake_per_monomer,1
Uptake_ST0_max,-131.9
Uptake_ST0_min,-132
169 changes: 168 additions & 1 deletion src/enzyme.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ def __init__(self,runtime,parameters,substrate_index):
self.Uptake_Vmax_Km_int = parameters.loc['Uptake_Vmax_Km_int',1] # intercept for Uptake Km-Vmax relationship:0
self.Uptake_Km_min = parameters.loc['Uptake_Km_min',1] # Minimum uptake Km: 0.001
self.Km_error = parameters.loc['Km_error',1] # Error term: default = 0
self.Cp_min = parameters.loc['Enz_Cp_min', 1] # Minimum Vmax for enzyme
self.Cp_max = parameters.loc['Enz_Cp_max', 1] # Maximum Vmax for enzyme
self.Uptake_Cp_min = parameters.loc['Uptake_Cp_min', 1] # Minimum Vmax for enzyme
self.Uptake_Cp_max = parameters.loc['Uptake_Cp_max', 1] # Maximum Vmax for enzyme
self.Uptake_HT0_min = parameters.loc['Uptake_HT0_min', 1] # Minimum Vmax for enzyme
self.Uptake_HT0_max = parameters.loc['Uptake_HT0_max', 1] # Maximum Vmax for enzyme
self.Uptake_ST0_min = parameters.loc['Uptake_ST0_min', 1] # Minimum Vmax for enzyme
self.Uptake_ST0_max = parameters.loc['Uptake_ST0_max', 1] # Maximum Vmax for enzyme
self.HT0_min = parameters.loc['Enz_HT0_min', 1] # Minimum Vmax for enzyme
self.HT0_max = parameters.loc['Enz_HT0_max', 1] # Maximum Vmax for enzyme

self.substrate_index = substrate_index # index of substrates in their actual names

Expand Down Expand Up @@ -98,8 +108,88 @@ def enzyme_attributes(self):
EnzAttrib_df = pd.DataFrame(data=EnzAttrib_array, index=index, columns=columns, dtype='float32')

return EnzAttrib_df


def enzyme_HT0(self):
"""
Heat Capacity for enzymes.

Parameters:
HT0_min: -2714
HT0_max: -2714
Returns:
HT0: dataframe(enzyme*substrate); will feed the expand()
"""

HT0_array = LHS(self.n_substrates * self.n_enzymes, self.HT0_min, self.HT0_max, 'uniform')
HT0_array = HT0_array.reshape(self.n_substrates, self.n_enzymes)
columns = ['Enz' + str(i) for i in range(1, self.n_enzymes + 1)]
HT0 = pd.DataFrame(data=HT0_array, index=self.substrate_index, columns=columns, dtype='float32')
HT0 = HT0.astype('float32')

return HT0

def enzyme_ST0(self, ST0_input):
"""
Enthalpy.

Parameter:
ST0_input: dataframe; substrate-specific entropy range (min = max for now)
Return:
ST0_df.T: dataframe; Rows:enzymes; cols: substrates
"""

ST0_series = ST0_input.apply(lambda df: np.random.uniform(df['S_min'], df['S_max'], self.n_enzymes),
axis=1) # series of 1D array
columns = ['Enz' + str(i) for i in range(1, self.n_enzymes + 1)]
ST0 = pd.DataFrame(data=ST0_series.tolist(), index=self.substrate_index, columns=columns,
dtype='float32') # NOTE: .tolist()

return ST0


def enzyme_uptake_HT0(self):
"""
Uptake activation enthalpy parameter across monomers.

Parameters:
Uptake_HT0_min: scalar; 66706
Uptake_HT0_max: scalar; 66706
Return:
Uptake_HT0: dataframe; Rows are monomers; cols are uptake enzymes
"""

Uptake_HT0_array = np.random.uniform(self.Uptake_HT0_min, self.Uptake_HT0_max, self.n_uptake * self.n_monomers)
Uptake_HT0_array = Uptake_HT0_array.reshape(self.n_monomers, self.n_uptake)

index = ['Mon' + str(i) for i in range(1, self.n_monomers + 1)]
columns = ['Upt' + str(i) for i in range(1, self.n_uptake + 1)]
Uptake_HT0 = pd.DataFrame(data=Uptake_HT0_array, index=index, columns=columns, dtype='float32')


return Uptake_HT0

def enzyme_uptake_ST0(self):
"""
Uptake activation entropy parameter across monomers.

Parameters:
Uptake_ST0_min: scalar; 66706
Uptake_ST0_max: scalar; 66706
Return:
Uptake_ST0: dataframe; Rows are monomers; cols are uptake enzymes
"""

Uptake_ST0_array = np.random.uniform(self.Uptake_ST0_min, self.Uptake_ST0_max, self.n_uptake * self.n_monomers)
Uptake_ST0_array = Uptake_ST0_array.reshape(self.n_monomers, self.n_uptake)

index = ['Mon' + str(i) for i in range(1, self.n_monomers + 1)]
columns = ['Upt' + str(i) for i in range(1, self.n_uptake + 1)]
Uptake_ST0 = pd.DataFrame(data=Uptake_ST0_array, index=index, columns=columns, dtype='float32')


return Uptake_ST0

def enzyme_Ea(self,Ea_input):
"""
Enzyme specificity matrix of activation energies.
Expand All @@ -115,6 +205,83 @@ def enzyme_Ea(self,Ea_input):
Ea_df = pd.DataFrame(data=Ea_series.tolist(), index=self.substrate_index, columns=columns, dtype='float32') # NOTE: .tolist()

return Ea_df.T

def enzyme_Cp(self):
"""
Heat Capacity for enzymes.

Parameters:
Cp_min: -2714
Cp_max: -2714
Returns:
Cp: dataframe(enzyme*substrate); will feed the expand()
"""

Cp_array = LHS(self.n_substrates * self.n_enzymes, self.Cp_min, self.Cp_max, 'uniform')
Cp_array = Cp_array.reshape(self.n_substrates, self.n_enzymes)
columns = ['Enz' + str(i) for i in range(1, self.n_enzymes + 1)]
Cp = pd.DataFrame(data=Cp_array, index=self.substrate_index, columns=columns, dtype='float32')
Cp = Cp.astype('float32')

return Cp

def enzyme_uptake_Cp(self):
"""
Heat Capacity for uptake.

Parameters:
Uptake_Cp_min: 1 (mg substrate mg-1 substrate day-1) Minimum uptake Vmax
Uptake_Cp_max: 10 (mg substrate mg-1 substrate day-1) Maximum uptake Vmax
Return:
Uptake_Cp: dataframe; Rows are monomers; cols are uptake enzymes
"""

# Uptake_Cp_array = np.random.uniform(self.Uptake_Cp_min,self.Uptake_Cp_max,self.n_uptake*self.n_monomers)
Uptake_Cp_array = LHS(self.n_uptake * self.n_monomers, self.Uptake_Cp_min, self.Uptake_Cp_max,
'uniform')
Uptake_Cp_array = Uptake_Cp_array.reshape(self.n_monomers, self.n_uptake)

index = ['Mon' + str(i) for i in range(1, self.n_monomers + 1)]
columns = ['Upt' + str(i) for i in range(1, self.n_uptake + 1)]
Uptake_Cp = pd.DataFrame(data=Uptake_Cp_array, index=index, columns=columns, dtype='float32')

Uptake_Cp = Uptake_Cp.astype('float32')

return Uptake_Cp

def uptake_sub_spec(self, Uptake_ReqEnz):
"""
Pre-exponential constants for uptake.

Parameters:
Uptake_ReqEnz: uptake required enzymes; monomers * enzymes; from the monomer module
Uptake_Vmax0_min: 1 (mg substrate mg-1 substrate day-1) Minimum uptake Vmax
Uptake_Vmax0_max: 10 (mg substrate mg-1 substrate day-1) Maximum uptake Vmax
Specif_factor: default 1; Efficiency-specificity
Return:
Uptake_Vmax0: dataframe; Rows are monomers; cols are uptake enzymes
"""

#Uptake_sub_spec_array = LHS(self.n_uptake * self.n_monomers, 1, 1,'uniform')
#Uptake_sub_spec_array = Uptake_sub_spec_array.reshape(self.n_monomers, self.n_uptake)

index = ['Mon' + str(i) for i in range(1, self.n_monomers + 1)]
columns = ['Upt' + str(i) for i in range(1, self.n_uptake + 1)]
#Uptake_sub_spec = pd.DataFrame(data=Uptake_sub_spec_array, index=index, columns=columns, dtype='float32')
Uptake_sub_spec = pd.DataFrame(columns=columns, index=index, dtype='float32', data=1)

# implement the tradeoff with specificity
total_monomers = Uptake_ReqEnz.sum(axis=0)
if self.Specif_factor == 0:
total_monomers[total_monomers > 1] = 1
else:
total_monomers[total_monomers > 1] = total_monomers[total_monomers > 1] * self.Specif_factor
Uptake_sub_spec = Uptake_sub_spec.divide(total_monomers, axis=1)
Uptake_sub_spec.loc[:, total_monomers == 0] = 0

Uptake_sub_spec = Uptake_sub_spec.astype('float32')

return Uptake_sub_spec


def enzyme_uptake_Ea(self):
Expand Down Expand Up @@ -301,4 +468,4 @@ def Allison(rate, wp_fc, psi):
else:
f_psi = np.exp(np.float32(rate) * (psi - wp_fc))

return f_psi
return f_psi
Loading