0001 function getKGML
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 Fileid2 = fopen('KEGGmaps.txt','r');
0011 TempMaps = textscan(Fileid2,'%s %[^\n]');
0012 TempMaps1 = cell(size(TempMaps{1},1),1);
0013 for count = 1:size(TempMaps{1},1)
0014     TempMaps1{count}=[TempMaps{1}{count},' ',TempMaps{2}{count}];
0015 end
0016 TempMaps1 = strrep(TempMaps1,'path:map','');
0017 MapNme = regexp(TempMaps1,'\d{5}','match');
0018 MapNme = [MapNme{:}];
0019 Pth1 = which ('Bigg2Kegg.m');
0020 tind = find(Pth1=='\',1,'last');
0021 Pth = Pth1(1:tind-1);
0022 ctYes = 1; ctNo = 1;
0023 for count = 1:numel(MapNme)
0024     Link=['http://rest.kegg.jp/get/rn',MapNme{count},'/kgml'];
0025     ImgLink=['http://www.kegg.jp/kegg/pathway/map/map',MapNme{count},'.png'];
0026     I=imread(ImgLink);
0027     [Dat,Stat1]=urlread(Link);
0028     if ~Stat1
0029         fprintf('%d-Error:No data was found for map%s\n',ctNo,MapNme{count});
0030         ctNo = ctNo + 1;
0031         continue
0032     else
0033         save([Pth,'\KEGGmaps\',MapNme{count},'.mat'],'Dat','I');
0034         fprintf('%d-Map%s data was saved successfully to KEGGmaps folder\n'...
0035             ,ctYes,MapNme{count});
0036         ctYes = ctYes + 1;
0037     end
0038 end
0039 DateCrt = date;
0040 save([Pth,'\KEGGmaps\VersionDate.mat'],'DateCrt')