changeGeneAssoc Changes gene association for a defined reaction model a model structure to change the gene association rxnID string or cell array of reaction IDs geneAssoc string of additional or replacement gene association. Should be written with ' and ' to indicate subunits, ' or ' to indicate isoenzymes, and brackets '()' to separate different instances replace true if old gene association should be replaced with new association. False if new gene association should be concatenated to the old association (optional, default true) model an updated model structure Usage: changeGeneAssoc(model,rxnID,geneAssoc,replace)
0001 function model = changeGeneAssoc(model,rxnID,geneAssoc,replace) 0002 % changeGeneAssoc 0003 % Changes gene association for a defined reaction 0004 % 0005 % model a model structure to change the gene association 0006 % rxnID string or cell array of reaction IDs 0007 % geneAssoc string of additional or replacement gene association. 0008 % Should be written with ' and ' to indicate subunits, ' or ' 0009 % to indicate isoenzymes, and brackets '()' to separate 0010 % different instances 0011 % replace true if old gene association should be replaced with new 0012 % association. False if new gene association should be 0013 % concatenated to the old association (optional, default true) 0014 % 0015 % model an updated model structure 0016 % 0017 % Usage: changeGeneAssoc(model,rxnID,geneAssoc,replace) 0018 0019 if nargin==3 0020 replace=true; 0021 end 0022 0023 if isstr(rxnID) 0024 rxnID={rxnID}; 0025 end 0026 0027 if ~isstr(geneAssoc) 0028 EM='geneAssoc has to be string'; 0029 error(sprintf(EM)) 0030 end 0031 0032 0033 % Add genes to model 0034 geneList=transpose(cell(unique(regexp(geneAssoc,'[)(]*|( and )*|( or )*','split')))); % Extract individual, unique genes from the geneAssoc provided 0035 geneList=geneList(~cellfun(@isempty, geneList)); 0036 genesToAdd.genes=setdiff(geneList,model.genes); % Only keep the genes that are not yet part of the model.genes. 0037 if ~isempty(genesToAdd.genes) 0038 model=addGenesRaven(model,genesToAdd); % Add genes 0039 end 0040 0041 % Find reaction and gene indices 0042 idx=getIndexes(model,rxnID,'rxns'); 0043 0044 % Change gene associations 0045 if replace==true % Replace old gene associations 0046 model.grRules(idx)=cellstr(geneAssoc); 0047 else % Add gene associations, add new gene rules after 'OR'. 0048 model.grRules(idx)=cellstr('(',[model.grRules{idx},') or (',geneAssoc,')']); 0049 end 0050 0051 %Fix grRules and reconstruct rxnGeneMat 0052 [grRules,rxnGeneMat] = standardizeGrRules(model,true); 0053 model.grRules = grRules; 0054 model.rxnGeneMat = rxnGeneMat; 0055 end