Skip to content

Commit

Permalink
Update cmpb #8
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-Hades committed May 17, 2024
1 parent c066dec commit f8f3948
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
22 changes: 12 additions & 10 deletions src/specimen/cmpb/workflow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

__author__ = "Tobias Fehrenbach, Famke Baeuerle and Gwendolyn O. Döbel"
__author__ = "Tobias Fehrenbach, Famke Baeuerle, Gwendolyn O. Döbel and Carolin Brune"

################################################################################
# requirements
Expand All @@ -14,6 +14,7 @@
import pandas as pd
import matplotlib.pyplot as plt
from datetime import date
from pathlib import Path

from ..util.set_up import save_cmpb_user_input

Expand All @@ -33,14 +34,14 @@ def run(configpath=None):

config = save_cmpb_user_input(configpath)
today = date.today().strftime("%Y%m%d")
log_file = f'{config["out_path"]}rg_{str(today)}.log'
log_file = Path(config["out_path"],f'rg_{str(today)}.log')

# check if the output directory is already present, if not create it
if not os.path.isdir(config['out_path']):
logging.info('Given out_path is not yet a directory, creating ' + config['out_path'])
os.makedirs(config['out_path'])
if config['visualize']:
dir = os.path.join(config['out_path'] + 'visualization/')
dir = Path(config['out_path'],'visualization')
if not os.path.isdir(dir):
os.makedirs(dir)

Expand All @@ -64,13 +65,14 @@ def run(configpath=None):
if config['multiple']:
logging.info('Growth simulation for multiple models: ')
models_cobra = rg.utility.io.load_model(config['multiple_paths'], 'cobra')
# .....................................
# @TODO:
growth_all = rg.comparison.simulate_all(models_cobra, config['media'], config['growth_basis'], config['anaerobic_growth'])
growth_prefix = 'anaerobic_growth_' if config['anaerobic_growth'] else 'growth_'
growth_all.to_csv(config['out_path'] + growth_prefix + str(today) + '_' + config['growth_basis'] + '.csv', index=False)
logging.info('Multiple model growth simulation results are saved to ' + growth_prefix + str(today) + '_' + config['growth_basis'] + '.csv')
# .....................................
growth_all = rg.analysis.growth.growth_analysis(model_cobra,
config['mediapath'],
namespace = config['namespace'],
retrieve='report')
growth_all.save(Path(config['out_path']))
logging.info('Multiple model growth simulation results are saved to ' + str(Path(config['out_path'], 'GrowthSimReport')))

###########

# visualizations
# .....................................
Expand Down
20 changes: 4 additions & 16 deletions src/specimen/data/config/cmpb_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Settings for scripts that investigate the model: >
# Set to TRUE if you want pngs that aid in model investigation, will be saved to a folder called 'visualization'
visualize: TRUE

# Set the basis medium to simulate growth from
growth_basis: 'minimal_uptake' # 'default_uptake' or 'minimal_uptake'
# Set the path to a medium config for growth simulation
mediapath: 'media_config.yaml'

# Set to TRUE if you want to simulate anaerobic growth
anaerobic_growth: FALSE
# Namespace to use for the model
namespace: 'BiGG'

# Settings if you want to compare multiple models
multiple: FALSE
Expand All @@ -30,18 +30,6 @@ multiple_paths: # enter as many paths as you need below
- ''
single: TRUE # set to False if you only want to work with the multiple models

# media to simulate growth from, just comment the media you do not want with a #
media:
- 'LB'
- 'RPMI'
- 'M9'
- 'SNM3'
- 'CGXII'
- 'CasA'
- 'Blood'
- 'dGMM'
- 'MP-AU'

# Determine whether the biomass function should be checked & normalised
biomass: TRUE

Expand Down

0 comments on commit f8f3948

Please sign in to comment.