Skip to content

Commit

Permalink
mcPAM ready for parametrizer
Browse files Browse the repository at this point in the history
  • Loading branch information
titaniasugiarto committed Dec 16, 2024
1 parent bc4dc0c commit 756b356
Show file tree
Hide file tree
Showing 12 changed files with 588 additions and 36 deletions.
146 changes: 146 additions & 0 deletions Data/enzyme_sets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"optimized_kcats_core": {
"P25516": {
"CE_ACONTa_P25516": {
"f": 5.2,
"b": 5.2
},
"CE_ACONTb_P25516": {
"f": 5.2,
"b": 5.2
}
},
"P0AC98": {
"CE_ACt2rpp_P0AC98": {
"f": 15,
"b": 15
}
},
"P0A9P0_P0AFG3_P0AFG6": {
"CE_AKGDH_P0A9P0_P0AFG3_P0AFG6": {
"f": 35,
"b": 35
}
},
"P0AEX3": {
"CE_AKGt2rpp_P0AEX3": {
"f": 100,
"b": 100
}
},
"P0A6E6_P0AB98_P0ABA0_P0ABA4_P0ABA6_P0ABB0_P0ABB4_P0ABC0_P68699": {
"CE_ATPS4rpp_P0A6E6_P0AB98_P0ABA0_P0ABA4_P0ABA6_P0ABB0_P0ABB4_P0ABC0_P68699": {
"f": 800,
"b": 800
}
},
"P0A6E6_P0AB98_P0ABA0_P0ABA4_P0ABA6_P0ABB0_P0ABB4_P68699": {
"CE_ATPS4rpp_P0A6E6_P0AB98_P0ABA0_P0ABA4_P0ABA6_P0ABB0_P0ABB4_P68699": {
"f": 800,
"b": 800
}
},
"P26458_P26459": {
"CE_CYTBD2pp_P26458_P26459": {
"f": 300,
"b": 300
},
"CE_CYTBDpp_P26458_P26459": {
"f": 300,
"b": 300
}
},
"P0ABJ9_P0ABK2_P56100": {
"CE_CYTBDpp_P0ABJ9_P0ABK2_P56100": {
"f": 300,
"b": 300
}
},
"P0AC53": {
"CE_G6PDH2r_P0AC53": {
"f": 1446,
"b": 1446
}
},
"P08839_P0AA04_P69797_P69801_P69805": {
"CE_GLCptspp_P08839_P0AA04_P69797_P69801_P69805": {
"f": 2765,
"b": 0
}
},
"P08839_P0AA04_P69783_P69786": {
"CE_GLCptspp_P08839_P0AA04_P69783_P69786": {
"f": 2765,
"b": 0
},
"GLCptspp": {
"f": 2765,
"b": 0
}
},
"P00350": {
"CE_GND_P00350": {
"f": 1446,
"b": 1446
}
},
"P0AFC3_P0AFC7_P0AFD1_P0AFD4_P0AFD6_P0AFE0_P0AFE4_P0AFE8_P0AFF0_P31979_P33599_P33602_P33607": {
"CE_NADH16pp_P0AFC3_P0AFC7_P0AFD1_P0AFD4_P0AFD6_P0AFE0_P0AFE4_P0AFE8_P0AFF0_P31979_P3359\n9_P33602_P33607": {
"f": 166.67,
"b": 0
}
},
"P06959_P0A9P0_P0AFG8": {
"CE_PDH_P06959_P0A9P0_P0AFG8": {
"f": 37.9,
"b": 37.9
}
},
"P0A799": {
"CE_PGK_P0A799": {
"f": 10,
"b": 10
}
},
"P0A830": {
"CE_SUCCt2_2pp_P0A830": {
"f": 30,
"b": 30
},
"SUCCt2_2pp": {
"f": 30,
"b": 30
}
},
"P0AC98": {
"CE_SUCCt2_2pp_P0AC98": {
"f": 30,
"b": 30
}
},
"P07014_P0AC41_P0AC44_P69054": {
"CE_SUCDi_P07014_P0AC41_P0AC44_P69054": {
"f": 182,
"b": 0
}
},
"P07001_P0AB67": {
"CE_THD2pp_P07001_P0AB67": {
"f": 1000,
"b": 0
}
},
"P27302": {
"CE_TKT1_P27302": {
"f": 410000,
"b": 410000
}
},
"P33570": {
"CE_TKT1_P33570": {
"f": 410000,
"b": 410000
}
}
}
}
Binary file modified Data/mcPAM_iML1515_EnzymaticData.xlsx
Binary file not shown.
16 changes: 9 additions & 7 deletions Examples/mcpam_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@

if __name__ == "__main__":

mcpam = set_up_ecolicore_mcpam(sensitivity=False)
pam = set_up_ecolicore_pam(sensitivity=False)
pam.optimize()
mcpam.optimize()
print("PAM objective value: ", pam.objective.value)
print("mcPAM objective value: ", mcpam.objective.value)
pam = set_up_ecoli_pam(sensitivity=False)
mcpam = set_up_ecoli_mcpam(sensitivity=False)

# pam, mcpam = run_pam_mcpam_core_with_optimized_kcats(sensitivity=True, type='full scale', enzyme_sets_name="enzyme_sets.json")
models = [pam, mcpam]
run_simulations_pam_mcpam(models, type="core")
run_simulations_pam_mcpam(models, type="full scale")

