Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriceling committed Nov 5, 2021
2 parents 084f5a9 + ac9bfa7 commit 8f9abd4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
11 changes: 6 additions & 5 deletions ASModeller/gsm_to_km.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

import pandas as pd

def gsm_km_converter(input_model, input_name, outputfile, rxnList):
def gsm_km_converter(input_model, input_name, outputfile, rxnList,
metabolite_initial, enzyme_conc, enzyme_kcat, enzyme_km):
pd.set_option('display.max_colwidth', None)
filenamedata = []
filenamedata.append(outputfile)
Expand Down Expand Up @@ -88,18 +89,18 @@ def gsm_km_converter(input_model, input_name, outputfile, rxnList):
['\n\n']

initialsList = ['[Initials]' + '\n'] + \
[row['obj'].strip() + ' : 1e-5' + '\n'
[row['obj'].strip() + ' : ' + str(metabolite_initial) + '\n'
for index, row in df4.iterrows()] + \
['\n\n']

variable_concList = ['[Variables]' + '\n'] + \
[row['rxn_id'].strip() + '_conc : 1e-6' + '\n'
[row['rxn_id'].strip() + '_conc : ' + str(enzyme_conc) + '\n'
for index, row in df.iterrows()]

variable_kcatList = [row['rxn_id'].strip() + '_kcat : 10' + '\n'
variable_kcatList = [row['rxn_id'].strip() + '_kcat : ' + str(enzyme_kcat) + '\n'
for index, row in df.iterrows()]

variable_kmList = [row['rxn_id'].strip() + '_km : 0.001' + '\n'
variable_kmList = [row['rxn_id'].strip() + '_km : ' + str(enzyme_km) +'\n'
for index, row in df.iterrows()] + ['\n\n']

reactionList = ['[Reactions]' + '\n'] + \
Expand Down
19 changes: 14 additions & 5 deletions astools.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,20 +902,29 @@ def cameo_mediumpFBA(model, change, result_type='objective',
else:
ASExternalTools.mediumFBA(model, change, 'pFBA', result_type)

def GSM_to_ASM(model, name, outputfile):
def GSM_to_ASM(model, name, outputfile, metabolite_initial=1e-5,
enzyme_conc=1e-6, enzyme_kcat=13.7, enzyme_km=130e-6):
'''!
Function to read reactions in Genome-Scale Models (GSM) using
Cameo and convert to AdvanceSyn Model (ASM) format.
Usage:
python astools.py GSM-to-ASM --model=e_coli_core --name=e_coli_core --outputfile=models/asm/e_coli_core.modelspec
python astools.py GSM-to-ASM --metabolite_initial=1e-5 --enzyme_conc=1e-6 --enzyme_kcat=13.7 --enzyme_km=130e-6 --model=e_coli_core --name=e_coli_core --outputfile=models/asm/e_coli_core.modelspec
@model String: Model acceptable by Cameo (see
http://cameo.bio/02-import-models.html).
@param model String: Model acceptable by Cameo (see http://cameo.bio/02-import-models.html).
@param name String: Name of model author / creator.
@param outputfile String: Relative path to the write out the converted
ASM model.
@param metabolite_initial Float: Initial metabolite concentration. Default = 1e-5 (10 uM).
@param enzyme_conc Float: Enzyme concentration. Default = 1e-6 (1 uM)
@param enzyme_kcat Float: Enzyme kcat / turnover number. Default = 13.7 (13.7 per second).
@param enzyme_km Float: Enzyme Km (Michaelis-Menten constant). Default = 130e-6 (130 uM).
'''
rxnList = ASExternalTools.get_reaction_compounds(model, False)
ASModeller.gsm_km_converter(model, name, outputfile, rxnList)
ASModeller.gsm_km_converter(model, name, outputfile, rxnList,
metabolite_initial, enzyme_conc,
enzyme_kcat, enzyme_km)
return rxnList


Expand Down

0 comments on commit 8f9abd4

Please sign in to comment.