Home > . > enz_cent_dir_kavosh.m

enz_cent_dir_kavosh

PURPOSE ^

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

SYNOPSIS ^

function [Output] = enz_cent_dir_kavosh(fileName)

DESCRIPTION ^

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

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