0001 function model = changeRxnBounds(model,rxnNameList,value,boundType)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 if (nargin < 4)
0026 boundType = 'b';
0027 end
0028
0029 if ((length(value) ~= length(rxnNameList) & length(value) > 1) | (length(boundType) ~= length(rxnNameList) & length(boundType) > 1))
0030 error('Inconsistent lenghts of arguments: rxnNameList, value & boundType');
0031 end
0032
0033 rxnID = findRxnIDs(model,rxnNameList);
0034
0035
0036 if (iscell(rxnNameList))
0037 missingRxns = rxnNameList(rxnID == 0);
0038 for i = 1:length(missingRxns)
0039 fprintf('Reaction %s not in model\n',missingRxns{i});
0040 end
0041 if (length(boundType) > 1)
0042 boundType = boundType(rxnID ~= 0);
0043 end
0044 if (length(value) > 1)
0045 value = value(rxnID ~= 0);
0046 end
0047 rxnID = rxnID(rxnID ~= 0);
0048 end
0049
0050 if (isempty(rxnID) | sum(rxnID) == 0)
0051 warning('No such reaction in model');
0052 else
0053 nRxns = length(rxnID);
0054 if (length(boundType) > 1)
0055 if (length(value) == 1)
0056 value = repmat(value,nRxns,1);
0057 end
0058 for i = 1:nRxns
0059 switch lower(boundType{i})
0060 case 'u'
0061 model.ub(rxnID(i)) = value(i);
0062 case 'l'
0063 model.lb(rxnID) = value(i);
0064 case 'b'
0065 model.lb(rxnID) = value(i);
0066 model.ub(rxnID) = value(i);
0067 end
0068 end
0069 else
0070 switch lower(boundType)
0071 case 'u'
0072 model.ub(rxnID) = value;
0073 case 'l'
0074 model.lb(rxnID) = value;
0075 case 'b'
0076 model.lb(rxnID) = value;
0077 model.ub(rxnID) = value;
0078 end
0079 end
0080 end