Home > BiKEGG > MultiRxnsLib.m

MultiRxnsLib

PURPOSE ^

MultiRxnsLib

SYNOPSIS ^

function MultiRxnsLib

DESCRIPTION ^

 MultiRxnsLib
 generates shared multi-step reactions among all models saved
 in Bigg2Kegg folder. This list is used in both function UniModel and
 MultiRxns
 
 O. Jamialahmadi
 TMU, Chem. Eng. Dept., Biotech. Group 
 Jan. 2015

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function MultiRxnsLib
0002 % MultiRxnsLib
0003 % generates shared multi-step reactions among all models saved
0004 % in Bigg2Kegg folder. This list is used in both function UniModel and
0005 % MultiRxns
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;
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         ct1 = ct1 + 1;
0024     end
0025 end
0026 BM = ({}); NotBM = ({}); NotKM = ({});
0027 for count =1:numel(BNames)
0028     load(fullfile(Pth3,BNames{count}))
0029     B=B2Kegg.B;K=B2Kegg.K;
0030     MltLoci = find(ismember(B,'MULTIR'));
0031     NotBM1 = B(1:MltLoci-1); NotKM1 = K(1:MltLoci-1);
0032     BM1 = B(MltLoci+1:end); 
0033     NonOverlp = ~ismember(BM1,BM);
0034     BM1 = BM1(NonOverlp);
0035     [NotBM1,NotKM1] = Rxnfinder(BM1,NotBM1,NotKM1);
0036     Len = numel(BM)+1:numel(BM1)+numel(BM);
0037     clear B2Kegg
0038     BM(Len) = BM1; 
0039     if ~isempty(NotBM1)
0040         Len1 = numel(NotBM)+1:numel(NotBM1)+numel(NotBM);
0041         NotBM(Len1) = NotBM1; NotKM(Len1) = NotKM1;
0042     end
0043 end
0044 [ParentRxn,ChildRxns] = MultiRxns(NotKM);
0045 Multirxns.P = ParentRxn; Multirxns.C = ChildRxns;
0046 save ([Pth3,'\Multirxns.mat'],'Multirxns')
0047 clear
0048 disp('Multi Reactions Library has been generated successfully!')
0049 %--------------------------------------------------------------------------
0050 function [NotBM,NotKM] =  Rxnfinder(BM1,NotBM1,NotKM1)
0051 count = 1; NotBM = ({}); NotKM = ({});
0052 while numel(BM1)
0053     Tfind = find(ismember(BM1,BM1{1}));
0054     Tfind1 = find(ismember(NotBM1,BM1{Tfind(1)}));
0055     for ct = 1:numel(Tfind1)
0056         NotBM{count} = NotBM1{Tfind1(ct)};
0057         NotKM{count} = NotKM1{Tfind1(ct)};
0058         count = count + 1;
0059     end
0060     BM1(Tfind) = [];
0061 end

Generated on Sat 16-Jul-2016 20:21:30 by m2html © 2005