Builds Undirected Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The function reads a Metabolic Network SBML file and builds an Undirected Enzyme-Enzyme Network. For every metabolite, the algorithm checks availability in the Library file which has been prepared by user as input in .txt format). and removes if it exists in the library file. Then the Undirected Enzyme-Enzyme Network will be created. Note: COBRA Toolbox must be installed in MATLAB before running this function [Output] = enz_cent_Lib(fileName1,fileName2) INPUTS fileName1 The Library file includes pre-defined currency metabolites (in .txt format) Note: Library text file must include one metabolites per line (all in one column) fileName2 The metabolic Network in the SBML format OUTPUTS *_Removed_Mets_Lib.dat file contains removed metabolits from the original model *_Enzyme_Cent_Lib.dat Undirected-Enzyme-Enzyme Network (comma separated Format) *_Enzyme_Cent_Lib_Cyt.dat Undirected-Enzyme-Enzyme Network - Cytoscape Compatible Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = enz_cent_Lib(fileName1,fileName2) 0002 % Builds Undirected Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % The function reads a Metabolic Network SBML file and builds an Undirected Enzyme-Enzyme Network. 0005 % For every metabolite, the algorithm checks availability in the Library file which has been prepared by user as input in .txt format). 0006 % and removes if it exists in the library file. Then the Undirected Enzyme-Enzyme Network will be created. 0007 % Note: COBRA Toolbox must be installed in MATLAB before running this function 0008 % 0009 % [Output] = enz_cent_Lib(fileName1,fileName2) 0010 % 0011 %INPUTS 0012 % fileName1 The Library file includes pre-defined currency metabolites (in .txt format) 0013 % Note: Library text file must include one metabolites per line (all in one column) 0014 % fileName2 The metabolic Network in the SBML format 0015 % 0016 %OUTPUTS 0017 % *_Removed_Mets_Lib.dat file contains removed metabolits from the original model 0018 % *_Enzyme_Cent_Lib.dat Undirected-Enzyme-Enzyme Network (comma separated Format) 0019 % *_Enzyme_Cent_Lib_Cyt.dat Undirected-Enzyme-Enzyme Network - Cytoscape Compatible 0020 % 0021 % Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir 0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0023 0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0025 % check validity of input files format 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 check1=regexp(fileName1,'.txt'); 0028 assert(~isempty(check1),'Error in the first input: The fileName1 must contain .txt at its end') 0029 check2=regexp(fileName2,'.xml'); 0030 assert(~isempty(check2),'Error in the second input: The fileName2 must contain .xml at its end') 0031 0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 % start time evaluation of program 0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0035 tic; 0036 0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0038 % reading the Library text file and construct array of currency metabolites 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 fid = fopen(fileName1); 0041 tline = fgetl(fid); 0042 i=1; 0043 Curr_met={}; 0044 while ischar(tline) 0045 Curr_met{i,1}=tline; 0046 tline = fgetl(fid); 0047 i=i+1; 0048 end 0049 fclose(fid); 0050 [h,g]=size(Curr_met); 0051 0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0053 % reading the SBML file using COBRA Toolbox Command, and sets size of the S matrix 0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0055 model=readCbModel(fileName2); 0056 [m,n]=size(model.S); 0057 0058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0059 % reading the Metabolites array and check their availability in the library text file 0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0061 N_curr=zeros(m,1); 0062 for q=1:m 0063 for i=1:h 0064 if strcmp(model.metNames{q},Curr_met{i,1})==1 0065 N_curr(q,1)=N_curr(q,1)+1; 0066 end 0067 end 0068 end 0069 0070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0071 % building the output file name for writing removed metabolites 0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0073 outname1=strrep(fileName2,'.xml','_Removed_Mets_Lib.dat') 0074 fout1 = fopen(outname1, 'w+'); 0075 fprintf(fout1, 'Metabolite\t\tMetabolite Name\n'); 0076 fprintf(fout1, '------------------------------\n'); 0077 0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0079 % Remove metabolites which are in the input Currecny Metabolites list 0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0081 for q=1:m 0082 if N_curr(q,1)~=0 0083 for i=1:n 0084 model.S(q,i)=0; 0085 end 0086 fprintf(fout1,'%s\t\t%s\n',model.mets{q},model.metNames{q}); 0087 end 0088 end 0089 0090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0091 % construction of Binary Stoichiometric Matrix from the new S-matrix(comma separated Format) 0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0093 S_bin=zeros(size(model.S)); 0094 S_bin(find(model.S))=1; 0095 0096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0097 % construction of Undirected-Enzyme-Enzyme Network based on the binary S-matrix(comma separated Format) 0098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0099 Aenz=S_bin'*S_bin; 0100 outname2=strrep(fileName2,'.xml','_Enzyme_Cent_Lib.dat') 0101 dlmwrite(outname2,full(Aenz)); 0102 0103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0104 % re-format of Undirected-Enzyme-Enzyme Network it to a Cytoscape-compatible file. 0105 % One could import the file using "File/Import/Network from Table(Text/MS Excel)..." 0106 % Select "first column" as "Source Interaction" and "second column" as "Target Interaction" 0107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0108 [m,n]=size(Aenz); 0109 outname3=strrep(fileName2,'.xml','_Enzyme_Cent_Lib_Cyt.dat') 0110 fout2 = fopen(outname3, 'w+'); 0111 for row=1:m 0112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0113 % because cell(i,j)=cell(j,i) we must delete duplicate entries by putting 0114 % col=row:n in the second if command. since we must ignor diagonal elements, 0115 % the counter will be col=row+1:n 0116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0117 for col=row+1:n 0118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0119 % edge are those which includes number not equal to zero 0120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0121 if Aenz(row,col)~=0 0122 fprintf(fout2, '%s\t%s\t%d\n',model.rxns{row},model.rxns{col},Aenz(row,col)); 0123 end 0124 end 0125 end 0126 fclose(fout1); 0127 fclose(fout2); 0128 0129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0130 % End of time evaluation of program 0131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0132 toc; 0133