Home > . > met_cent_dir_single_node.m

met_cent_dir_single_node

PURPOSE ^

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

SYNOPSIS ^

function [Output] = met_cent_dir_single_node(fileName)

DESCRIPTION ^

 Builds Directed Metabolite-Metabolite Networks considering single nodes (without any edges)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file,
 and builds Directed Metabolite-Metabolite Networks.
 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] = met_cent_dir_single_node(fileName)

INPUTS
 fileName                                     The metabolic Network in the SBML format
 
OUTPUTS
 *_Metabolite_Cent_Dir_Single_Node_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_single_node(fileName)
0002 % Builds Directed Metabolite-Metabolite Networks considering single nodes (without any edges)
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % and builds Directed Metabolite-Metabolite Networks.
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] = met_cent_dir_single_node(fileName)
0010 %
0011 %INPUTS
0012 % fileName                                     The metabolic Network in the SBML format
0013 %
0014 %OUTPUTS
0015 % *_Metabolite_Cent_Dir_Single_Node_Cyt.sif    Directed-Metabolite-Metabolite 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
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034 model=readCbModel(fileName);
0035 [m,n]=size(model.S);
0036 
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 % building the output file name
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 outname=strrep(fileName,'.xml','_Metabolite_Cent_Dir_Single_Node_Cyt.sif')
0041 fout = fopen(outname, 'w+');
0042 
0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0044 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0045 % parses through each column, and considers an edge for every unlike-signs,
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 num=zeros(size(model.mets));
0048 for j=1:n
0049     indices=find(model.S(:,j));
0050     [a,b]=size(indices);
0051     r=0;
0052     if a~=0
0053         r=1;
0054     end 
0055     while r<a
0056         i=1;
0057         while i<(a-r+1)
0058             if 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,1)},'reaction-product',model.mets{indices(r+i,1)});
0060                 num(indices(r,1),1)=1;
0061                 num(indices(r+i,1),1)=1;
0062             elseif model.S(indices(r,1),j)>0 && model.S(indices(r+i,1),j)<0
0063                 fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)});
0064                 num(indices(r,1),1)=1;
0065                 num(indices(r+i,1),1)=1;
0066             end
0067             i=i+1;
0068         end
0069         r=r+1;
0070     end
0071 end
0072 
0073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0074 % considering nodes which do not contain any edges
0075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0076 for k=1:m
0077     if num(k,1)==0
0078         fprintf(fout,'%s\n',model.mets{k});
0079     end
0080 end
0081 fclose(fout);
0082 
0083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0084 % End of time evaluation of program
0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0086 toc;
0087

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