Counts Metabolite and Enzyme degree distribution over networks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The function reads a Metabolic Network SBML file, builds Undirected Metabolite-Metabolite and Enzyme-Enzyme Networks. Then, counts Metabolite and Enzyme degree distribution over these networks, Note: COBRA Toolbox must be installed in MATLAB before running this function [Output] = degree_cent(fileName) INPUTS fileName The metabolic Network in the SBML format OUTPUTS *_Metabolite_Cent_Degree_Dist.dat Metabolite degree distribution (of the undirected Network) *_Enzyme_Cent_Degree_Dist.dat Enzyme degree distribution (of the undirected Network) Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = degree_dist(fileName) 0002 % Counts Metabolite and Enzyme degree distribution over networks 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % The function reads a Metabolic Network SBML file, 0005 % builds Undirected Metabolite-Metabolite and Enzyme-Enzyme Networks. 0006 % Then, counts Metabolite and Enzyme degree distribution over these networks, 0007 % Note: COBRA Toolbox must be installed in MATLAB before running this function 0008 % 0009 % [Output] = degree_cent(fileName) 0010 % 0011 %INPUTS 0012 % fileName The metabolic Network in the SBML format 0013 % 0014 %OUTPUTS 0015 % *_Metabolite_Cent_Degree_Dist.dat Metabolite degree distribution (of the undirected Network) 0016 % *_Enzyme_Cent_Degree_Dist.dat Enzyme degree distribution (of the undirected Network) 0017 % 0018 % Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 % check validity of input file format 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 check=regexp(fileName,'.xml'); 0025 assert(~isempty(check),'The fileName must contain .xml at its end') 0026 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 % start time evaluation of program 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 tic; 0031 0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 % reading the SBML file using COBRA Toolbox Command 0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0035 model=readCbModel(fileName); 0036 0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0038 % construction of Binary Stoichiometric Matrix 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 S_bin=zeros(size(model.S)); 0041 S_bin(find(model.S))=1; 0042 0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0044 % construction of Undirected-Metabolite-Metabolite Network 0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0046 Acomp=S_bin*S_bin'; 0047 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 % construction of Undirected-Enzyme-Enzyme Network 0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0051 Aenz=S_bin'*S_bin; 0052 0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0054 % reading a Metabolic-Metabolic comma separated file 0055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0056 0057 [m,n]=size(Acomp); 0058 outname1=strrep(fileName,'.xml','_Metabolite_Cent_Degree_Dist.dat') 0059 fout = fopen(outname1, 'w+'); 0060 fprintf(fout, 'Metabolite\t\tDegree\n'); 0061 fprintf(fout, '----------------------------------------------\n'); 0062 j=0; 0063 for row=1:m 0064 i=0; 0065 for col=1:n 0066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0067 % edge are those which includes number not equal to zero 0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0069 if Acomp(row,col)~=0 0070 i=i+1; 0071 end 0072 end 0073 fprintf(fout, '%s\t\t%d\n',model.mets{row},i); 0074 j=j+i; 0075 end 0076 fclose(fout); 0077 0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0079 % reading a Enzyme-Enzyme comma separated file 0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0081 [g,h]=size(Aenz); 0082 outname2=strrep(fileName,'.xml','_Enzyme_Cent_Degree_Dist.dat') 0083 fout2 = fopen(outname2, 'w+'); 0084 fprintf(fout2, 'Reaction\t\tDegree\n'); 0085 fprintf(fout2, '----------------------------------------------\n'); 0086 jj=0; 0087 for row=1:g 0088 ii=0; 0089 for col=1:h 0090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0091 % edge are those which includes number not equal to zero 0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0093 if Aenz(row,col)~=0 0094 ii=ii+1; 0095 end 0096 end 0097 fprintf(fout2, '%s\t\t%d\n',model.rxns{row},ii); 0098 jj=jj+ii; 0099 end 0100 fclose(fout2); 0101 0102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0103 % End of time evaluation of program 0104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0105 toc;