Closed WegrzynAB closed 8 years ago
Please make a pull request with these suggested changes: https://help.github.com/articles/creating-a-pull-request/
On 18 February 2016 at 19:16, WegrzynAB notifications@github.com wrote:
I encountered the issue with addReaction.m recently in my work with Recon
- After modifying the model (used removeRxns.m and addReaction.m scripts) I couldn't use the removeRxns.m function anymore as it complained about index exceeding matrix dimensions. Turns out that removeRxns.m were deleting all the information from all the fields in respect to the removed reaction, however addReaction.m did not update certain reaction-related fields in the model (namely: rxnKeggID, rxnConfidenceEcoIDA, rxnConfidenceScores and rxnsboTerm). The same was true for some metabolite-related fields (metCHEBIID, metKeggID, metInchiString, metHepatoNetID, metEHMNID and metHMDB). I have fixed it by including this fields in the if isfield ..end loops in addReaction.m . It is my first post on GitHub so I hope I've put it in a correct place. `% Update model fields model.rxns{rxnID,1} = rxnName; if (revFlag) model.rev(rxnID,1) = 1; else model.rev(rxnID,1) = 0; end model.lb(rxnID,1) = lowerBound; model.ub(rxnID,1) = upperBound; model.c(rxnID,1) = objCoeff;
if (isfield(model,'rxnNames')) if exist('rxnNameFull','var') model.rxnNames{rxnID,1} = rxnNameFull; else model.rxnNames{rxnID,1} = model.rxns{rxnID}; end end if (isfield(model,'subSystems')) model.subSystems{rxnID,1} = subSystem; end if isfield(model,'rxnNotes') model.rxnNotes{rxnID,1} = ''; end if isfield(model,'confidenceScores') model.confidenceScores{rxnID,1} = ''; end if isfield(model,'rxnReferences') model.rxnReferences{rxnID,1} = ''; end if isfield(model,'rxnECNumbers') model.rxnECNumbers{rxnID,1} = ''; end % 17/02/2016 Fixed four additional fields that were not being updated if isfield(model,'rxnKeggID') model.rxnKeggID{rxnID,1} = ''; end if isfield(model,'rxnConfidenceEcoIDA') model.rxnConfidenceEcoIDA{rxnID,1} = ''; end if isfield(model,'rxnConfidenceScores') model.rxnConfidenceScores{rxnID,1} = ''; end if isfield(model,'rxnsboTerm') model.rxnsboTerm{rxnID,1} = ''; end`
% Construct S-matrix column newMetsCoefs=zeros(0); for i = 1:length(metaboliteList) if (isInModel(i)) Scolumn(metID(i),1) = stoichCoeffList(i); else warning(['Metabolite ' metaboliteList{i} ' not in model - added to the model']); Scolumn(end+1,1) = stoichCoeffList(i); model.mets{end+1,1} = metaboliteList{i}; newMetsCoefs(end+1) = stoichCoeffList(i); if (isfield(model,'metNames')) %Prompts to add missing info if desired model.metNames{end+1,1} = regexprep(metaboliteList{i},'([.+]) | ((.+))','') ; warning(['Metabolite name for ' metaboliteList{i} ' set to ' model.metNames{end}]); % model.metNames(end) = cellstr(input('Enter complete metabolite name, if available:', 's')); end if (isfield(model,'metFormulas')) model.metFormulas{end+1,1} = ''; warning(['Metabolite formula for ' metaboliteList{i} ' set to ''''']); % model.metFormulas(end) = cellstr(input('Enter metabolite chemical formula, if available:', 's')); end if isfield(model,'metCHEBIID') model.metCHEBIID{end+1,1} = ''; %changed from metChEBIID to CHEBIID as this is how this field is named in Recon2 end if isfield(model,'metKeggID') model.metKeggID{end+1,1} = ''; %changed end if isfield(model,'metPubChemID') model.metPubChemID{end+1,1} = ''; end if isfield(model,'metInchiString') model.metInchiString{end+1,1} = ''; %changed end if isfield(model,'metCharge') model.metCharge(end+1,1) = 0; end if isfield(model,'metHepatoNetID') model.metHepatoNetID{end+1,1} = ''; %added end if isfield(model,'metEHMNID') model.metEHMNID{end+1,1} = ''; %added end if isfield(model,'metHMDB') model.metHMDB{end+1,1} = ''; %added end end end
— Reply to this email directly or view it on GitHub https://github.com/opencobra/cobratoolbox/issues/114.
Senior research associate (EN) == Chercheur (FR), Principal investigator, Systems Biochemistry Group, wwwen.uni.lu/lcsb/research/systems_biochemistry Luxembourg Centre for Systems Biomedicine, University of Luxembourg, Campus Belval, 6, avenue du Swing, L-4367 Belvaux. & National Centre of Excellence in Research on Parkinson’s disease www.parkinson.lu & Adjunct Assistant Professor, Division of Analytical Biosciences, Leiden Academic Centre for Drug Research, Faculty of Science, University of Leiden.
Mobile: +352 621 175 112 Office: +352 466 644 5528
(This message is confidential and may contain privileged information. It is intended for the named recipient only. If you receive it in error please notify me and permanently delete the original message and any copies.)
I encountered the issue with addReaction.m recently in my work with Recon 2. After modifying the model (used removeRxns.m and addReaction.m scripts) I couldn't use the removeRxns.m function anymore as it complained about index exceeding matrix dimensions. Turns out that removeRxns.m were deleting all the information from all the fields in respect to the removed reaction, however addReaction.m did not update certain reaction-related fields in the model (namely: rxnKeggID, rxnConfidenceEcoIDA, rxnConfidenceScores and rxnsboTerm). The same was true for some metabolite-related fields (metCHEBIID, metKeggID, metInchiString, metHepatoNetID, metEHMNID and metHMDB). I have fixed it by including this fields in the if isfield ..end loops in addReaction.m . It is my first post on GitHub so I hope I've put it in a correct place.