Home > . > met_cent_dir_quatexelero.m

met_cent_dir_quatexelero

PURPOSE ^

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

SYNOPSIS ^

function [Output] = met_cent_dir_quatexelero(fileName)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Networks which could be used as an input for QuateXelero Algorithm.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file,
 and builds Directed Metabolite-Metabolite 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] = met_cent_dir_quatexelero(fileName)

INPUTS
 fileName                                 The metabolic Network in the SBML format
 
OUTPUTS
 *_Metabolite_Cent_Dir_Index.dat          Matrix Indeces of Metabolite-Metabolite Connections 
 *_Metabolite_Cent_Dir_QuateXelero.dat    Directed-Metabolite-Metabolite 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] = met_cent_dir_quatexelero(fileName)
0002 % Builds Directed Enzyme-Enzyme Networks which could be used as an input for QuateXelero Algorithm.
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % and builds Directed Metabolite-Metabolite 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] = met_cent_dir_quatexelero(fileName)
0012 %
0013 %INPUTS
0014 % fileName                                 The metabolic Network in the SBML format
0015 %
0016 %OUTPUTS
0017 % *_Metabolite_Cent_Dir_Index.dat          Matrix Indeces of Metabolite-Metabolite Connections
0018 % *_Metabolite_Cent_Dir_QuateXelero.dat    Directed-Metabolite-Metabolite 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 outname=strrep(fileName,'.xml','_Metabolite_Cent_Dir_Index.dat')
0044 fout = fopen(outname, 'w+');
0045 
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0048 % parses through each column, and considers an edge for every unlike-signs,
0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0050 num=zeros(size(model.mets));
0051 for j=1:n
0052     indices=find(model.S(:,j));
0053     [a,b]=size(indices);
0054     r=0;
0055     if a~=0
0056         r=1;
0057     end 
0058     while r<a
0059         i=1;
0060         while i<(a-r+1)
0061             if model.S(indices(r,1),j)<0 && model.S(indices(r+i,1),j)>0
0062                 fprintf(fout,'%d\t%d\n',indices(r,1),indices(r+i,1));
0063                 num(indices(r,1),1)=1;
0064                 num(indices(r+i,1),1)=1;
0065             elseif model.S(indices(r,1),j)>0 && model.S(indices(r+i,1),j)<0
0066                 fprintf(fout,'%d\t%d\n',indices(r+i,1),indices(r,1));
0067                 num(indices(r,1),1)=1;
0068                 num(indices(r+i,1),1)=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:m
0080     if num(k,1)==0
0081         fprintf(fout,'%d\n',k);
0082     end
0083 end
0084 fclose(fout);
0085 
0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0087 % building the output file name
0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089 outname2=strrep(fileName,'.xml','_Metabolite_Cent_Dir_QuateXelero.dat')    
0090 fout2=fopen(outname2,'w+');
0091 
0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0093 % reading the constructed Metabolic-Metabolic network file and re-format it to a QuateXelero-compatible file.
0094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0095 fid = fopen(outname);
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