Home > src > geckomat > change_model > setKcatForReactions.m

setKcatForReactions

PURPOSE ^

setKcatForReactions

SYNOPSIS ^

function ecModel = setKcatForReactions(ecModel,rxnIds,kcat)

DESCRIPTION ^

 setKcatForReactions
   Change the kcat value in ecModel.ec.kcat for selected reactions.
   applyKcatConstraints needs to be run afterwards to transfer the kcat
   values into the S-matrix.

 Input:
   ecModel     an ecModel in GECKO 3 format (with ecModel.ec structure)
   rxnIds      reaction identifier matching ecModel.ec.rxns. If the _EXP_.
               suffix is not included, and there are multiple expanded
               (isozymic) reactions, then all off those will have their
               kcat changed. If rxnIds includes a _EXP_ suffix, then only
               that specific reaction will have its kcat changed. If
               multiple rxnIds are provided as a cell array, then the
               above applies to each rxnIds individual.
   kcat        the new kcat value

 Output:
   ecModel     ecModel where selected kcat values in ecModel.ec.kcat are
               changed, but not yet applied to the S-matrix (will require
               to run applyKcatConstraints). ecModel.ec.source for the
               changed reactions will read 'from setKcatForReactions'

 Usage: ecModel = setKcatForReactions(ecModel,rxnIds,kcat)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ecModel = setKcatForReactions(ecModel,rxnIds,kcat)
0002 % setKcatForReactions
0003 %   Change the kcat value in ecModel.ec.kcat for selected reactions.
0004 %   applyKcatConstraints needs to be run afterwards to transfer the kcat
0005 %   values into the S-matrix.
0006 %
0007 % Input:
0008 %   ecModel     an ecModel in GECKO 3 format (with ecModel.ec structure)
0009 %   rxnIds      reaction identifier matching ecModel.ec.rxns. If the _EXP_.
0010 %               suffix is not included, and there are multiple expanded
0011 %               (isozymic) reactions, then all off those will have their
0012 %               kcat changed. If rxnIds includes a _EXP_ suffix, then only
0013 %               that specific reaction will have its kcat changed. If
0014 %               multiple rxnIds are provided as a cell array, then the
0015 %               above applies to each rxnIds individual.
0016 %   kcat        the new kcat value
0017 %
0018 % Output:
0019 %   ecModel     ecModel where selected kcat values in ecModel.ec.kcat are
0020 %               changed, but not yet applied to the S-matrix (will require
0021 %               to run applyKcatConstraints). ecModel.ec.source for the
0022 %               changed reactions will read 'from setKcatForReactions'
0023 %
0024 % Usage: ecModel = setKcatForReactions(ecModel,rxnIds,kcat)
0025 rxnIds = convertCharArray(rxnIds);
0026 
0027 hasExp       = ~cellfun(@isempty,regexp(rxnIds,'_EXP_\d+$'));
0028 nonExpRxns   = regexprep(ecModel.ec.rxns,'_EXP_\d+$','');
0029 rxnsToChange = [];
0030 for i=1:numel(hasExp)
0031     if hasExp(i) == 1
0032         rxnsToChange = [rxnsToChange; find(strcmpi(ecModel.ec.rxns,rxnIds{i}))];
0033     else
0034         nonExpRxn    = regexprep(rxnIds(i),'_EXP_\d+$','');
0035         rxnsToChange = [rxnsToChange; find(strcmpi(nonExpRxns,nonExpRxn))];
0036     end
0037 end
0038 if isscalar(rxnsToChange)
0039     if length(kcat) ~= 1
0040         error('Found one reaction whose kcat should change, you should provide one kcat value only.')
0041     end
0042 else
0043     if isscalar(kcat)
0044         % Is fine, all reactions get the same kcat
0045     elseif length(kcat) ~= length(rxnsToChange)
0046         error('Found %d reactions whose kcat should change, the new kcat should be either a single value, or a vector of length %d.', length(rxnsToChange), length(rxnsToChange))
0047     end
0048 end
0049 ecModel.ec.kcat(rxnsToChange)   = kcat;
0050 ecModel.ec.source(rxnsToChange) = {'setKcatForReactions'};
0051 end

Generated by m2html © 2005