Home > scan_toolbox > 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 07/16/2016              http://yazdan59.ir/scan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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 07/16/2016              http://yazdan59.ir/scan
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 Library text file and construct array of carriors of electrons , protons and energy
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034 fid = fopen('carr_mets.txt');
0035 tline = fgetl(fid);
0036 i=1;
0037 Curr_met={};
0038 while ischar(tline)
0039     Curr_met{i,1}=tline;
0040     tline = fgetl(fid);
0041     i=i+1;
0042 end
0043 fclose(fid);
0044 [h,g]=size(Curr_met);
0045 
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 % reading the SBML file using COBRA Toolbox Command
0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0049 model=readCbModel(fileName);
0050 [m,n]=size(model.S);
0051 
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 % building the output file name
0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0055 outname=strrep(fileName,'.xml','_Metabolite_Cent_Dir_Single_Node_Cyt.sif')
0056 fout = fopen(outname, 'w+');
0057 
0058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0059 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0060 % parses through each column, and considers an edge for every unlike-signs.
0061 % It also consider Reversibility for Enzyme-Enzyme network.
0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 num=zeros(size(model.mets));
0064 for j=1:n
0065     indices=find(model.S(:,j));
0066     [a,b]=size(indices);
0067     r=0;
0068     if a~=0
0069         r=1;
0070     end
0071     while r<a
0072         i=1;
0073         while i<(a-r+1)
0074             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0075             % reading every metabolite and check its availability in the carriors metabolites text file
0076             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077             N=0;
0078             for k=1:h
0079                 if strcmp(model.metNames{indices(r,1)},Curr_met{k,1})==1
0080                     N=1;
0081                     break
0082                 elseif strcmp(model.metNames{indices(r+i,1)},Curr_met{k,1})==1
0083                     N=1;
0084                     break
0085                 end
0086             end
0087             if model.S(indices(r,1),j)<0 && model.S(indices(r+i,1),j)>0
0088                 if model.rev(j)==1 && N==0
0089                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)});
0090                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)});
0091                 else
0092                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)});
0093                 end
0094             elseif model.S(indices(r,1),j)>0 && model.S(indices(r+i,1),j)<0
0095                 if model.rev(j)==1 && N==0
0096                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)});
0097                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r,1)},'reaction-product',model.mets{indices(r+i,1)});
0098                 else
0099                     fprintf(fout,'%s\t%s\t%s\n',model.mets{indices(r+i,1)},'reaction-product',model.mets{indices(r,1)});
0100                 end
0101             end
0102             i=i+1;
0103         end
0104         r=r+1;
0105     end
0106 end
0107 
0108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0109 % considering nodes which do not contain any edges
0110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0111 for k=1:m
0112     if num(k,1)==0
0113         fprintf(fout,'%s\n',model.mets{k});
0114     end
0115 end
0116 fclose(fout);
0117 
0118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0119 % End of time evaluation of program
0120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0121 toc;
0122

Generated on Sat 16-Jul-2016 17:47:22 by m2html © 2003