6.1.1.3.1.1. pytfa.io.base

Input/Output tools to import or export pytfa models

6.1.1.3.1.1.1. Module Contents

6.1.1.3.1.1.1.1. Functions

import_matlab_model(path, variable_name=None)

Convert at matlab cobra_model to a pyTFA cobra_model, with Thermodynamic values

recover_compartments(model, compartments_list)

write_matlab_model(tmodel, path, varname='tmodel')

Writes the Thermo Model to a Matlab-compatible structure

create_thermo_dict(tmodel)

Dumps the thermodynamic information in a mat-compatible dictionary

varnames2matlab(name, tmodel)

Transforms reaction variable pairs from ('ACALD','ACALD_reverse_xxxxx') to

create_problem_dict(tmodel)

Dumps the the MILP formulation for TFA in a mat-compatible dictionary

create_generalized_matrix(tmodel, array_type='dense')

Returns the generalized stoichiomatric matrix used for TFA

load_thermoDB(path)

Load a thermodynamic database

printLP(model)

Print the LP file corresponding to the cobra_model

writeLP(model, path=None)

Write the LP file of the specified cobra_model to the file indicated by path.

pytfa.import_matlab_model(path, variable_name=None)

Convert at matlab cobra_model to a pyTFA cobra_model, with Thermodynamic values

Parameters
  • variable_name

  • path (string) – The path of the file to import

Returns

The converted cobra_model

Return type

cobra.thermo.model.Model

pytfa.recover_compartments(model, compartments_list)
pytfa.write_matlab_model(tmodel, path, varname='tmodel')

Writes the Thermo Model to a Matlab-compatible structure

Parameters
  • varname

  • tmodel

  • path

Returns

None

pytfa.create_thermo_dict(tmodel)

Dumps the thermodynamic information in a mat-compatible dictionary (similar to the output of cobra.io.mat.create_mat_dict)

Parameters

tmodel – pytfa.thermo.tmodel.ThermoModel

Returns

dict object

pytfa.varnames2matlab(name, tmodel)

Transforms reaction variable pairs from (‘ACALD’,’ACALD_reverse_xxxxx’) to (‘F_ACALD’,’B_ACALD’) if it is a reaction, else leaves is as is

Returns

pytfa.create_problem_dict(tmodel)

Dumps the the MILP formulation for TFA in a mat-compatible dictionary (similar to the output of cobra.io.mat.create_mat_dict)

Parameters

tmodel – pytfa.thermo.tmodel.ThermoModel

:ret

pytfa.create_generalized_matrix(tmodel, array_type='dense')

Returns the generalized stoichiomatric matrix used for TFA

Parameters
  • array_type

  • tmodel – pytfa.ThermoModel

Returns

matrix.

pytfa.load_thermoDB(path)

Load a thermodynamic database

Parameters

path (string) – The path of the file to load

Returns

The thermodynamic database

Return type

dict

pytfa.printLP(model)

Print the LP file corresponding to the cobra_model

Parameters

model (cobra.thermo.model.Model) – The cobra_model to output the LP file for

Returns

The content of the LP file

Return type

str

Usually, you pass the result of this function to file.write() to write it on disk. If you prefer, you can use pytfa.io.writeLP() to write the result directly to a file.

pytfa.writeLP(model, path=None)

Write the LP file of the specified cobra_model to the file indicated by path.

Parameters
  • model (cobra.thermo.model.Model) – The COBRApy cobra_model to write the LP file for

  • path (string) – Optional The path of the file to be written. If not specified, the name of the COBRApy cobra_model will be used.