Description of corrAnalyzer

Home > BiKEGG > corrAnalyzer.m

# corrAnalyzer

## PURPOSE

corrAnalyzer

## SYNOPSIS

function corr = corrAnalyzer

## DESCRIPTION

     corrAnalyzer
     compares the reconciled reactions in BiGG and KEGG databases
     taken from MetaNetX repository and BiKEGG (specifically, Bigg2Kegg
     function).
     WARNING: To execute this function, you need to include all BiGG models
     in a folder named "BiGG Models".

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function corr = corrAnalyzer
    0002 % corrAnalyzer
    0003 % compares the reconciled reactions in BiGG and KEGG databases
    0004 % taken from MetaNetX repository and BiKEGG (specifically, Bigg2Kegg
    0005 % function).
    0006 % WARNING: To execute this function, you need to include all BiGG models
    0007 % in a folder named "BiGG Models".
    0008
    0009 % O. Jamialahmadi
    0010 % TMU, Chem. Eng. Dept., Biotech. Group
    0011 % Apr. 2016
    0012
    0013
    0014 clc
    0015 Pth1 = which ('Bigg2Kegg.m');
    0016 tind = find(Pth1=='\',1,'last');
    0017 Pth = Pth1(1:tind-1);
    0018 Pth2 = fullfile(Pth,'BiGG2KEGG\*.mat');
    0019 Pth3 = fullfile(Pth,'BiGG2KEGG');
    0020 Pth22 = fullfile(Pth,'BiGG Models\*.xml');
    0021 Pth33 = fullfile(Pth,'BiGG Models');
    0022
    0023 % Read MetaNetX data
    0024 Fileid = fopen(fullfile(Pth,'MetaNetX.txt'),'r');
    0025 rawmetanet = textscan(Fileid,'%s %[^\n]');
    0026 fclose(Fileid);
    0027 metaid = rawmetanet{2}; metaref = rawmetanet{1};
    0028 metabigg = regexp(metaref,'bigg:\w*');
    0029 metabigg = ~cellfun('isempty',metabigg);
    0030 metabigg1 = metaid(metabigg);
    0031 for ct = 1:numel(metabigg1)
    0032     metabigg11(ct) = cellstr(metabigg1{ct});
    0033 end
    0034 clear metabigg1
    0035 metabigg1 = metabigg11;
    0036 metabigg = metaref(metabigg); metabigg = strrep(metabigg,'bigg:','');
    0037 metakegg = regexp(metaref,'kegg:\w*');
    0038 metakegg = ~cellfun('isempty',metakegg);
    0039 metakegg1 = metaid(metakegg);
    0040 for ct = 1:numel(metakegg1)
    0041     metakegg11(ct) = cellstr(metakegg1{ct});
    0042 end
    0043 clear metakegg1
    0044 metakegg1 = metakegg11;
    0045 metakegg = metaref(metakegg); metakegg = strrep(metakegg,'kegg:','');
    0046 clear metaref metaid rawmetanet metakegg11 metabigg11
    0047 netbigg = metabigg(ismember(metabigg1,metakegg1));
    0048 ct2 = 1; netkegg = ({});
    0049 for ct = 1:numel(metabigg1)
    0050     netloci = find(ismember(metakegg1,metabigg1{ct}));
    0051     if ~isempty(netloci)
    0052         for ct1 = 1:numel(netloci)
    0053             netkegg{ct2}{ct1} = metakegg{netloci(ct1)};
    0054         end
    0055         ct2 = ct2 + 1;
    0056     end
    0057 end
    0058
    0059 % Read data from bigg2kegg
    0060 BMatfiles = dir(Pth2);
    0061 BMatfiles1 = dir(Pth22);
    0062 xmlname1 = struct2cell(BMatfiles1);
    0063 xmlname = xmlname1(1,:);
    0064 xmlname = strrep(xmlname,'.xml','');
    0065 ct1 = 1;
    0066 for ct = 1:numel(BMatfiles)
    0067     if ~strcmp(BMatfiles(ct).name,'BiGG2KEGG_HMRbased-RECON1.mat') && ...
    0068             ~strcmp(BMatfiles(ct).name,'Multirxns.mat') && ...
    0069             ~strcmp(BMatfiles(ct).name,'UniModelKEGG.mat')
    0070         BNames = BMatfiles(ct).name;
    0071         btempname = BNames(1:end-8);
    0072         load(fullfile(Pth3,BNames))
    0073         B=B2Kegg.B;K=B2Kegg.K;
    0074         modelname = xmlname(ismember(xmlname,btempname));
    0075         model = readCbModel(fullfile(Pth33,[modelname{1},'.xml']));
    0076         modelrxn = model.rxns;
    0077         currnetkegg = netkegg(ismember(netbigg,modelrxn));
    0078         metxn = numel(currnetkegg);
    0079         bikegg = sum(ismember(modelrxn,B));
    0080         corr(ct1).m = metxn; corr(ct1).bi = bikegg;
    0081         corr(ct1).mRxns = netbigg(ismember(netbigg,modelrxn)); corr(ct1).biRxns = modelrxn(ismember(modelrxn,B));
    0082         corr(ct1).bRxns = currnetkegg;
    0083         names{ct1} = modelname{1};
    0084         clear B2Kegg
    0085         ct1 = ct1 + 1;
    0086     end
    0087 end