Exemple #1
0
import os
from me_biomass import load_model

me = load_model.load_me_model(json=True)

gene = ''
auxotrophy = 'default'
source_dir = os.getcwd() + '/media_sims/'
if not os.path.isdir(source_dir):
    os.mkdir(source_dir)

for aerobicity in ['aerobic', 'anaerobic']:

    for source in ["C", "P", "S", "N"]:
        for r in me.reactions.query('EX_'):

            if not r.id.startswith('EX_'):
                continue
            met = me.metabolites.get_by_id(r.id.replace('EX_', ''))
            if met.elements.get(source, 0) == 0:
                print('No %s in %s' % (source, met.id))
                continue
            media = r.id

            output_file = aerobicity + '_' + source + '_' + media
            if os.path.exists(os.path.join(source_dir, '%s_sol.json' % output_file)):
                print(output_file, 'already solved')
                continue
            os.system("sbatch edison_submit_job %s %s %s %s %s" %
                      (gene, aerobicity, auxotrophy, media, source))
Exemple #2
0
parser.add_argument('source', help='', type=str)

args = parser.parse_args()

# pair must be in form of ko1strain1:ko2strain1-ko1strain2:ko2strain2
GENE_ID = args.gene
AEROBICITY = args.aerobicity
AUXOTROPHY = args.auxotrophy
MEDIA = args.media
SOURCE = args.source

# ************************************************************
# Load and prepare model for simulations
here = dirname(abspath(__file__))

model = load_me_model(json=True)
if GENE_ID.lower() == 'none':
    GENE_ID = None

if GENE_ID:
    model.reactions.get_by_id('translation_' + GENE_ID).knock_out()
    print('loaded model w/ knockout')

# Close default source of nutrient
if SOURCE == 'N':
    source_rxn = model.reactions.EX_nh4_e
elif SOURCE == 'C':
    source_rxn = model.reactions.EX_glc__D_e
elif SOURCE == 'P':
    source_rxn = model.reactions.EX_pi_e
elif SOURCE == 'S':
from qminospy.me1 import ME_NLP1

import pandas as pd

from me_biomass.load_model import load_me_model

target_to_flux = {}
target_to_shadow = {}
target_to_reduced = {}
anaerobic = True
if anaerobic:
    suffix = '_anaerobic'
else:
    suffix = ''

model = load_me_model()

if anaerobic:
    model.reactions.EX_o2_e.lower_bound = 0


me_nlp = ME_NLP1(model, growth_key='mu')
me_nlp.compiled_expressions = me_nlp.compile_expressions()
hs = None
for source in ["C", "P", "S", "N"]:
    if source == 'N':
        source_rxn = model.reactions.EX_nh4_e
    elif source == 'C':
        source_rxn = model.reactions.EX_glc__D_e
    elif source == 'P':
        source_rxn = model.reactions.EX_pi_e
from qminospy.me1 import ME_NLP1
from copy import deepcopy
import pandas as pd
import cobra
import numpy as np
from IPython import embed
import cobrame
from me_biomass.load_model import load_me_model, currency_met_to_synthesis_rxn

me = load_me_model()

aas = [
    i.replace('_c', '') for i in me.process_data.b2020.amino_acid_count.keys()
]
mets = [
    'quln', 'thf', 'thm', 'fad', 'btn', 'hemed', 'fmn', 'nac', 'thmpp', 'nad',
    'nadp', '10thf', 'amet', 'chor', 'coa', 'atp', 'ctp', 'gtp', 'utp',
    'enter', 'gthrd', 'hemeO', 'malcoa', 'mlthf', 'mobd', 'pheme', 'q8',
    'mql8', 'ptrc', 'ribflv', 'sheme', 'spmd', 'succoa', 'udcpdp'
]

aas.extend(mets)

# Rerun these so that they do not secrete _c -> _e
aas.append('default')

aux_to_ko = {
    'default': [],
    'pydxn': ['PDX5PS1', 'PDX5PS2'],  # PDX5PS in iJO, but unlumped for ME
    'thm': ['THZPSN31'],
    'nac': ['ASPO3', 'ASPO4', 'ASPO5', 'ASPO6'],