Description of UniModel

Home > BiKEGG > UniModel.m

# UniModel

## PURPOSE

UiModel

## SYNOPSIS

function UniModel

## DESCRIPTION

     UiModel
     generates one unified model containing all shared reaction among
     all BiGG models in Bigg2Kegg folder. This model is of use in cases where
     user wants not to use a special BiGG model, or a new model is in hand.

     O. Jamialahmadi
     TMU, Chem. Eng. Dept., Biotech. Group
     Jan. 2015

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function UniModel
    0002 % UiModel
    0003 % generates one unified model containing all shared reaction among
    0004 % all BiGG models in Bigg2Kegg folder. This model is of use in cases where
    0005 % user wants not to use a special BiGG model, or a new model is in hand.
    0006 %
    0007 % O. Jamialahmadi
    0008 % TMU, Chem. Eng. Dept., Biotech. Group
    0009 % Jan. 2015
    0010
    0011 Pth1 = which ('Bigg2Kegg.m');
    0012 tind = find(Pth1=='\',1,'last');
    0013 Pth = Pth1(1:tind-1);
    0014 Pth2 = fullfile(Pth,'BiGG2KEGG\*.mat');
    0015 Pth3 = fullfile(Pth,'BiGG2KEGG');
    0016 BMatfiles = dir(Pth2);
    0017 BNames = cell(numel(BMatfiles)-2,1);
    0018 ct1 = 1; NewB = ({}); NewK = ({});
    0019 for ct = 1:numel(BMatfiles)
    0020     if ~strcmp(BMatfiles(ct).name,'BiGG2KEGG_HMRbased-RECON1.mat') && ...
    0021             ~strcmp(BMatfiles(ct).name,'Multirxns.mat')
    0022         BNames{ct1} = BMatfiles(ct).name;
    0023         load(fullfile(Pth3,BNames{ct1}))
    0024         B=B2Kegg.B;K=B2Kegg.K;
    0025         Mlt = find(ismember(B,'MULTIR'));
    0026         if ~isempty(Mlt)
    0027             TB = B(1:Mlt-1); TK = K(1:Mlt-1);
    0028         end
    0029         if isempty(NewB)
    0030             NewB = TB; NewK = TK;
    0031         else
    0032             NotB = TB(~ismember(TB,NewB));
    0033             NotK = TK(~ismember(TB,NewB));
    0034             NewLen = numel(NewB)+1:numel(NotB)+numel(NewB);
    0035             NewB(NewLen) = NotB; NewK(NewLen) = NotK;
    0036         end
    0037         clear B2Kegg
    0038         ct1 = ct1 + 1;
    0039     end
    0040 end
    0041 Len1 = numel(NewB);
    0042 NewB{Len1+1} = 'MULTIR';
    0043 NewK{Len1+1} = 'MULTIR';
    0044 load(fullfile(Pth3,'Multirxns.mat'))
    0045 Pr = Multirxns.P; Cr = Multirxns.C;
    0046 clear Multirxns
    0047 for c1 = 1:numel(Pr)
    0048     TempN = NewB(ismember(NewK,Pr{c1}));
    0049     TempC = Cr{c1};
    0050     Len = numel(TempC);
    0051     for c2 = 1:numel(TempN)
    0052         Len1 = numel(NewB);
    0053         Len2 = Len1 + 1: Len1 + Len;
    0054         NewB(Len2) = TempN(c2);
    0055         NewK(Len2) = TempC;
    0056     end
    0057 end
    0058 B2Kegg.B = NewB; B2Kegg.K = NewK;
    0059 fname = fullfile(Pth3,'UniModelKEGG.mat');
    0060 save (fname,'B2Kegg')