Skip to content

Commit 0a7777c

Browse files
committed
More comments and statistics
1 parent 38aa567 commit 0a7777c

10 files changed

+46
-369
lines changed

cosa_cva.py

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
from tkinter.messagebox import NO
2-
import matplotlib.pyplot as plt
1+
"""This module contains the function for the Concentration Variability Analysis (CVA)."""
2+
3+
# IMPORT SECTION #
4+
# External
35
import cobra
46
import copy
7+
import matplotlib.pyplot as plt
58
import os
69
import pulp
710
from math import exp
8-
from cosa_get_all_tcosa_reaction_ids import get_all_tcosa_reaction_ids
9-
from cosa_get_model_with_nadx_scenario import cosa_get_model_with_nadx_scenario
10-
from cosa_get_suffix import cosa_get_suffix
11-
from helper import json_load, json_write, json_zip_load
12-
from typing import List
11+
from typing import Dict, List
12+
# Internal
1313
from optmdfpathway import (
1414
STANDARD_R, STANDARD_T, get_optmdfpathway_base_problem,
1515
add_differential_reactions_constraints, get_z_variable_status,
@@ -18,11 +18,24 @@
1818
from cosa_load_model_data import (
1919
MIN_OPTMDF, load_model_data
2020
)
21-
from typing import Dict
22-
from helper import ensure_folder_existence
21+
from cosa_get_all_tcosa_reaction_ids import get_all_tcosa_reaction_ids
22+
from cosa_get_model_with_nadx_scenario import cosa_get_model_with_nadx_scenario
23+
from cosa_get_suffix import cosa_get_suffix
24+
from helper import ensure_folder_existence, json_load, json_write, json_zip_load
2325

2426

27+
# PUBLIC FUNCTIONS SECTION #
2528
def cosa_cva(metabolites: List[str], anaerobic: bool, expanded: bool, growth_epsilon: float = 0.01) -> None:
29+
"""Performs a concentration variability analysis (CVA).
30+
31+
As a results, it writes JSON files with the CVA results in the 'cosa' subfolder'
32+
33+
### Arguments
34+
* metabolites: List[str] ~ List of metabolite IDs for all metabolites for which a CVA shall be performed.
35+
* anaerobic: bool ~ Whether or not anaerobicity is the case.
36+
* expanded: bool ~ Whether (True) 3 or 2 (False) redox cofactors are used.
37+
* growth_epsilon: float = 0.01 ~ The numeric stability factor to go below µ.
38+
"""
2639
suffix = cosa_get_suffix(anaerobic, expanded)
2740
figures_path = f"./cosa/results{suffix}/figures/"
2841
ensure_folder_existence(figures_path)

cosa_cva_variability_statistics.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
"""This module produces a text file with some CVA variability statistics."""
2+
13
from helper import json_load
24

35
top = 15
46
used_mu = "0,818"
57

68
for aerobicity in ("aerobic",):
79
for target in ("OPTMDF", "OPTSUBMDF"):
8-
txtpath = f"cva_vars_{aerobicity}_{target}_{used_mu}_STANDARDCONC.txt"
10+
txtpath = f"./cosa/cva_vars_{aerobicity}_{target}_{used_mu}_STANDARDCONC.txt"
911
jsondata = json_load(f"./cosa/results_{aerobicity}/cva_{target}_STANDARDCONC.json")
1012

1113
num_not_max_var = 0
@@ -47,4 +49,3 @@
4749

4850
with open(txtpath, "w", encoding="utf-8") as f:
4951
f.write(txt)
50-

cosa_dG0_sampling_aerobic.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Performs the dGf sampling under aerobic conditions."""
12
from cosa_dG0_sampling import cosa_dG0_sampling
23
from cosa_random_sampling_figures import create_cosa_dG0_sampling_figures, create_total_dG0_sampling_figure
34

cosa_dG0_sampling_anaerobic.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Performs the dGf sampling under anaerobic conditions."""
12
from cosa_dG0_sampling import cosa_dG0_sampling
23
from cosa_random_sampling_figures import create_cosa_dG0_sampling_figures, create_total_dG0_sampling_figure
34

cosa_fva.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Performs a thermodynamic FVA under the given settings. See 'cosa_fva_aerobic' and 'cosa_fva_anaerobic' for its application."""
2+
13
import cobra
24
import copy
35
import os

cosa_fva_excel_comparison_files.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
"""This modules creates the Supplementary Table 3."""
2+
3+
# IMPORT SECTION #
4+
# External
15
import copy
26
import math
37
import openpyxl
4-
from helper import json_load
8+
# Internal
59
from cosa_load_model_data import load_model_data
610
from cosa_get_model_with_nadx_scenario import cosa_get_model_with_nadx_scenario
11+
from helper import json_load
712

8-
13+
# LOGIC SECTION #
914
core_ids = [
1015
"EX_glc__D_e",
1116
"GLCptspp",

0 commit comments

Comments
 (0)