Home > . > met_dist.m

met_dist

PURPOSE ^

Counts total occurance of each metabolite through the network and total number of metabolites per reaction

SYNOPSIS ^

function [Output] = met_dist(fileName)

DESCRIPTION ^

 Counts total occurance of each metabolite through the network and total number of metabolites per reaction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file, 
 counts total occurance of each metabolite through the network,
 and total number of metabolites per reaction
 Note: COBRA Toolbox must be installed in MATLAB before running this function

 [Output] = met_dist(fileName)

INPUTS
 fileName                        The metabolic Network in the SBML format
 
OUTPUTS
 *_Met_Distribution.dat          total occurance of each metabolite through the network
 *_Rxn_Participation.dat         total number of metabolites per reaction
 
 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_dist(fileName)
0002 % Counts total occurance of each metabolite through the network and total number of metabolites per reaction
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % counts total occurance of each metabolite through the network,
0006 % and total number of metabolites per reaction
0007 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0008 %
0009 % [Output] = met_dist(fileName)
0010 %
0011 %INPUTS
0012 % fileName                        The metabolic Network in the SBML format
0013 %
0014 %OUTPUTS
0015 % *_Met_Distribution.dat          total occurance of each metabolite through the network
0016 % *_Rxn_Participation.dat         total number of metabolites per reaction
0017 %
0018 % Yazdan Asgari 12/07/2012        http://lbb.ut.ac.ir
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 % check validity of input file format
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 check=regexp(fileName,'.xml');
0025 assert(~isempty(check),'The fileName must contain .xml at its end')
0026 
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 % start time evaluation of program
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 tic;
0031 
0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033 % reading the SBML file using COBRA Toolbox Command
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 model=readCbModel(fileName);
0036 [m,n]=size(model.S);
0037 
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 % preparation to calculate total occurance of each metabolite through the network,
0040 % and write them to the output files
0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042 outname2=strrep(fileName,'.xml','_Met_Distribution.dat')
0043 fout = fopen(outname2, 'w+');
0044 fprintf(fout, 'Metabolite\t\tTotal Occurance\n');
0045 fprintf(fout, '----------------------------------------------\n');
0046 j=0;
0047 for row=1:m
0048     i=0;
0049     for col=1:n
0050         if model.S(row,col)~=0
0051             i=i+1;
0052         end
0053     end
0054     fprintf(fout, '%s\t\t%d\n',model.mets{row},i);
0055     j=j+i;
0056 end
0057 fclose(fout);
0058 
0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0060 % calculation total number of metabolites per reaction,
0061 % and write them to the output files
0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 outname3=strrep(fileName,'.xml','_Rxn_Participation.dat')
0064 fout2 = fopen(outname3, 'w+');
0065 fprintf(fout, 'Reaction\t\t\tTotal Metabolites per Reaction\n');
0066 fprintf(fout, '------------------------------------------------------------\n');
0067 jj=0;
0068 for col=1:n
0069     ii=0;
0070     for row=1:m   
0071         if model.S(row,col)~=0
0072             ii=ii+1;
0073         end
0074     end
0075     fprintf(fout2, '%s\t\t%d\n',model.rxns{col},ii);
0076     jj=jj+ii;
0077 end
0078 fclose(fout2);
0079 
0080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0081 % End of time evaluation of program
0082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0083 toc;

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