Home > scan_toolbox > enz_cent_dir_quatexelero.m

enz_cent_dir_quatexelero

PURPOSE ^

Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.

SYNOPSIS ^

function [Output] = enz_cent_dir_quatexelero(fileName)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file,
 and builds Directed Enzyme-Enzyme Networks which is compatible with QuateXelero Algorithm.
 The QuateXelero is one of the best motif finding algorithms which is recently developed by Kavosh developer team.
 http://lbb.ut.ac.ir/Download/LBBsoft/QuateXelero
 So, one could easily use this algorithm in order to find motifs in different sizes for the metabolic network.
 Note: COBRA Toolbox must be installed in MATLAB before running this function

 [Output] = enz_cent_dir_quatexelero(fileName)

INPUTS
 fileName                             The metabolic Network in the SBML format
 
OUTPUTS
 *_Enzyme_Cent_Dir_Index.dat          Matrix Indeces of Enzyme-Enzyme Connections 
 *_Enzyme_Cent_Dir_QuateXelero.dat    Directed-Enzyme-Enzyme Network - QuateXelero Compatible
 
 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] = enz_cent_dir_quatexelero(fileName)
0002 % Builds Directed Enzyme-Enzyme Networks considering Currency Metabolites which could be used as an input for QuateXelero Algorithm.
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file,
0005 % and builds Directed Enzyme-Enzyme Networks which is compatible with QuateXelero Algorithm.
0006 % The QuateXelero is one of the best motif finding algorithms which is recently developed by Kavosh developer team.
0007 % http://lbb.ut.ac.ir/Download/LBBsoft/QuateXelero
0008 % So, one could easily use this algorithm in order to find motifs in different sizes for the metabolic network.
0009 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0010 %
0011 % [Output] = enz_cent_dir_quatexelero(fileName)
0012 %
0013 %INPUTS
0014 % fileName                             The metabolic Network in the SBML format
0015 %
0016 %OUTPUTS
0017 % *_Enzyme_Cent_Dir_Index.dat          Matrix Indeces of Enzyme-Enzyme Connections
0018 % *_Enzyme_Cent_Dir_QuateXelero.dat    Directed-Enzyme-Enzyme Network - QuateXelero Compatible
0019 %
0020 % Yazdan Asgari 07/16/2016          http://yazdan59.ir/scan
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 [m,n]=size(model.S);
0039 
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041 % building the output file name
0042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 outname1=strrep(fileName,'.xml','_Enzyme_Cent_Dir_Index.dat')
0044 fout1 = fopen(outname1, 'w+');
0045 
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0048 % parses through each row, and considers an edge for every unlike-signs.
0049 % It also consider Reversibility for Enzyme-Enzyme network.
0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0051 num=zeros(size(model.rxns));
0052 for j=1:m
0053     indices=find(model.S(j,:));
0054     [a,b]=size(indices);
0055     r=0;
0056     if b~=0
0057         r=1;
0058     end
0059     while r<b
0060         i=1;
0061         while i<(b-r+1)
0062             if model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0
0063                 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1
0064                     fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i));
0065                     fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r));
0066                     num(1,indices(1,r))=1;
0067                     num(1,indices(1,r+i))=1;
0068                 else
0069                     fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i));
0070                     num(1,indices(1,r))=1;
0071                     num(1,indices(1,r+i))=1;
0072                 end
0073             elseif model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0
0074                 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1
0075                     fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r));
0076                     fprintf(fout1,'%d\t%d\n',indices(1,r),indices(1,r+i));
0077                     num(1,indices(1,r))=1;
0078                     num(1,indices(1,r+i))=1;
0079                 else
0080                     fprintf(fout1,'%d\t%d\n',indices(1,r+i),indices(1,r));
0081                     num(1,indices(1,r))=1;
0082                     num(1,indices(1,r+i))=1;
0083                 end
0084             end
0085             i=i+1;
0086         end
0087         r=r+1;
0088     end
0089 end
0090 
0091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0092 % building the output file name
0093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0094 outname2=strrep(fileName,'.xml','_Enzyme_Cent_Lib_Dir_QuateXelero.dat')    
0095 fout2=fopen(outname2,'w+');
0096 
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 % reading the constructed Enzyme-Enzyme network file and re-format it to a QuateXelero-compatible file.
0099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0100 fid = fopen(outname1);
0101 C=fscanf(fid,'%d');
0102 i=1;
0103 while isinteger(fid)
0104     C(i)=fscanf(fid,'%d',C);
0105     i=i+1;
0106 end
0107 g=size(C);
0108 A=size(unique(C));
0109 if g~=0
0110     n=1;
0111 else
0112     disp('Error in reading the file, No Edge detected')
0113 end
0114 k=1;
0115 j=2;
0116 last=g/2;
0117 fprintf(fout2,'%d\n',A(1,1));   % total number of uniques nodes in the network (needed for QuateXelero Algorithm)
0118 for i=1:last
0119     fprintf(fout2,'%d\t%d\n ',C(k),C(j));
0120     k=k+2;
0121     j=j+2;
0122 end
0123 fclose(fid);
0124 fclose(fout2);
0125 
0126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0127 % End of time evaluation of program
0128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0129 toc;
0130

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