addSinkReactions adds a sink reaction for the list of metabolites [model] = addSinkReactions(model,metabolites,lb,ub) INPUTS model COBRA model structure metabolites cell array of metabolite abreviations as they appear in model.mets OPTIONAL INPUTS lb Lower bounds of reactions ub Upper bounds of reactions OUTPUTS model COBRA model structure containing sink reactions rxnsInModel Vector, contains -1 if the reaction did not exist previously, otherwise it contains the reaction ID of an identical reaction already present in the model 05/06/08 Ines Thiele
0001 function [model,rxnsInModel] = addSinkReactions(model,metabolites,lb,ub) 0002 %addSinkReactions adds a sink reaction for the list of metabolites 0003 % 0004 % [model] = addSinkReactions(model,metabolites,lb,ub) 0005 % 0006 %INPUTS 0007 % model COBRA model structure 0008 % metabolites cell array of metabolite abreviations as they appear in model.mets 0009 % 0010 %OPTIONAL INPUTS 0011 % lb Lower bounds of reactions 0012 % ub Upper bounds of reactions 0013 % 0014 %OUTPUTS 0015 % model COBRA model structure containing sink reactions 0016 % rxnsInModel Vector, contains -1 if the reaction did not exist 0017 % previously, otherwise it contains the reaction ID of 0018 % an identical reaction already present in the model 0019 % 0020 % 05/06/08 Ines Thiele 0021 nMets = length(metabolites); 0022 if nargin < 3 0023 lb = ones(nMets,1)*min(model.lb); 0024 ub = ones(nMets,1)*max(model.ub); 0025 end 0026 if size(lb,2)==2 0027 ub = lb(:,2); 0028 lb = lb(:,1); 0029 end 0030 0031 rxnsInModel=-ones(length(metabolites),1); 0032 for i = 1 : nMets 0033 rxnName = strcat('sink_',metabolites{i}); 0034 [model,rxnIDs] = addReaction(model,rxnName,metabolites(i),-1,1,lb(i),ub(i),0,'Sink'); 0035 if ~isempty(rxnIDs) 0036 rxnsInModel(i)=rxnIDs; 0037 end 0038 model.rxnNames(strcmp(model.rxns,rxnName)) = {rxnName}; 0039 end