Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) and considering single nodes (without any edges) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The function reads a Metabolic Network SBML file and builds an Directed 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 Directed Enzyme-Enzyme Network will be created. This file also contains single nodes (without any edges) in Cytoscape-compatible files. Note: COBRA Toolbox must be installed in MATLAB before running this function [Output] = enz_cent_Lib_dir_single_node(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 *_Enzyme_Cent_Lib_Dir_Single_Node_Cyt.sif Directed-Enzyme-Enzyme Network - Cytoscape Compatible Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = enz_cent_Lib_dir_single_node(fileName1,fileName2) 0002 % Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) and considering single nodes (without any edges) 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % The function reads a Metabolic Network SBML file and builds an Directed 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 Directed Enzyme-Enzyme Network will be created. 0007 % This file also contains single nodes (without any edges) in Cytoscape-compatible files. 0008 % Note: COBRA Toolbox must be installed in MATLAB before running this function 0009 % 0010 % [Output] = enz_cent_Lib_dir_single_node(fileName1,fileName2) 0011 % 0012 %INPUTS 0013 % fileName1 The Library file includes pre-defined currency metabolites (in .txt format) 0014 % Note: Library text file must include one metabolites per line (all in one column) 0015 % fileName2 The metabolic Network in the SBML format 0016 % 0017 %OUTPUTS 0018 % *_Enzyme_Cent_Lib_Dir_Single_Node_Cyt.sif Directed-Enzyme-Enzyme Network - Cytoscape Compatible 0019 % 0020 % Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 % check validity of input files format 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 check1=regexp(fileName1,'.txt'); 0027 assert(~isempty(check1),'Error in the first input: The fileName1 must contain .txt at its end') 0028 check2=regexp(fileName2,'.xml'); 0029 assert(~isempty(check2),'Error in the second input: The fileName2 must contain .xml at its end') 0030 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 % start time evaluation of program 0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0034 tic; 0035 0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 % reading the Library text file and construct array of currency metabolites 0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0039 fid = fopen(fileName1); 0040 tline = fgetl(fid); 0041 i=1; 0042 Curr_met={}; 0043 while ischar(tline) 0044 Curr_met{i,1}=tline; 0045 tline = fgetl(fid); 0046 i=i+1; 0047 end 0048 fclose(fid); 0049 [h,g]=size(Curr_met); 0050 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 % reading the SBML file using COBRA Toolbox Command, and sets size of the S matrix 0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0054 model=readCbModel(fileName2); 0055 [m,n]=size(model.S); 0056 0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0058 % reading the Metabolites array and check their availability in the library text file 0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0060 N_curr=zeros(m,1); 0061 for q=1:m 0062 for i=1:h 0063 if strcmp(model.metNames{q},Curr_met{i,1})==1 0064 N_curr(q,1)=N_curr(q,1)+1; 0065 end 0066 end 0067 end 0068 0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0070 % Remove metabolites which are in the input Currecny Metabolites list 0071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0072 for q=1:m 0073 if N_curr(q,1)~=0 0074 for i=1:n 0075 model.S(q,i)=0; 0076 end 0077 end 0078 end 0079 0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0081 % building the output file name 0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0083 outname=strrep(fileName2,'.xml','_Enzyme_Cent_Lib_Dir_Single_Node_Cyt.sif') 0084 fout = fopen(outname, 'w+'); 0085 0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0087 % finds non-zero elements of the S-matrix (in order to make the algorithm faster), 0088 % parses through each row, and considers an edge for every unlike-signs, 0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0090 num=zeros(size(model.rxns)); 0091 for j=1:m 0092 indices=find(model.S(j,:)); 0093 [a,b]=size(indices); 0094 r=0; 0095 if b~=0 0096 r=1; 0097 end 0098 while r<b 0099 i=1; 0100 while i<(b-r+1) 0101 if model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0 0102 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)}); 0103 num(1,indices(1,r))=1; 0104 num(1,indices(1,r+i))=1; 0105 elseif model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0 0106 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)}); 0107 num(1,indices(1,r))=1; 0108 num(1,indices(1,r+i))=1; 0109 end 0110 i=i+1; 0111 end 0112 r=r+1; 0113 end 0114 end 0115 0116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0117 % considering nodes which do not contain any edges 0118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0119 for k=1:n 0120 if num(1,k)==0 0121 fprintf(fout,'%s\n',model.rxns{k}); 0122 end 0123 end 0124 fclose(fout); 0125 0126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0127 % End of time evaluation of program 0128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0129 toc; 0130