0001 function model = createModel(rxnAbrList,rxnNameList,rxnList,revFlagList,...
0002 lowerBoundList,upperBoundList,subSystemList,grRuleList,geneNameList,...
0003 systNameList)
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 model = struct();
0036 model.mets=cell(0,1);model.metNames=cell(0,1);model.metFormulas=cell(0,1);
0037 model.rxns=cell(0,1);model.rxnNames=cell(0,1);model.subSystems=cell(0,1);
0038 model.lb=zeros(0,1);model.ub=zeros(0,1);model.rev=zeros(0,1);
0039 model.c=zeros(0,1);model.b=zeros(0,1);
0040 model.S=sparse(0,0);
0041 model.rxnGeneMat=sparse(0,0);
0042 model.rules=cell(0,1);
0043 model.grRules=cell(0,1);
0044 model.genes=cell(0,1);
0045
0046 if nargin < 1
0047 return;
0048 end
0049
0050 nRxns = length(rxnNameList);
0051 if nargin < 9
0052 geneNameList(1:nRxns,1) = {''};
0053 systNameList(1:nRxns,1) = {''};
0054 end
0055 if nargin < 8
0056 grRuleList(1:nRxns,1) = {''};
0057 end
0058 if nargin < 7
0059 subSystemList(1:nRxns,1) = {''};
0060 end
0061 if nargin < 5
0062 lowerBoundList = -1000*ones(nRxns,1);
0063 end
0064 if nargin < 6
0065 upperBoundList = 1000*ones(nRxns,1);
0066 end
0067 if nargin < 4
0068 revFlagList = ones(nRxns,1);
0069 end
0070 if isempty(revFlagList)
0071 revFlagList = zeros(nRxns,1);
0072 revFlagList(find(lowerBoundList)< 0) = 1;
0073 end
0074
0075 for i = 1 : nRxns
0076 if i==nRxns
0077 pause(eps)
0078 end
0079 if ~isempty(grRuleList{i})
0080 if ~isempty(strfind(grRuleList{i},','))
0081 grRuleList{i}= (regexprep(grRuleList{i},',',' or '));
0082 end
0083 if ~isempty(strfind(grRuleList{i},'&'))
0084 grRuleList{i} = (regexprep(grRuleList{i},'&',' and '));
0085 end
0086 if ~isempty(strfind(grRuleList{i},'+'))
0087 grRuleList{i}= (regexprep(grRuleList{i},'+',' and '));
0088 end
0089 end
0090 [metaboliteList,stoichCoeffList] = parseRxnFormula(rxnList{i});
0091 for q=1:length(metaboliteList)
0092 if length(metaboliteList{q})<=3 || ~strcmp(metaboliteList{q}(end-2),'[')
0093
0094 metaboliteList{q}=[metaboliteList{q},'[c]'];
0095 end
0096 end
0097 model = addReaction(model,{rxnAbrList{i},rxnNameList{i}},metaboliteList,stoichCoeffList,...
0098 revFlagList(i),lowerBoundList(i),upperBoundList(i),0,...
0099 subSystemList{i},grRuleList{i},geneNameList{i},systNameList{i},false);
0100 end