Home > . > enz_cent_dir_quatexelero.m

enz_cent_dir_quatexelero

PURPOSE ^

Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.

SYNOPSIS ^

function [Output] = enz_cent_dir_quatexelero(fileName)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file,
 and builds Directed Enzyme-Enzyme Networks which is compatible with QuateXelero Algorithm.
 The QuateXelero is one of the best motif finding algorithms which is recently developed by Kavosh developer team.
 http://lbb.ut.ac.ir/Download/LBBsoft/QuateXelero
 So, one could easily use this algorithm in order to find motifs in different sizes for the metabolic network.
 Note: COBRA Toolbox must be installed in MATLAB before running this function

 [Output] = enz_cent_dir_quatexelero(fileName)

INPUTS
 fileName                             The metabolic Network in the SBML format
 
OUTPUTS
 *_Enzyme_Cent_Dir_Index.dat          Matrix Indeces of Enzyme-Enzyme Connections 
 *_Enzyme_Cent_Dir_QuateXelero.dat    Directed-Enzyme-Enzyme Network - QuateXelero Compatible
 
 Yazdan Asgari 12/07/2012          http://lbb.ut.ac.ir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Output] = enz_cent_dir_quatexelero(fileName)
0002 % Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % and builds Directed Enzyme-Enzyme Networks which is compatible with QuateXelero Algorithm.
0006 % The QuateXelero is one of the best motif finding algorithms which is recently developed by Kavosh developer team.
0007 % http://lbb.ut.ac.ir/Download/LBBsoft/QuateXelero
0008 % So, one could easily use this algorithm in order to find motifs in different sizes for the metabolic network.
0009 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0010 %
0011 % [Output] = enz_cent_dir_quatexelero(fileName)
0012 %
0013 %INPUTS
0014 % fileName                             The metabolic Network in the SBML format
0015 %
0016 %OUTPUTS
0017 % *_Enzyme_Cent_Dir_Index.dat          Matrix Indeces of Enzyme-Enzyme Connections
0018 % *_Enzyme_Cent_Dir_QuateXelero.dat    Directed-Enzyme-Enzyme Network - QuateXelero Compatible
0019 %
0020 % Yazdan Asgari 12/07/2012          http://lbb.ut.ac.ir
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 % check validity of input file format
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 check=regexp(fileName,'.xml');
0027 assert(~isempty(check),'The SBML fileName must contain .xml at its end')
0028 
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 % start time evaluation of program
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 tic;
0033 
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 % reading the SBML file using COBRA Toolbox Command
0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0037 model=readCbModel(fileName);
0038 [m,n]=size(model.S);
0039 
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041 % building the output file name
0042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 outname1=strrep(fileName,'.xml','_Enzyme_Cent_Dir_Index.dat')
0044 fout1 = fopen(outname1, 'w+');
0045 
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0048 % parses through each row, and considers an edge for every unlike-signs,
0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0050 num=zeros(size(model.rxns));
0051 for j=1:m
0052     indices=find(model.S(j,:));
0053     [a,b]=size(indices);
0054     r=0;
0055     if b~=0
0056         r=1;
0057     end 
0058     while r<b
0059         i=1;
0060         while i<(b-r+1)
0061             if model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0
0062                 fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i));
0063                 num(1,indices(1,r))=1;
0064                 num(1,indices(1,r+i))=1;
0065             elseif model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0
0066                 fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r));
0067                 num(1,indices(1,r))=1;
0068                 num(1,indices(1,r+i))=1;
0069             end
0070             i=i+1;
0071         end
0072         r=r+1;
0073     end
0074 end
0075 
0076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077 % considering nodes which do not contain any edges
0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0079 for k=1:n
0080     if num(k,1)==0
0081         fprintf(fout1,'%d\n',k);
0082     end
0083 end
0084 fclose(fout1);
0085 
0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0087 % building the output file name
0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089 outname2=strrep(fileName,'.xml','_Enzyme_Cent_Lib_Dir_QuateXelero.dat')    
0090 fout2=fopen(outname2,'w+');
0091 
0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0093 % reading the constructed Enzyme-Enzyme network file and re-format it to a QuateXelero-compatible file.
0094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0095 fid = fopen(outname1);
0096 fgetl(fid);
0097 C=fscanf(fid,'%d');
0098 i=1;
0099 while isinteger(fid)
0100     C(i)=fscanf(fid,'%d',C);
0101     i=i+1;
0102 end
0103 g=size(C);
0104 A=size(unique(C));
0105 if g~=0
0106     n=1;
0107 else
0108     disp('Error in reading the file, No Edge detected')
0109 end
0110 k=1;
0111 j=2;
0112 last=g/2;
0113 fprintf(fout2,'%d\n',A(1,1));   % total number of uniques nodes in the network (needed for QuateXelero Algorithm)
0114 for i=1:last
0115     fprintf(fout2,'%d\t%d\n ',C(k),C(j));
0116     k=k+2;
0117     j=j+2;
0118 end
0119 fclose(fid);
0120 fclose(fout2);
0121 
0122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0123 % End of time evaluation of program
0124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0125 toc;
0126

Generated on Thu 13-Dec-2012 14:17:37 by m2html © 2005