Skip to content

Commit cf18f8b

Browse files
committed
New statistics
1 parent 320a457 commit cf18f8b

7 files changed

Lines changed: 12192 additions & 6680 deletions

cosa/max_reacs_aerobic_WILDTYPE_OPTMDF_STANDARDCONC.txt

Lines changed: 4424 additions & 2993 deletions
Large diffs are not rendered by default.

cosa/max_reacs_aerobic_WILDTYPE_OPTSUBMDF_STANDARDCONC.txt

Lines changed: 3707 additions & 2374 deletions
Large diffs are not rendered by default.

cosa/max_reacs_anaerobic_WILDTYPE_OPTMDF_STANDARDCONC.txt

Lines changed: 2115 additions & 0 deletions
Large diffs are not rendered by default.

cosa/max_reacs_anaerobic_WILDTYPE_OPTSUBMDF_STANDARDCONC.txt

Lines changed: 1889 additions & 1295 deletions
Large diffs are not rendered by default.

cosa_dG0_TCOSA_reaction_statistics.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
nadph_to_nadp = []
1313

1414
num_with_nad_or_nadp = 0
15+
tcosa_with_dG0 = []
1516
for key in list(dG0s.keys()):
1617
if key.endswith("_REV"):
1718
continue
@@ -37,24 +38,25 @@
3738
nadp_is_product = "nadp_c" in product_met_ids
3839
nadph_is_product = "nadph_c" in product_met_ids
3940

41+
is_nad_nadp = False
4042
if (nad_is_educt) and (nadh_is_product):
4143
nad_to_nadh.append(dG0)
4244
nadh_to_nad.append(-dG0)
43-
print(key, dG0)
44-
num_with_nad_or_nadp += 1
45+
is_nad_nadp = True
4546
if (nadh_is_educt) and (nad_is_product):
4647
nadh_to_nad.append(dG0)
4748
nad_to_nadh.append(-dG0)
48-
print(key, dG0)
49-
num_with_nad_or_nadp += 1
49+
is_nad_nadp = True
5050
if (nadp_is_educt) and (nadph_is_product):
5151
nadp_to_nadph.append(dG0)
5252
nadph_to_nadp.append(-dG0)
53-
print(key, dG0)
54-
num_with_nad_or_nadp += 1
53+
is_nad_nadp = True
5554
if (nadph_is_educt) and (nadp_is_product):
5655
nadph_to_nadp.append(dG0)
5756
nadp_to_nadph.append(-dG0)
57+
is_nad_nadp = True
58+
if is_nad_nadp:
59+
tcosa_with_dG0.append(key.replace("_FWD", ""))
5860
print(key, dG0)
5961
num_with_nad_or_nadp += 1
6062

@@ -64,3 +66,5 @@
6466
print("nadp_to_nadph", round(mean(nadp_to_nadph), 3), round(median(nadp_to_nadph), 3), len(nadp_to_nadph))
6567
print("nadph_to_nadp", round(mean(nadph_to_nadp), 3), round(median(nadph_to_nadp), 3), len(nadph_to_nadp))
6668
print("num_with_nad_or_nadp", num_with_nad_or_nadp)
69+
print(len(set(tcosa_with_dG0)))
70+
print(tcosa_with_dG0)

