Home > . > enz_cent_RCM_single_node.m

enz_cent_RCM_single_node

PURPOSE ^

Builds Directed Enzyme-Enzyme Networks Removing Currency Metabolites and considering single nodes (without any edges)

SYNOPSIS ^

function [Output] = enz_cent_RCM_single_node(fileName)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Networks Removing Currency Metabolites and considering single nodes (without any edges)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file and builds Enzyme-Enzyme Networks.
 The Remove Currency Metabolites (RCM) algorithm removes currency metabolites in the metabolic network automatically.
 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_RCM_single_node(fileName)

INPUTS
 fileName                               The metabolic Network in the SBML format
 
OUTPUTS
 *_Removed_Mets_RCM.dat                 file contains removed metabolits from the original model
 *_Enzyme_Cent_RCM.dat                  Undirected-Enzyme-Enzyme Network (comma separated Format)
 *_Enzyme_Cent_RCM_single_node_Cyt.dat  Undirected-Enzyme-Enzyme Network - Cytoscape Compatible
 
 Yazdan Asgari 12/07/2012               http://lbb.ut.ac.ir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Output] = enz_cent_RCM_single_node(fileName)
0002 % Builds Directed Enzyme-Enzyme Networks Removing Currency Metabolites and considering single nodes (without any edges)
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file and builds Enzyme-Enzyme Networks.
0005 % The Remove Currency Metabolites (RCM) algorithm removes currency metabolites in the metabolic network automatically.
0006 % This file also contains single nodes (without any edges) in Cytoscape-compatible files.
0007 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0008 %
0009 % [Output] = enz_cent_RCM_single_node(fileName)
0010 %
0011 %INPUTS
0012 % fileName                               The metabolic Network in the SBML format
0013 %
0014 %OUTPUTS
0015 % *_Removed_Mets_RCM.dat                 file contains removed metabolits from the original model
0016 % *_Enzyme_Cent_RCM.dat                  Undirected-Enzyme-Enzyme Network (comma separated Format)
0017 % *_Enzyme_Cent_RCM_single_node_Cyt.dat  Undirected-Enzyme-Enzyme Network - Cytoscape Compatible
0018 %
0019 % Yazdan Asgari 12/07/2012               http://lbb.ut.ac.ir
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 % check validity of input file format
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 check=regexp(fileName,'.xml');
0026 assert(~isempty(check),'The SBML fileName must contain .xml at its end')
0027 
0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0029 % start time evaluation of program
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031 tic;
0032 
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034 % reading the SBML file using COBRA Toolbox Command, and sets size of the S matrix
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 model=readCbModel(fileName);
0037 [m,n]=size(model.S);
0038 
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 % calculate summation of each columns (i.e. How many metabolites each enzyme correlates)
0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 S_bin=zeros(size(model.S));
0043 S_bin(find(model.S))=1;
0044 CB=sum(S_bin,1);
0045 A=zeros(m,n);
0046 B=zeros(m,1);
0047 N3=zeros(m,1);
0048 
0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0050 % for each binary S-matrix element, subtracts its value from the column summation and put the result in the A matrix.
0051 % A(q) means the metabolite q connects to how many other metabolites through the enzyme i.
0052 % for each row, sums the binary S-matrix over all columns.
0053 % B(q) means how many enzymes the metabolite q correlates.
0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0055 for q=1:m
0056     for i=1:n
0057         if S_bin(q,i)~=0
0058             A(q,i)=CB(1,i)-S_bin(q,i);
0059         end
0060         B(q,1)=B(q,1)+S_bin(q,i);
0061     end
0062 end
0063 
0064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0065 % Assumption: Generally, every metabolite is connected to the other one through a specific enzyme.
0066 % If a metabolite connects to more than one metabolite through an enzyme, this will be considered as a suspicious case.
0067 % Therefore, every N3(q) value equal to 3 will be marked for further analysis.
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 for q=1:m
0070     for i=1:n
0071         if A(q,i)==3
0072             N3(q,1)=N3(q,1)+1;
0073         end
0074     end
0075 end
0076 
0077 s=0;
0078 for q=1:m
0079     if N3(q,1)~=0
0080         s=1;
0081     end
0082 end
0083 
0084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0085 % building the output file name for writing removed metabolites
0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0087 outname1=strrep(fileName,'.xml','_Removed_Mets_RCM.dat')
0088 fout1 = fopen(outname1, 'w+');
0089 fprintf(fout1, 'Metabolite\t\tMetabolite Name\t\tMax1\t\tMax2\n');
0090 fprintf(fout1, '----------------------------------------------\n');
0091 
0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0093 % If there is any value for N3 array, the RCM algorithm will be done.
0094 % This algorithm will be deleted the most probable metabolite among all (i.e. the one with the maximum value of N3 and C)
0095 % The selected metabolite will be deleted in the binary S-Matrix, and the "WHILE LOOP" repeated.
0096 % The algorithm is ended if there is not any suspicious case.
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 while s==1
0099     C=zeros(m,1);
0100     max1=max(N3,[],1);
0101     for q=1:m
0102         if N3(q,1)==max1
0103             C(q,1)=B(q,1);
0104         else
0105             C(q,1)=0;
0106         end
0107     end
0108     max2=max(C,[],1);
0109     for q=1:m
0110         if ( (N3(q,1)==max1) && (C(q,1)==max2) )
0111             for i=1:n
0112                 S_bin(q,i)=0;
0113             end
0114             fprintf(fout1,'%s\t\t%s\t\t%d\t\t%d\n',model.mets{q},model.metNames{q},max1,max2);
0115         end
0116     end
0117     
0118     CB=sum(S_bin,1);
0119     A=zeros(m,n);
0120     B=zeros(m,1);
0121     N3=zeros(m,1);
0122     for q=1:m
0123         for i=1:n
0124             if S_bin(q,i)~=0
0125                 A(q,i)=CB(1,i)-S_bin(q,i);
0126             end
0127             B(q,1)=B(q,1)+S_bin(q,i);
0128         end
0129     end
0130     for q=1:m
0131         for i=1:n
0132             if A(q,i)==3
0133                 N3(q,1)=N3(q,1)+1;
0134             end
0135         end
0136     end
0137     s=0;
0138     for q=1:m
0139         if N3(q,1)~=0
0140             s=1;
0141         end
0142     end
0143 end
0144 
0145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0146 % construction of Undirected-Enzyme-Enzyme Network based on the new binary S-matrix(comma separated Format)
0147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0148 Aenz=S_bin'*S_bin;
0149 outname2=strrep(fileName,'.xml','_Enzyme_Cent_RCM.dat')
0150 dlmwrite(outname2,full(Aenz));
0151 
0152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0153 % re-format of Undirected-Enzyme-Enzyme Network it to a Cytoscape-compatible file.
0154 % One could import the file using "File/Import/Network from Table(Text/MS Excel)..."
0155 % Select "first column" as "Source Interaction" and "second column" as "Target Interaction"
0156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0157 [m,n]=size(Aenz);
0158 outname3=strrep(fileName,'.xml','_Enzyme_Cent_RCM_single_node_Cyt.dat')
0159 fout2 = fopen(outname3, 'w+');
0160 for row=1:m
0161     num=0;
0162     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0163     % because cell(i,j)=cell(j,i) we must delete duplicate entries by putting
0164     % col=row:n in the second if command. since we must ignor diagonal elements,
0165     % the counter will be col=row+1:n
0166     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0167     for col=row+1:n
0168         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0169         % edge are those which includes number not equal to zero
0170         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0171          if Aenz(row,col)~=0
0172             fprintf(fout2, '%s\t%s\t%d\n',model.rxns{row},model.rxns{col},Aenz(row,col));
0173             num=num+1;
0174         end
0175     end
0176     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0177     % considering nodes which do not contain any edges
0178     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0179     if num==0
0180         fprintf(fout2,'%s\n',model.rxns{row});
0181     end
0182 end
0183 fclose(fout1);
0184 fclose(fout2);
0185 
0186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0187 % End of time evaluation of program
0188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0189 toc;
0190

Generated on Thu 13-Dec-2012 14:17:37 by m2html © 2005