diff --git a/grassland/enzyme_S.csv b/grassland/enzyme_S.csv new file mode 100644 index 0000000..305afca --- /dev/null +++ b/grassland/enzyme_S.csv @@ -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 \ No newline at end of file diff --git a/grassland/parameters.csv b/grassland/parameters.csv index 7ee62d8..73efe4b 100644 --- a/grassland/parameters.csv +++ b/grassland/parameters.csv @@ -54,5 +54,53 @@ Uptake_Vmax_Km,0.2 Uptake_Vmax_Km_int,0 Km_error,0 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 R_moist_decay,0.05 R_moist_uptake,0.1 diff --git a/grassland/scrubland/enzyme_S.csv b/grassland/scrubland/enzyme_S.csv new file mode 100644 index 0000000..305afca --- /dev/null +++ b/grassland/scrubland/enzyme_S.csv @@ -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 \ No newline at end of file diff --git a/grassland/scrubland/parameters.csv b/grassland/scrubland/parameters.csv index 7ee62d8..73efe4b 100644 --- a/grassland/scrubland/parameters.csv +++ b/grassland/scrubland/parameters.csv @@ -54,5 +54,53 @@ Uptake_Vmax_Km,0.2 Uptake_Vmax_Km_int,0 Km_error,0 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 R_moist_decay,0.05 R_moist_uptake,0.1 diff --git a/input/enzyme_S.csv b/input/enzyme_S.csv new file mode 100644 index 0000000..305afca --- /dev/null +++ b/input/enzyme_S.csv @@ -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 \ No newline at end of file diff --git a/input/parameters.csv b/input/parameters.csv index 7a0bd96..2fe4fa0 100644 --- a/input/parameters.csv +++ b/input/parameters.csv @@ -54,5 +54,53 @@ Uptake_Vmax_Km,0.2 Uptake_Vmax_Km_int,0 Km_error,0 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 R_moist_decay,0.05 R_moist_uptake,0.1 diff --git a/src/enzyme.py b/src/enzyme.py index 06e68ce..a8f5806 100644 --- a/src/enzyme.py +++ b/src/enzyme.py @@ -89,6 +89,28 @@ def __init__(self, runtime, parameters, substrate_index): "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 @@ -138,6 +160,101 @@ def enzyme_attributes(self): 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. @@ -162,6 +279,97 @@ def enzyme_Ea(self, Ea_input): 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): """ Uptake activation energies constant across monomers.