cosa_maximal_reaction_numbers.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def cosa_maximal_reaction_numbers(anaerobic: bool, expanded: bool, growth_epsilo
3434
biomass_reaction_id = "BIOMASS_Ec_iML1515_core_75p37M"
3535

3636
original_cobra_model = copy.deepcopy(cobra_model)
37-
for concentrations in ("STANDARDCONC", "VIVOCONC"):
37+
for concentrations in ("STANDARDCONC",): #"VIVOCONC"):
3838
print(f"CONCENTRATIONS: {concentrations}")
3939
print(f"=CONCENTRATION RANGES: {concentrations}=")
4040
if concentrations == "STANDARDCONC":
@@ -44,7 +44,7 @@ def cosa_maximal_reaction_numbers(anaerobic: bool, expanded: bool, growth_epsilo
4444
dG0_values = copy.deepcopy(paperconc_dG0_values)
4545
used_concentration_values = concentration_values_paper
4646

47-
for target in ("OPTSUBMDF",): # "OPTMDF",
47+
for target in ("OPTMDF", "OPTSUBMDF"):
4848
print(f"TARGET: {target}")
4949
print(f"===OPTIMIZATION TARGET: {target}===")
5050

@@ -81,16 +81,19 @@ def cosa_maximal_reaction_numbers(anaerobic: bool, expanded: bool, growth_epsilo
8181
cat=pulp.LpContinuous,
8282
)
8383
z_sum = 0.0
84+
all_tcosa_ids = get_all_tcosa_reaction_ids(cobra_model)
8485
for reaction_id in reaction_ids:
85-
if not reaction_id.endswith("_TCOSA"):
86-
continue
87-
z_active = pulp.LpVariable(
88-
name=f"z_active_{reaction_id}",
89-
cat=pulp.LpBinary,
90-
)
91-
optmdfpathway_base_problem += -optmdfpathway_base_variables[reaction_id] + z_active * 1e-6 <= 0
92-
optmdfpathway_base_variables: Dict[str, pulp.LpVariable] = optmdfpathway_base_problem.variablesDict()
93-
z_sum += optmdfpathway_base_variables[f"z_active_{reaction_id}"]
86+
# if not reaction_id.endswith("_TCOSA"):
87+
# continue
88+
# z_active = pulp.LpVariable(
89+
# name=f"z_active_{reaction_id}",
90+
# cat=pulp.LpBinary,
91+
# )
92+
# optmdfpathway_base_problem += -optmdfpathway_base_variables[reaction_id] + z_active * 1e-5 <= 0
93+
# optmdfpathway_base_variables: Dict[str, pulp.LpVariable] = optmdfpathway_base_problem.variablesDict()
94+
if reaction_id in all_tcosa_ids:
95+
if "_VARIANT_" not in reaction_id:
96+
z_sum += optmdfpathway_base_variables[f"z_var_{reaction_id}"]
9497
z_sum_var = pulp.LpVariable(
9598
name=f"z_sum_var",
9699
lowBound=-float("inf"),
@@ -143,7 +146,7 @@ def cosa_maximal_reaction_numbers(anaerobic: bool, expanded: bool, growth_epsilo
143146
z_value = minimization_result["values"][var_name]
144147
reaction_string = cobra_model.reactions.get_by_id(reac_id).reaction
145148
if z_value > 0.1:
146-
report_line = f"* {reac_id} | {round(dG0_values[reac_id]['dG0'], 3)} kJ/mol | {reaction_string}"
149+
report_line = f"* {reac_id} | {round(dG0_values[reac_id]['dG0'], 3)} kJ/mol | {minimization_result['values'][reac_id]} | {reaction_string}"
147150
active_reactions.append(reac_id)
148151
# print(report_line)
149152
report += report_line + "\n"

model_dG0_statistics.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import cobra
2+
from statistics import mean, median
3+
from helper import json_load
4+
5+
6+
model = cobra.io.read_sbml_model("resources/iML1515_irreversible_cleaned.xml")
7+
dG0s = json_load("resources/dG0_iML1515_irreversible_cleaned.json")
8+
9+
with open("./deleted_transporters.txt", "r", encoding="utf-8") as f:
10+
deleted = f.readlines()
11+
deleted = [x.split(" | ")[0].replace("_ORIGINAL_NADP_TCOSA", "")\
12+
.replace("_ORIGINAL_NAD_TCOSA", "")\
13+
.replace("_VARIANT_NAD_TCOSA", "")\
14+
.replace("_VARIANT_NADP_TCOSA", "")\
15+
.replace("_FWD", "")\
16+
.replace("_REV", "") for x in deleted]
17+
18+
num_with_dG0 = 0
19+
for key in list(dG0s.keys()):
20+
if key.endswith("_REV"):
21+
continue
22+
key = key.replace("_ORIGINAL_NADP_TCOSA", "")\
23+
.replace("_ORIGINAL_NAD_TCOSA", "")\
24+
.replace("_VARIANT_NAD_TCOSA", "")\
25+
.replace("_VARIANT_NADP_TCOSA", "")\
26+
.replace("_FWD", "")\
27+
.replace("_REV", "")
28+
if key in deleted:
29+
continue
30+
num_with_dG0 += 1
31+
32+
print("num_with_dG0", num_with_dG0)

0 commit comments

Comments
 (0)