Home > . > met_cent_dir.m

met_cent_dir

PURPOSE ^

Builds Directed Metabolite-Metabolite Networks

SYNOPSIS ^

function [Output] = met_cent_dir(fileName)

DESCRIPTION ^

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

 [Output] = met_cent_dir(fileName)

INPUTS
 fileName                          The metabolic Network in the SBML format
 
OUTPUTS
 *_Metabolite_Cent_Dir_Cyt.sif     Directed-Metabolite-Metabolite 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] = met_cent_dir(fileName)
0002 % Builds Directed Metabolite-Metabolite Networks
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % and builds Directed Metabolite-Metabolite Networks.
0006 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0007 %
0008 % [Output] = met_cent_dir(fileName)
0009 %
0010 %INPUTS
0011 % fileName                          The metabolic Network in the SBML format
0012 %
0013 %OUTPUTS
0014 % *_Metabolite_Cent_Dir_Cyt.sif     Directed-Metabolite-Metabolite Network - Cytoscape Compatible (.sif file)
0015 %
0016 % Yazdan Asgari 12/07/2012   http://lbb.ut.ac.ir
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 % check validity of input file format
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 check=regexp(fileName,'.xml');
0023 assert(~isempty(check),'The SBML fileName must contain .xml at its end')
0024 
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 % start time evaluation of program
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 tic;
0029 
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031 % reading the SBML file using COBRA Toolbox Command
0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033 model=readCbModel(fileName);
0034 [m,n]=size(model.S);
0035 
0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0037 % building the output file name
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 outname=strrep(fileName,'.xml','_Metabolite_Cent_Dir_Cyt.sif')
0040 fout = fopen(outname, 'w+');
0041 
0042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0044 % parses through each column, and considers an edge for every unlike-signs,
0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 for j=1:n
0047     indices=find(model.S(:,j));
0048     [a,b]=size(indices);
0049     r=0;
0050     if a~=0
0051         r=1;
0052     end 
0053     while r<a
0054         i=1;
0055         while i<(a-r+1)
0056             if model.S(indices(r,1),j)<0 && model.S(indices(r+i,1),j)>0
0057                 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)});
0058             elseif model.S(indices(r,1),j)>0 && model.S(indices(r+i,1),j)<0
0059                 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)});
0060             end
0061             i=i+1;
0062         end
0063         r=r+1;
0064     end
0065 end
0066 fclose(fout);
0067 
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 % End of time evaluation of program
0070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0071 toc;

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