Home > BiKEGG > Weight4TransRxns.m

Weight4TransRxns

PURPOSE ^

Weight4TransRxns

SYNOPSIS ^

function Weight4TransRxns(Idfier)

DESCRIPTION ^

 Weight4TransRxns
 This function generates the Weight4TranRxns.txt file containing all KEGG
 reactions in which there are 2,4 or 6 KEGG compounds, along with their
 corresponding component weights. This text file will be used in Bigg2Kegg
 function to identify potential equivalent KEGG reactions for BiGG
 transport reactions.
 Input:
     - Idfier : A number: 2 | 4 | 6 , respectively denoting transport
     reactions with 2, 4 and 6 components.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Weight4TransRxns(Idfier)
0002 % Weight4TransRxns
0003 % This function generates the Weight4TranRxns.txt file containing all KEGG
0004 % reactions in which there are 2,4 or 6 KEGG compounds, along with their
0005 % corresponding component weights. This text file will be used in Bigg2Kegg
0006 % function to identify potential equivalent KEGG reactions for BiGG
0007 % transport reactions.
0008 % Input:
0009 %     - Idfier : A number: 2 | 4 | 6 , respectively denoting transport
0010 %     reactions with 2, 4 and 6 components.
0011 
0012 % O. Jamialahmadi
0013 % TMU, Chem. Eng. Dept., Biotech. Group
0014 % Jan. 2016
0015 
0016 Fileid = fopen('cpd2rxn.txt','r');
0017 cpd2rxn = textscan(Fileid,'%s %s');
0018 rxnData = strrep(cpd2rxn{2},'rn:','');
0019 cpds = strrep(cpd2rxn{1},'cpd:','');
0020 fclose(Fileid);
0021 % Read cpd2weight ===================
0022 Fileid = fopen('cpd2weight.txt','r');
0023 cpd2weight = textscan(Fileid,'%s %f');
0024 cpd4weight = strrep(cpd2weight{1},'cpd:','');
0025 Weight = cpd2weight{2};
0026 fclose(Fileid);
0027 CurLen = 1; W4CurCpds = ({}); CanRxn = ({});
0028 Pth1 = which ('Bigg2Kegg.m');
0029 tind = find(Pth1=='\',1,'last');
0030 Pth = Pth1(1:tind-1);
0031 
0032 if (Idfier == 2)
0033     fprintf('Generating W4TranRxns2.txt for rxn: ')
0034     Pth1 = [Pth,'\','W4TranRxns2.txt'];
0035     Fid = fopen(Pth1,'w');
0036 elseif (Idfier == 4)
0037     fprintf('Generating W4TranRxns4.txt for rxn: ')
0038     Pth1 = [Pth,'\','W4TranRxns4.txt'];
0039     Fid = fopen(Pth1,'w');
0040 elseif (Idfier == 6)
0041     fprintf('Generating W4TranRxns6.txt for rxn: ')
0042     Pth1 = [Pth,'\','W4TranRxns6.txt'];
0043     Fid = fopen(Pth1,'w');
0044 end
0045 for count = 1:numel(rxnData)
0046     if count>1
0047         for j=0:log10(count-1)
0048             fprintf('\b'); 
0049         end
0050     end
0051     fprintf('%d', count);
0052     TNum = sum(ismember(rxnData,rxnData{count}));
0053     if TNum == Idfier
0054         CurCpds = cpds(ismember(rxnData,rxnData{count}));
0055         W4CurCpdsT = Weight(ismember(cpd4weight,CurCpds));
0056         if numel(W4CurCpdsT) == Idfier && ~any(ismember(CanRxn,rxnData{count})) ...
0057                 && (2.*numel(unique(W4CurCpdsT)) == Idfier)
0058             W4CurCpds{CurLen} = W4CurCpdsT;
0059             CanRxn{CurLen} = rxnData{count};
0060             CurLen = CurLen + 1;
0061         end       
0062     end
0063 end
0064 
0065 if (Idfier == 2)
0066     for ct = 1:numel(W4CurCpds)
0067         fprintf(Fid,'%s\t%f\t%f\n',CanRxn{ct},W4CurCpds{ct});
0068     end
0069 elseif (Idfier == 4)
0070     for ct = 1:numel(W4CurCpds)
0071         fprintf(Fid,'%s\t%f\t%f\t%f\t%f\n',CanRxn{ct},W4CurCpds{ct});
0072     end
0073 elseif (Idfier == 6)
0074     for ct = 1:numel(W4CurCpds)
0075         fprintf(Fid,'%s\t%f\t%f\t%f\t%f\t%f\t%f\n',CanRxn{ct},W4CurCpds{ct});
0076     end
0077 end
0078 fclose(Fid);

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