mapPathwayRxnNames For mapping labels in the pathway object. Useful if you want to change what is shown in the reaction boxes. pathway pathway structure representing the pathway to be drawn originalLabels cell array with the original reaction labels newLabels cell array with the new reaction labels pathway an updated pathway structure notMapped a cell array with labels that could not be found in the pathway object Usage: [pathway notMapped]=mapPathwayRxnNames(pathway,originalLabels,newLabels) Rasmus Agren, 2010-12-16
0001 function [pathway notMapped]=mapPathwayRxnNames(pathway,originalLabels,newLabels) 0002 % mapPathwayRxnNames 0003 % For mapping labels in the pathway object. Useful if you want to change 0004 % what is shown in the reaction boxes. 0005 % 0006 % pathway pathway structure representing the pathway to be drawn 0007 % originalLabels cell array with the original reaction labels 0008 % newLabels cell array with the new reaction labels 0009 % 0010 % pathway an updated pathway structure 0011 % notMapped a cell array with labels that could not be found in the 0012 % pathway object 0013 % 0014 % Usage: [pathway notMapped]=mapPathwayRxnNames(pathway,originalLabels,newLabels) 0015 % 0016 % Rasmus Agren, 2010-12-16 0017 % 0018 0019 if numel(originalLabels)~=numel(newLabels) 0020 throw(MException('','The new label cell array must have the same length as the old label cell array')); 0021 end 0022 0023 mapped=false(numel(originalLabels),1); 0024 0025 for i=1:numel(pathway.listOfSpecies) 0026 if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN') 0027 I=strmatch(pathway.listOfSpecies(i).name,originalLabels,'exact'); 0028 if any(I) 0029 if numel(I)==1 0030 pathway.listOfSpecies(i).name=newLabels{I}; 0031 mapped(I)=true; 0032 else 0033 throw(MException('',['The label "' pathway.listOfSpecies(i).name '" was found in several positions in oldLabels'])); 0034 end 0035 end 0036 end 0037 end 0038 0039 notMapped=originalLabels(~mapped);