TfaModel

Add thermodynamic constraints to a XbaModel instance to generate TFA, TGECKO or TRBA models.

class f2xba.TfaModel(xba_model)[source]

Extend a XbaModel instance by adding thermodynamic constraints.

The extended XbaModel can be used to create a TFA model, thermodynamics enabled enzyme constraint (e.g. TGECKO) and resource balance constraint (TRBA) models.

Optimization of models might produce infeasible results, when adding thermodynamic constraints. In such cases, parameter relaxation of the TD constrain model might be required. Relaxation would adjust bounds of ∆rG’˚ (standard transformed Gibbs energy of reaction) optimization variables. The adjusted bounds can be included in the TFA configuration file. See tutorial.

The implementation is based on Python package pyTFA (Salvy et al., 2019).

Ref: Salvy, P., Fengos, G., Ataman, M., Pathier, T., Soh, K. C., & Hatzimanikatis, V. (2019). pyTFA and matTFA: a Python package and a Matlab toolbox for Thermodynamics-based Flux Analysis. Bioinformatics, 35(1), 167-169. https://doi.org/10.1093/bioinformatics/bty499

Example 1: Create a TFA model by extending an existing genome scale metabolic model. The spreadsheet file tfa_parameters.xlsx contains configuration data. See tutorials.

xba_model = XbaModel('iML1515.xml')
xba_model.configure()

tfa_model = TfaModel(xba_model)
tfa_model.configure('tfa_parameters.xlsx')
if tfa_model.validate():
    tfa_model.export('iML1515_TFA.xml')

Example 2: Create a TGECKO model. The spreadsheet files xba_parameters.xlsx, tfa_parameters.xlsx and ecm_parameters.xlsx contain configuration data.

xba_model = XbaModel('iML1515.xml')
xba_model.configure('xba_parameters.xlsx')

tfa_model = TfaModel(xba_model)
tfa_model.configure('tfa_parameters.xlsx')

ec_model = EcModel(xba_model)
ec_model.configure('ecm_parameters.xlsx')
ec_model.export('iML1515_TGECKO.xml')
model

Reference to the XbaModel instance.

td_params

General parameters extracted from TFA configuration file, sheet general.

td_compartments

TD data related to compartments.

td_species

TD data of TD species, extracted from the TD database.

td_cues

TD data of TD cues (components of TD species), extracted from the TD database.

td_reactions

TD data related to model reactions.

td_reactants

TD data related to model species.

configure(fname)[source]

Configure the TfaModel instance with information provided in the TFA configuration file.

The TFA configuration spreadsheet may contain the sheets: ‘general’, ‘td_compartments’, ‘modify_td_sids’, ‘modify_thermo_data’, ‘modify_drg0_bounds’.

Example: Create a TFA model by extending an existing genome scale metabolic model. The spreadsheet file tfa_parameters.xlsx contains configuration data.

xba_model = XbaModel('iML1515.xml')
xba_model.configure()

tfa_model = TfaModel(xba_model)
tfa_model.configure('tfa_parameters.xlsx')
Parameters:

fname (str) – filename of TFA configuration file (.xlsx)

Returns:

success status of operation

Return type:

bool

export_slack_model(fname)[source]

Export a TFA model with slack variables to perform TFA parameter relaxation.

The slack model can be used for model parameter relaxation to adjust bounds of ∆rG’˚ variables and create/update the sheet ‘modify_drg0_bounds’ in the TFA configuration file.

Example: Create TFA model with slack variables.

xba_model = XbaModel('iML1515.xml')
xba_model.configure()

tfa_model = TfaModel(xba_model)
tfa_model.configure('tfa_parameters.xlsx')
tfa_model.export_slack_model('iML1515_TFA_slack.xml')

Subsequently, load and optimize the slack model. Determine adjustments of variable bounds, update the TFA configuration file and generate a TFA model with relaxed bounds. See tutorial related to TFA model creation.

Parameters:

fname (str) – filename with extension ‘.xml’

Returns:

success status of operation

Return type:

bool

validate()[source]

Validate compliance with SBML standards, including units configuration.

Validation is an optional task taking time. Validation could be skipped once model configuration is stable.

Information on non-compliance is printed. Details are written to tmp/tmp.txt. In case of an unsuccessful validation, it is recommended to review tmp/tmp.txt and improve on the model configuration.

Example: Ensure compliance with SBML standards for a TfaModel instance prior to its export to file.

if tfa_model.validate():
    tfa_model.export('iML1515_TFA.xml')
Returns:

success status

Return type:

bool

export(fname)[source]

Export TfaModel to SBML encoded file (.xml) or spreadsheet (.xlsx).

The spreadsheet (.xlsx) is helpful to inspect model configuration.

Example: Export TfaModel to SBML encoded file and to spreadsheet format.

if tfa_model.validate():
    tfa_model.export('iML1515_TFA.xml')
    tfa_model.export('iML1515_TFA.xlsx')
Parameters:

fname (str) – filename with extension ‘.xml’ or ‘.xlsx’

Returns:

success status

Return type:

bool