Builds Directed Metabolite-Metabolite Networks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The function reads a Metabolic Network SBML file, and builds Directed Metabolite-Metabolite Networks. Note: COBRA Toolbox must be installed in MATLAB before running this function [Output] = met_cent_dir(fileName) INPUTS fileName The metabolic Network in the SBML format OUTPUTS *_Metabolite_Cent_Dir_Cyt.sif Directed-Metabolite-Metabolite Network - Cytoscape Compatible (.sif file) Yazdan Asgari 07/16/2016 http://yazdan59.ir/scan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = met_cent_dir(fileName) 0002 % Builds Directed Metabolite-Metabolite Networks 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % The function reads a Metabolic Network SBML file, 0005 % and builds Directed Metabolite-Metabolite Networks. 0006 % Note: COBRA Toolbox must be installed in MATLAB before running this function 0007 % 0008 % [Output] = met_cent_dir(fileName) 0009 % 0010 %INPUTS 0011 % fileName The metabolic Network in the SBML format 0012 % 0013 %OUTPUTS 0014 % *_Metabolite_Cent_Dir_Cyt.sif Directed-Metabolite-Metabolite Network - Cytoscape Compatible (.sif file) 0015 % 0016 % Yazdan Asgari 07/16/2016 http://yazdan59.ir/scan 0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0018 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % check validity of input file format 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 check=regexp(fileName,'.xml'); 0023 assert(~isempty(check),'The SBML fileName must contain .xml at its end') 0024 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 % start time evaluation of program 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 tic; 0029 0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 % reading the Library text file and construct array of carriors of electrons , protons and energy 0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 fid = fopen('carr_mets.txt'); 0034 tline = fgetl(fid); 0035 i=1; 0036 Curr_met={}; 0037 while ischar(tline) 0038 Curr_met{i,1}=tline; 0039 tline = fgetl(fid); 0040 i=i+1; 0041 end 0042 fclose(fid); 0043 [h,g]=size(Curr_met); 0044 0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0046 % reading the SBML file using COBRA Toolbox Command 0047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0048 model=readCbModel(fileName); 0049 [m,n]=size(model.S); 0050 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 % building the output file name 0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0054 outname=strrep(fileName,'.xml','_Metabolite_Cent_Dir_Cyt.sif') 0055 fout = fopen(outname, 'w+'); 0056 0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0058 % finds non-zero elements of the S-matrix (in order to make the algorithm faster), 0059 % parses through each column, and considers an edge for every unlike-signs. 0060 % It also consider Reversibility for Enzyme-Enzyme network. 0061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0062 for j=1:n 0063 indices=find(model.S(:,j)); 0064 [a,b]=size(indices); 0065 r=0; 0066 if a~=0 0067 r=1; 0068 end 0069 while r<a 0070 i=1; 0071 while i<(a-r+1) 0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0073 % reading every metabolite and check its availability in the carriors metabolites text file 0074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0075 N=0; 0076 for k=1:h 0077 if strcmp(model.metNames{indices(r,1)},Curr_met{k,1})==1 0078 N=1; 0079 break 0080 elseif strcmp(model.metNames{indices(r+i,1)},Curr_met{k,1})==1 0081 N=1; 0082 break 0083 end 0084 end 0085 if model.S(indices(r,1),j)<0 && model.S(indices(r+i,1),j)>0 0086 if model.rev(j)==1 && N==0 0087 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)}); 0088 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)}); 0089 else 0090 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)}); 0091 end 0092 elseif model.S(indices(r,1),j)>0 && model.S(indices(r+i,1),j)<0 0093 if model.rev(j)==1 && N==0 0094 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)}); 0095 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)}); 0096 else 0097 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)}); 0098 end 0099 end 0100 i=i+1; 0101 end 0102 r=r+1; 0103 end 0104 end 0105 fclose(fout); 0106 0107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0108 % End of time evaluation of program 0109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0110 toc;