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 07/16/2016 http://yazdan59.ir/scan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 07/16/2016 http://yazdan59.ir/scan 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 % It also consider Reversibility for Enzyme-Enzyme network. 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 num=zeros(size(model.rxns)); 0053 for j=1:m 0054 indices=find(model.S(j,:)); 0055 [a,b]=size(indices); 0056 r=0; 0057 if b~=0 0058 r=1; 0059 end 0060 while r<b 0061 i=1; 0062 while i<(b-r+1) 0063 if model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0 0064 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1 0065 fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i)); 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 else 0070 fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i)); 0071 num(1,indices(1,r))=1; 0072 num(1,indices(1,r+i))=1; 0073 end 0074 elseif model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0 0075 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1 0076 fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r)); 0077 fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i)); 0078 num(1,indices(1,r))=1; 0079 num(1,indices(1,r+i))=1; 0080 else 0081 fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r)); 0082 num(1,indices(1,r))=1; 0083 num(1,indices(1,r+i))=1; 0084 end 0085 end 0086 i=i+1; 0087 end 0088 r=r+1; 0089 end 0090 end 0091 0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0093 % building the output file name 0094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0095 outname2=strrep(fileName,'.xml','_Enzyme_Cent_Dir_Kavosh.dat') 0096 fout2=fopen(outname2,'w+'); 0097 0098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0099 % reading the constructed Enzyme-Enzyme network file and re-format it to a Kavosh-compatible file. 0100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0101 fid = fopen(outname1); 0102 C=fscanf(fid,'%d'); 0103 i=1; 0104 while isinteger(fid) 0105 C(i)=fscanf(fid,'%d',C); 0106 i=i+1; 0107 end 0108 g=size(C); 0109 A=size(unique(C)); 0110 if g~=0 0111 n=1; 0112 else 0113 disp('Error in reading the file, No Edge detected') 0114 end 0115 k=1; 0116 j=2; 0117 last=g/2; 0118 fprintf(fout2,'%d\n',A(1,1)); % total number of uniques nodes in the network (needed for Kavosh Algorithm) 0119 for i=1:last 0120 fprintf(fout2,'%d\t%d\n ',C(k),C(j)); 0121 k=k+2; 0122 j=j+2; 0123 end 0124 fclose(fid); 0125 fclose(fout2); 0126 0127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0128 % End of time evaluation of program 0129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0130 toc; 0131