opencobra/cobratoolbox — pull request #7 by bbarker (2013-06-23 22:41:07+00:00)
Title: Fixing several reversible/irreversible conversion functions

This subsumes a prior pull request that I just closed that updated convertToIrreversible.m to include more model fields. Additionally, and error is fixed in convertIrrevFluxDistribution.m to add proper handing of strictly backward reactions. For details on this latter part, see the following example:

%
% Run FBA on Recon 2, then check that steady state is observed.
% I use min-1norm FBA solutions in all cases to reduce the amount
% of irrelevant fluxes and flux differences.
%
>> solWT = optimizeCbModel(rec2,'max','one');
>> sum(abs(rec2.S * solWT.x))

ans =

1.9058e-13

%
% Now let us convert to an irreversible model and do the same again.
%
>> [rec2Irr,matchRev,rev2irrev,irrev2rev] = convertToIrreversible(rec2);
>> solIrr = optimizeCbModel(rec2Irr,'max','one');
>> sum(abs(rec2Irr.S * solIrr.x))

ans =

1.4131e-13

%
% That works, so let us try to convert the irreversible flux vector
% back to a reversible vector and check for steady state.
%
>> vItoR = convertIrrevFluxDistribution(solIrr.x,matchRev);
>> sum(abs(rec2.S * vItoR))

ans =

15.6060

% This is a problem that is due to not correctly handling strictly backward reactions.
% Using a corrected version that makes use of the model as the first argument,
% we now correctly estimate steady state:
%
>> vItoR = convertIrrevFluxDistribution(rec2,solIrr.x,matchRev);
>> sum(abs(rec2.S * vItoR))

ans =

1.4131e-13