for protein, kcats in mcpam.sectors.get_by_id("MembraneSector").membrane_proteins.items():
print(protein, kcats)





Expand Down
Binary file added Results/Flux_simulation_PAM_mcPAM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
File renamed without changes.
6 changes: 3 additions & 3 deletions Scripts/mcpam_generation_uniprot_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def set_up_ecolicore_pam(total_protein:bool = True,
#load example data for the E.coli iML1515 model
if active_enzymes:
# load active enzyme sector information
enzyme_db = pd.read_excel(PAM_DATA_FILE_PATH, sheet_name='mcPAM_data_parametrized')
enzyme_db = pd.read_excel(PAM_DATA_FILE_PATH, sheet_name='mcPAM_data_core')

for idx in enzyme_db.rxnID:
# transport reactions
Expand Down Expand Up @@ -127,7 +127,7 @@ def set_up_ecolicore_mcpam(total_protein: Union[bool, float] = True,
# load example data for the E.coli iML1515 model
if active_enzymes:
# load active enzyme sector information
enzyme_db = pd.read_excel(pam_info_file, sheet_name='mcPAM_data_parametrized')
enzyme_db = pd.read_excel(pam_info_file, sheet_name='mcPAM_data_core')

for idx in enzyme_db.rxnID:
# transport reactions
Expand Down Expand Up @@ -183,7 +183,7 @@ def set_up_ecolicore_mcpam(total_protein: Union[bool, float] = True,

if membrane_sector:
membrane_info = pd.read_excel(pam_info_file, sheet_name='Membrane')
active_enzyme_info = pd.read_excel(pam_info_file, sheet_name='mcPAM_data_parametrized')
active_enzyme_info = pd.read_excel(pam_info_file, sheet_name='mcPAM_data_core')

area_avail_0 = membrane_info[membrane_info.Parameter == 'area_avail_0'].loc[1,'Value']
area_avail_mu = membrane_info[membrane_info.Parameter == 'area_avail_mu'].loc[2,'Value']
Expand Down
33 changes: 22 additions & 11 deletions Scripts/mcpam_simulations_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from src.PAModelpy.MembraneSector import MembraneSector
from src.PAModelpy.configuration import Config
from Scripts.mcpam_generation_uniprot_id import (parse_reaction2protein,
set_up_ecolicore_pam, set_up_ecolicore_mcpam)
set_up_ecolicore_pam, set_up_ecolicore_mcpam,
set_up_ecoli_pam, set_up_ecoli_mcpam)

def compare_mu_for_different_sensitivities_ecolicore_pam():
rxn2protein_new = {}
Expand Down Expand Up @@ -154,6 +155,12 @@ def build_ecolicore_pam_and_mcpam(sensitivity:bool=True, max_area: float = 0.1):

return pam_core, mcpam_core

def build_ecoli_pam_and_mcpam(sensitivity:bool=True, max_area: float = 0.1):
pam_core = set_up_ecoli_pam(sensitivity=sensitivity)
mcpam_core = set_up_ecoli_mcpam(sensitivity=sensitivity)

return pam_core, mcpam_core

def set_objective_pam_mcpam(models:list, objective:str):
for model in models:
model.objective = objective
Expand All @@ -164,30 +171,34 @@ def optimize_pam_mcpam(models: list):

def run_pam_mcpam_core_with_optimized_kcats(sensitivity:bool=True,
enzyme_sets_name:str='enzyme_sets.json',
print_area:bool=False):
print_area:bool=False,
type:str='full scale'):

# Resetting the configurations
config = Config()
config.reset()

# Building the models
pam_core, mcpam_core = build_ecolicore_pam_and_mcpam(sensitivity=sensitivity)
if type == "full scale":
pam, mcpam =build_ecoli_pam_and_mcpam(sensitivity=sensitivity)
else:
pam, mcpam = build_ecolicore_pam_and_mcpam(sensitivity=sensitivity)

# List of kcat values to be changed
enzyme_path = os.path.join('Data', enzyme_sets_name)
with open(enzyme_path, 'r') as json_file:
enzyme_sets = json.load(json_file)

# Changing the solver, since problem with gurobi
pam_core.solver = 'glpk'
mcpam_core.solver = 'glpk'

# Changing the kcats
models = [pam_core, mcpam_core]
models = [pam, mcpam]
change_kcats_for_multiple_enzyme_sets(models, enzyme_sets)

# Setting the objectives and Optimizing the models
BIOMASS_REACTION = 'BIOMASS_Ecoli_core_w_GAM'
if type == "full scale":
BIOMASS_REACTION = 'BIOMASS_Ec_iML1515_core_75p37M'
else:
BIOMASS_REACTION = 'BIOMASS_Ecoli_core_w_GAM'

set_objective_pam_mcpam(models, BIOMASS_REACTION)
optimize_pam_mcpam(models)

Expand All @@ -197,10 +208,10 @@ def run_pam_mcpam_core_with_optimized_kcats(sensitivity:bool=True,

#Printing the occupied area for mcpam core
if print_area:
occupied_area, available_area = mcpam_core.calculate_occupied_membrane()
occupied_area, available_area = mcpam.calculate_occupied_membrane()
print(f'occupied area {occupied_area / available_area * 100}%')

return pam_core, mcpam_core
return pam, mcpam

def run_simulations_pam_mcpam(models, print_area:bool=False, type:str="full scale"):
fontsize = 25
Expand Down
Loading

0 comments on commit 756b356

Please sign in to comment.