Home > . > enz_cent_RCM_dir_single_node.m

enz_cent_RCM_dir_single_node

PURPOSE ^

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

SYNOPSIS ^

function [Output] = enz_cent_RCM_dir_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 Directed Enzyme-Enzyme Networks.
 The Remove Currency Metabolites (RCM) algorithm removes currency metabolites in the metabolic network automatically.
 This file 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_dir_single_node(fileName)

INPUTS
 fileName                                   The metabolic Network in the SBML format
 
OUTPUTS
 *_Enzyme_Cent_RCM_Dir_Single_Node_Cyt.sif     Directed-Enzyme-Enzyme Network - Cytoscape Compatible (.sif file)
 
 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_dir_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 Directed Enzyme-Enzyme Networks.
0005 % The Remove Currency Metabolites (RCM) algorithm removes currency metabolites in the metabolic network automatically.
0006 % This file 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_dir_single_node(fileName)
0010 %
0011 %INPUTS
0012 % fileName                                   The metabolic Network in the SBML format
0013 %
0014 %OUTPUTS
0015 % *_Enzyme_Cent_RCM_Dir_Single_Node_Cyt.sif     Directed-Enzyme-Enzyme Network - Cytoscape Compatible (.sif file)
0016 %
0017 % Yazdan Asgari 12/07/2012                   http://lbb.ut.ac.ir
0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0019 
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 % check validity of input file format
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 check=regexp(fileName,'.xml');
0024 assert(~isempty(check),'The SBML fileName must contain .xml at its end')
0025 
0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0027 % start time evaluation of program
0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0029 tic;
0030 
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 % reading the SBML file using COBRA Toolbox Command, and sets size of the S matrix
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034 model=readCbModel(fileName);
0035 [m,n]=size(model.S);
0036 
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 % calculate summation of each columns (i.e. How many metabolites each enzyme correlates)
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 S_bin=zeros(size(model.S));
0041 S_bin(find(model.S))=1;
0042 CB=sum(S_bin,1);
0043 A=zeros(m,n);
0044 B=zeros(m,1);
0045 N3=zeros(m,1);
0046 
0047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0048 % for each binary S-matrix element, subtracts its value from the column summation and put the result in the A matrix.
0049 % A(q) means the metabolite q connects to how many other metabolites through the enzyme i.
0050 % for each row, sums the binary S-matrix over all columns.
0051 % B(q) means how many enzymes the metabolite q correlates.
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 for q=1:m
0054     for i=1:n
0055         if S_bin(q,i)~=0
0056             A(q,i)=CB(1,i)-S_bin(q,i);
0057         end
0058         B(q,1)=B(q,1)+S_bin(q,i);
0059     end
0060 end
0061 
0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 % Assumption: Generally, every metabolite is connected to the other one through a specific enzyme.
0064 % If a metabolite connects to more than one metabolite through an enzyme, this will be considered as a suspicious case.
0065 % Therefore, every N3(q) value equal to 3 will be marked for further analysis.
0066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0067 for q=1:m
0068     for i=1:n
0069         if A(q,i)==3
0070             N3(q,1)=N3(q,1)+1;
0071         end
0072     end
0073 end
0074 
0075 s=0;
0076 for q=1:m
0077     if N3(q,1)~=0
0078         s=1;
0079     end
0080 end
0081 
0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0083 % If there is any value for N3 array, the RCM algorithm will be done.
0084 % This algorithm will be deleted the most probable metabolite among all (i.e. the one with the maximum value of N3 and C)
0085 % The selected metabolite will be deleted in the binary S-Matrix, and the "WHILE LOOP" repeated.
0086 % The algorithm is ended if there is not any suspicious case.
0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0088 while s==1
0089     C=zeros(m,1);
0090     max1=max(N3,[],1);
0091     for q=1:m
0092         if N3(q,1)==max1
0093             C(q,1)=B(q,1);
0094         else
0095             C(q,1)=0;
0096         end
0097     end
0098     max2=max(C,[],1);
0099     for q=1:m
0100         if ( (N3(q,1)==max1) && (C(q,1)==max2) )
0101             for i=1:n
0102                 S_bin(q,i)=0;
0103                 model.S(q,i)=0;
0104             end
0105         end
0106     end    
0107     CB=sum(S_bin,1);
0108     A=zeros(m,n);
0109     B=zeros(m,1);
0110     N3=zeros(m,1);
0111     for q=1:m
0112         for i=1:n
0113             if S_bin(q,i)~=0
0114                 A(q,i)=CB(1,i)-S_bin(q,i);
0115             end
0116             B(q,1)=B(q,1)+S_bin(q,i);
0117         end
0118     end
0119     for q=1:m
0120         for i=1:n
0121             if A(q,i)==3
0122                 N3(q,1)=N3(q,1)+1;
0123             end
0124         end
0125     end
0126     s=0;
0127     for q=1:m
0128         if N3(q,1)~=0
0129             s=1;
0130         end
0131     end
0132 end
0133 
0134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0135 % building the output file name (Cytoscape compatble file)
0136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0137 outname=strrep(fileName,'.xml','_Enzyme_Cent_RCM_Dir_Single_Node_Cyt.sif')
0138 fout = fopen(outname, 'w+');
0139 
0140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0141 % construction of Directed-Enzyme-Enzyme Network based on the new binary S-matrix
0142 % finds non-zero elements of the new S-matrix (in order to make the algorithm faster),
0143 % parses through each row, and considers an edge for every unlike-signs,
0144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0145 num=zeros(size(model.rxns));
0146 for j=1:m
0147     indices=find(model.S(j,:));
0148     [a,b]=size(indices);
0149     r=0;
0150     if b~=0
0151         r=1;
0152     end 
0153     while r<b
0154         i=1;
0155         while i<(b-r+1)
0156             if model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0
0157                 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)});
0158                 num(1,indices(1,r))=1;
0159                 num(1,indices(1,r+i))=1;
0160             elseif model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0
0161                 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)});
0162                 num(1,indices(1,r))=1;
0163                 num(1,indices(1,r+i))=1;
0164             end
0165             i=i+1;
0166         end
0167         r=r+1;
0168     end
0169 end
0170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0171 % considering nodes which do not contain any edges
0172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0173 for k=1:n
0174     if num(1,k)==0
0175         fprintf(fout,'%s\n',model.rxns{k});
0176     end
0177 end
0178 fclose(fout);
0179 
0180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0181 % End of time evaluation of program
0182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0183 toc;

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