Description of getKGML

Home > BiKEGG > getKGML.m

# getKGML

## PURPOSE

getKGML

## SYNOPSIS

function getKGML

## DESCRIPTION

     getKGML
     reads and retrieves KGML file and image data of KEGG pathways,
     and stores them in "KEGGmaps" subfolder within FluxPuya folder.

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- PreconsMethod PreconsMethod
- UpdateDBase UpdateDBase(GUI)

## SOURCE CODE

    0001 function getKGML
    0002 % getKGML
    0003 % reads and retrieves KGML file and image data of KEGG pathways,
    0004 % and stores them in "KEGGmaps" subfolder within FluxPuya folder.
    0005
    0006 % O. Jamialahmadi
    0007 % TMU, Chem. Eng. Dept., Biotech. Group
    0008 % Dec. 2015
    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')