Clone wiki

icot / Home

iCot: Integrated CObra Toolbox

This is a tutorial for the iCot Matlab package. Please send any questions, suggestions, or comments to Paul Jensen (paj2s {at} virginia {dot} edu).

Starting up

  1. Make sure iCot is installed (for help, follow the Installation Instructions).
  2. Initialize the toolbox.
icot.init();

Loading a COBRA model

  1. Load a model using the Cobra toolbox. These instructions assume that your model structure is called 'cobra'.
  2. Convert the Cobra model to an iCot model:
model = icot.load_cobra_model(cobra);

The iCot fields

The fields of an iCot model can be examined as a structure:

>> properties(icot)

Properties for class icot:

    % ==================== PROPERTIES =====================
    
    % ----- Cobra fields -----
        % aliased to f
        c   % objective coefficients
    
        S   % stoichiometry matrix
        b   % RHS for stoichiometry matrix
        rev % reaction reversibility
   
        % these fields cannot be changed
        rxns    % reaction ids
        mets    % metabolite ids
        rxnNames    % reaction long names
        metNames    % metabolite long names
        genes   % gene names
        grRules % GPR:  Readable form
        rules   % GPR:  Matlab-computable form
        rxnGeneMat  % reaction/gene correspondence
        subSystems  % reaction subsystem associations

        % these fields are aliased to rlb and rub
        lb  % reaction lower bounds
        ub  % reaction upper bounds
    
    % ----- iCOT fields -----
        f   % objective coefficients
        N   % network matrix
        a   % RHS for network matrix
        B   % binding matrix
        z   % RHS for binding matrix
        rlb     % reaction lower bounds
        rub     % reaction upper bounds
        vlb     % variable lower bounds
        vub     % variable upper bounds

        solver_options % options for the solver

        % these fields cannot be changed
        vars    % variable names
        atoms   % redundant -- remove later
        
        rxn_idxs % variable indexes for reactions
        rxn_var_names % name for reaction indicators
        
        var     % variable names and state levels
        ineq_classes    % class assignments

        % propety sizes
        natoms
        nmets
        nrxns
        nvars
        ninds
        nineqs
        ntotal
        nnzS
        nnzN
        
        % special sets
        ex_rxns         % exchange reaction indexes
        ex_rxn_names    % exchange reaction names
        ex_mets         % exchange metabolite indexes
        ex_met_names    % exchange metabolite names

iCot Methods

Instance Methods

  • copy (see below)
  • fba Run flux balance analysis using a modified SR-FBA algorithm
  • made Metabolic Adjustment by Differential Expression (see MADE)
  • make_milp Convert an iCot model into a single MILP for CMPI.
  • get_var_idx Return the index of a variable name.
  • set_var Set the upper and lower bounds of a variable.

Static Methods

  • load_cobra_model Add regulation (exchange and GPR) to a Cobra model and create an iCot model.
  • get_config_val Load iCot configuration values.
  • init Set paths and initialize CMPI.
  • set_fields Safe copying of structure fields.

Important note about copying iCot models

For efficiency (and other reasons), iCot models are stored as Matlab handle objects, not structures. This means that iCot models cannot be copied directly, since Matlab will only copy a reference to the original value. Consider the following example:

>> model = icot.load_cobra_model(cobra);
>> model.lb

ans =

   -10
   -10
   -10
   -10

>> model_copy = model;
>> model_copy.lb(1) = -8;
>> model_copy.lb

ans =

    -8
   -10
   -10
   -10

>> model.lb

ans =

    -8
   -10
   -10
   -10

Notice how changes made to the copy also affect the original model. To avoid this, use iCot's copy() method to create a duplicate model:

>> model = icot.load_cobra_model(cobra);
>> model.lb                             

ans =

   -10
   -10
   -10
   -10

>> model_dup = model.copy();            
>> model_dup.lb(1) = -6;                
>> model_dup.lb

ans =

    -6
   -10
   -10
   -10

>> model.lb

ans =

   -10
   -10
   -10
   -10

All iCot models can be used directly by the Cobra toolbox, but changes made to the model inside Cobra will affect the original model. The easiest solution is to send a copy of the iCot model to the toolbox or use iCot's cobra() method to create a Cobra-friendly copy of the iCot model:

model = icot.load_cobra_model(cobra);

% WRONG: call a Cobra function with an iCot model
optimizeCbModel(model);

% CORRECT: send a copy to Cobra
optimizeCbModel(model.copy);
% or send a Cobra structure
optimizeCbModel(model.cobra);

Updated