# Enzyme cost minimization

Main | Workflow | Model | Running ECM | Download

#### How to run ECM

To run ECM for a pathway of choice, you first need to specify the reactions (sum formulae), enzyme kinetic rate laws (including kinetic constants), and a metabolic flux distribution. A convenient way to obtain complete and consistent sets of kinetic constants is provided by parameter balancing. Tools for running ECM are described below.

#### Tools for ECM: Matlab, python, eQuilibrator, and NEOS optimization server

Different software tools for Enzyme Cost Minimization (Matlab,
python, eQuilibrator online tool, NEOS online optimization server) are
provided or described on this website. For a quick start, the online
service at
eQuilibrator
is most convenient. Conversely, the Matlab implementation provides a
large number of options for customizing the calculation.

To get
to used to ECM and its file formats, you may run ECM for our
example model as described below. To run ECM for your own models and
data, just use the same format. For further options
of the software tools, which are not mentioned here, please refer to
the code documentation.

#### Data formats

Our ECM code can handle different data formats for models and numerical data. For simplicity, we refer here only to one format, in which model and data are stored in a single SBtab data file. Below we will call this file the "ECM Model file". An example, which is also used as a running example below, is the file ecoli_ccm_ProteinUniform_ECM_Model.tsv, which can be found as the "ECM Model [SBtab]" file on the E. coli model page. To run ECM for your own models, you just need to prepare all information in the same file format. To generate a template file for your pathway model based on a list of reaction sum formulae, please use the Pathway Analysis tool at eQuilibrator online ("Step 1: Build SBtab Pathway Model").

#### 1. Matlab

This is how you can run our example ECM task using the Matlab code. As an example model, you may download the ECM Model file ecoli_ccm_ProteinUniform_ECM_Model.tsv. After installing the Matlab functions for ECM, run

% Set the file location of your Models and Data file; you can choose a
different location.

filename =
'ecoli_ccm_ProteinUniform_ECM_Model.tsv';

% Load the model and data from the ECM Model file and translate them
into matlab

% data structures (see the documentation of the
Metabolic Network Toolbox for details)

[network,v,c_data,u_data, conc_min, conc_max, met_fix,
conc_fix,positions, enzyme_cost_weights, warnings] =
load_model_and_data_sbtab(filename);

% Define some default options for ECM; to change the options, refer to the documentation

ecm_options = ecm_default_options(network, 'My example model');

ecm_options.c_data = c_data;

ecm_options.u_data = u_data;

ecm_options = ecm_update_options(network, ecm_options);

% Run ECM

[c, u, u_cost, up, A_forward, mca_info, c_min, c_max, u_min, u_max, r, u_capacity, eta_energetic, eta_saturation] = ecm_enzyme_cost_minimization(network, network.kinetics, v, ecm_options);

% Save results to SBtab files (again, the file path may be changed)

document_name = 'E. coli central carbon metabolism - ECM result';

outfile_name = 'ecoli_ccm_ProteinUniform_ECM_results';

opt = struct('r', network.kinetics, 'method', 'emc4cm', 'document_name', document_name, 'save_tolerance_ranges', 1);

ecm_save_result_sbtab(outfile_name, network, c, u, A_forward, opt, c_min, c_max, u_min, u_max, u_capacity, eta_energetic, eta_saturation);

% Display graphical output:

kinetic_data = [];

ecm_options.show_graphics = 1;

graphics_options.print_graphics = 1;

graphics_options.few_graphics = 1;

graphics_options.metabolite_order_file = [];

graphics_options.reaction_order_file = [];

graphics_options.enzyme_colors = sunrise_colors(length(ecm_options.ind_scored_enzymes));

ecm_display(ecm_options, graphics_options, network,v,c,u,u_cost,up,A_forward,r,kinetic_data,c_min,c_max,u_min,u_max,u_capacity,eta_energetic,eta_saturation);

Except for the choice of the filename, you will find the same commands in the demo script

matlab/enzyme-cost-minimization/demo/demo_ecm_ecoli_noor_2016.m

#### 2. Python

- Install the Python functions for the Component Contribution Method (gitlab project component-contribution)
- Install the Python functions for ECM (gitlab project equilibrator-pathway)
- Run ecoli_ccm_aerobic.py

#### 3. eQuilibrator Website

Enzyme cost minimization has been integrated into the eQuilibrator online tool for thermodynamic calculations. To generate the necessary input data, please specify the reaction sum formulae and metabolic fluxes for your pathway of interest and follow the instructions on the eQuilibrator website. The kinetic constants can be entered later into a template file generated by equilibrator. If you need a customisable algorithm, please use the locally installable Matlab or python code instead.

#### 4. NEOS Optimization Server Website

Another implementation of Enzyme Cost Minimization (by Meike Wortel and Michael Ferris) is provided on the NEOS optimization server. The NEOS Optimization server does not use the same input file format as the Matlab and python implementations. Instead, it requires input files in one of the following alternative formats:

- A number of separate comma-separated (csv) files ("NEOS files") describing model and data
- The same files, as a single zip file
- A single table file describing model and data.

For the file syntax, please see the instructions on the NEOS ECM website. Files in the normal SBtab format can converted into NEOS input files using our MATLAB code (see below).

Depending on the input file format used, you may run NEOS ECM in three different places:

- Run NEOS ECM with separate .csv NEOS files
- Run NEOS ECM with one zip-file containing all .csv NEOS files
- Run NEOS ECM with single-file table format

To run ECM for our example *E. coli* model, download the zipped .csv NEOS
files from ("ECM Model [NEOS files]") from
the example page.
Now you can proceed in
one of the two following ways:

- Directly upload the file to https://proto.neos-server.org/neos/solvers/application:MER/zip.html and run ECM
- Unzip the file, upload it to https://proto.neos-server.org/neos/solvers/application:MER/csv.html, and run ECM

The fields for files "moietymet", "moietyval", "alpha", and "A" can be left open.

To convert input files in the normal SBtab format into NEOS input files, you may use the following Matlab commands:

% Directory location for output files; you can change this location

neos_directory = '~/Desktop/';

[network,v,c_data,u_data, conc_min, conc_max, met_fix, conc_fix, positions, enzyme_cost_weights, warnings] = ecm_load_model_and_data_sbtab(filename);

ecm_save_model_and_data_neos(neos_directory, network, v, network.kinetics, c_data, u_data, enzyme_cost_weights, conc_min, conc_max, met_fix, conc_fix);