Home > . > met_cent_single_node.m

met_cent_single_node

PURPOSE ^

Builds Undirected Metabolite-Metabolite Networks considering single nodes (without any edges)

SYNOPSIS ^

function [Output] = met_cent_single_node(fileName)

DESCRIPTION ^

 Builds Undirected Metabolite-Metabolite Networks considering single nodes (without any edges)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file and builds Stoichiometric Matrix,
 Binary Stoichiometric Matrix, and Metabolite-Metabolite Networks.
 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] = met_cent_single_node(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_single_node_Cyt.dat    Undirected-Metabolite-Metabolite Network - Cytoscape Compatible (contains single nodes (without any edges))
 
 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_single_node(fileName)
0002 % Builds Undirected Metabolite-Metabolite Networks considering single nodes (without any edges)
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file and builds Stoichiometric Matrix,
0005 % Binary Stoichiometric Matrix, and Metabolite-Metabolite Networks.
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] = met_cent_single_node(fileName)
0010 %
0011 %INPUTS
0012 % fileName                                 The metabolic Network in the SBML format
0013 %
0014 %OUTPUTS
0015 % *_Stoich_Matrix.dat                      Stoichiometric Matrix (comma separated Format)
0016 % *_Binary_Stoich_Matrix.dat               Binary Stoichiometric Matrix (comma separated Format)
0017 % *_Metabolite_Cent.dat                    Undirected-Metabolite-Metabolite Network (comma separated Format)
0018 % *_Metabolite_Cent_single_node_Cyt.dat    Undirected-Metabolite-Metabolite Network - Cytoscape Compatible (contains single nodes (without any edges))
0019 %
0020 % Yazdan Asgari 12/07/2012                 http://lbb.ut.ac.ir
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 % check validity of input file format
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 check=regexp(fileName,'.xml');
0027 assert(~isempty(check),'The SBML fileName must contain .xml at its end')
0028 
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 % start time evaluation of program
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 tic;
0033 
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 % reading the SBML file using COBRA Toolbox Command
0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0037 model=readCbModel(fileName);
0038 
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 % construction of Stoichiometric Matrix (comma separated Format)
0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 outname1=strrep(fileName,'.xml','_Stoich_Matrix.dat')
0043 dlmwrite(outname1,full(model.S));
0044 
0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 % construction of Binary Stoichiometric Matrix (comma separated Format)
0047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0048 S_bin=zeros(size(model.S));
0049 S_bin(find(model.S))=1;
0050 outname2=strrep(fileName,'.xml','_Binary_Stoich_Matrix.dat')
0051 dlmwrite(outname2,full(S_bin));
0052 
0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0054 % construction of Undirected-Metabolite-Metabolite Network (comma separated Format)
0055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0056 Acomp=S_bin*S_bin';
0057 outname3=strrep(fileName,'.xml','_Metabolite_Cent.dat')
0058 dlmwrite(outname3,full(Acomp));
0059 
0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0061 % reading a Metabolic-Metabolic comma separated file and re-format it
0062 % to a Cytoscape-compatible file.
0063 % One could import the file using "File/Import/Network from Table(Text/MS Excel)..."
0064 % Select "first column" as "Source Interaction" and "second column" as "Target Interaction"
0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066 s = csvread(outname3);
0067 [m,n]=size(s);
0068 outname4=strrep(fileName,'.xml','_Metabolite_Cent_single_node_Cyt.dat')
0069 fout = fopen(outname4, 'w+');
0070 for row=1:m
0071     num=0;
0072     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0073     % because cell(i,j)=cell(j,i) we must delete duplicate entries by putting
0074     % col=row:n in the second if command. since we must ignor diagonal elements,
0075     % the counter will be col=row+1:n
0076     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077     for col=row+1:n
0078         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0079         % edge are those which includes number not equal to zero
0080         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081         if s(row,col)~=0
0082             fprintf(fout,'%s\t%s\t%d\n',model.mets{row},model.mets{col},s(row,col));
0083             num=num+1;
0084         end
0085     end
0086     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0087     % considering nodes which do not contain any edges
0088     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089     if num==0
0090         fprintf(fout,'%s\n',model.mets{row});
0091     end
0092 end
0093 fclose(fout);
0094 
0095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0096 % End of time evaluation of program
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 toc;

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