Home > . > met_cent.m

met_cent

PURPOSE ^

Builds Binary Stoichiometric Matrix and Undirected Metabolite-Metabolite Networks

SYNOPSIS ^

function [Output] = met_cent(fileName)

DESCRIPTION ^

 Builds Binary Stoichiometric Matrix and Undirected Metabolite-Metabolite Networks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file and builds Stoichiometric Matrix,
 Binary Stoichiometric Matrix, and Metabolite-Metabolite Networks.
 Note: COBRA Toolbox must be installed in MATLAB before running this function

 [Output] = met_cent(fileName)

INPUTS
 fileName                        The metabolic Network in the SBML format
 
OUTPUTS
 *_Stoich_Matrix.dat             Stoichiometric Matrix (comma separated Format)
 *_Binary_Stoich_Matrix.dat      Binary Stoichiometric Matrix (comma separated Format)
 *_Metabolite_Cent.dat           Undirected-Metabolite-Metabolite Network (comma separated Format)
 *_Metabolite_Cent_Cyt.dat       Undirected-Metabolite-Metabolite 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] = met_cent(fileName)
0002 % Builds Binary Stoichiometric Matrix and Undirected Metabolite-Metabolite Networks
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file and builds Stoichiometric Matrix,
0005 % Binary Stoichiometric Matrix, and Metabolite-Metabolite Networks.
0006 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0007 %
0008 % [Output] = met_cent(fileName)
0009 %
0010 %INPUTS
0011 % fileName                        The metabolic Network in the SBML format
0012 %
0013 %OUTPUTS
0014 % *_Stoich_Matrix.dat             Stoichiometric Matrix (comma separated Format)
0015 % *_Binary_Stoich_Matrix.dat      Binary Stoichiometric Matrix (comma separated Format)
0016 % *_Metabolite_Cent.dat           Undirected-Metabolite-Metabolite Network (comma separated Format)
0017 % *_Metabolite_Cent_Cyt.dat       Undirected-Metabolite-Metabolite 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
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 model=readCbModel(fileName);
0037 
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 % construction of Stoichiometric Matrix (comma separated Format)
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041 outname1=strrep(fileName,'.xml','_Stoich_Matrix.dat')
0042 dlmwrite(outname1,full(model.S));
0043 
0044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0045 % construction of Binary Stoichiometric Matrix (comma separated Format)
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 S_bin=zeros(size(model.S));
0048 S_bin(find(model.S))=1;
0049 outname2=strrep(fileName,'.xml','_Binary_Stoich_Matrix.dat')
0050 dlmwrite(outname2,full(S_bin));
0051 
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 % construction of Undirected-Metabolite-Metabolite Network (comma separated Format)
0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0055 Acomp=S_bin*S_bin';
0056 outname3=strrep(fileName,'.xml','_Metabolite_Cent.dat')
0057 dlmwrite(outname3,full(Acomp));
0058 
0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0060 % reading a Metabolic-Metabolic comma separated file and re-format it
0061 % to a Cytoscape-compatible file.
0062 % One could import the file using "File/Import/Network from Table(Text/MS Excel)..."
0063 % Select "first column" as "Source Interaction" and "second column" as "Target Interaction"
0064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0065 s = csvread(outname3);
0066 [m,n]=size(s);
0067 outname4=strrep(fileName,'.xml','_Metabolite_Cent_Cyt.dat')
0068 fout = fopen(outname4, 'w+');
0069 for row=1:m
0070     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0071     % because cell(i,j)=cell(j,i) we must delete duplicate entries by putting
0072     % col=row:n in the second if command. since we must ignor diagonal elements,
0073     % the counter will be col=row+1:n
0074     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0075     for col=row+1:n
0076         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077         % edge are those which includes number not equal to zero
0078         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0079         if s(row,col)~=0
0080             fprintf(fout,'%s\t%s\t%d\n',model.mets{row},model.mets{col},s(row,col));
0081         end
0082     end
0083 end
0084 fclose(fout);
0085 
0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0087 % End of time evaluation of program
0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089 toc;

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