Home > scan_toolbox > enz_cent_Lib_dir.m

enz_cent_Lib_dir

PURPOSE ^

Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file)

SYNOPSIS ^

function [Output] = enz_cent_Lib_dir(fileName1,fileName2)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 The function reads a Metabolic Network SBML file and builds an Directed Enzyme-Enzyme Network.
 For every metabolite, the algorithm checks availability in the Library file which has been prepared by user as input in .txt format).
 and removes if it exists in the library file. Then the Directed Enzyme-Enzyme Network will be created.
 Note: COBRA Toolbox must be installed in MATLAB before running this function

 [Output] = enz_cent_Lib_dir(fileName1,fileName2)

INPUTS
 fileName1                         The Library file includes pre-defined currency metabolites (in .txt format)
 Note: Library text file must include one metabolites per line (all in one column) 
 fileName2                         The metabolic Network in the SBML format
 
OUTPUTS
 *_Enzyme_Cent_Lib_Dir_Cyt.sif     Directed-Enzyme-Enzyme Network - Cytoscape 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_Lib_dir(fileName1,fileName2)
0002 % Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file)
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 % The function reads a Metabolic Network SBML file and builds an Directed Enzyme-Enzyme Network.
0005 % For every metabolite, the algorithm checks availability in the Library file which has been prepared by user as input in .txt format).
0006 % and removes if it exists in the library file. Then the Directed Enzyme-Enzyme Network will be created.
0007 % Note: COBRA Toolbox must be installed in MATLAB before running this function
0008 %
0009 % [Output] = enz_cent_Lib_dir(fileName1,fileName2)
0010 %
0011 %INPUTS
0012 % fileName1                         The Library file includes pre-defined currency metabolites (in .txt format)
0013 % Note: Library text file must include one metabolites per line (all in one column)
0014 % fileName2                         The metabolic Network in the SBML format
0015 %
0016 %OUTPUTS
0017 % *_Enzyme_Cent_Lib_Dir_Cyt.sif     Directed-Enzyme-Enzyme Network - Cytoscape Compatible
0018 %
0019 % Yazdan Asgari 07/16/2016         http://yazdan59.ir/scan
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 % check validity of input files format
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 check1=regexp(fileName1,'.txt');
0026 assert(~isempty(check1),'Error in the first input: The fileName1 must contain .txt at its end')
0027 check2=regexp(fileName2,'.xml');
0028 assert(~isempty(check2),'Error in the second input: The fileName2 must contain .xml at its end')
0029 
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031 % start time evaluation of program
0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033 tic;
0034 
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 % reading the Library text file and construct array of currency metabolites
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 fid = fopen(fileName1);
0039 tline = fgetl(fid);
0040 i=1;
0041 Curr_met={};
0042 while ischar(tline)
0043     Curr_met{i,1}=tline;
0044     tline = fgetl(fid);
0045     i=i+1;
0046 end
0047 fclose(fid);
0048 [h,g]=size(Curr_met);
0049 
0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0051 % reading the SBML file using COBRA Toolbox Command, and sets size of the S matrix
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 model=readCbModel(fileName2);
0054 [m,n]=size(model.S);
0055 
0056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0057 % reading the Metabolites array and check their availability in the library text file
0058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0059 N_curr=zeros(m,1);
0060 for q=1:m
0061     for i=1:h
0062         if strcmp(model.metNames{q},Curr_met{i,1})==1
0063             N_curr(q,1)=N_curr(q,1)+1;
0064         end
0065     end
0066 end
0067 
0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0069 % Remove metabolites which are in the input Currecny Metabolites list
0070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0071 for q=1:m
0072     if N_curr(q,1)~=0
0073         for i=1:n
0074             model.S(q,i)=0;
0075         end
0076     end
0077 end
0078 
0079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0080 % building the output file name
0081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0082 outname=strrep(fileName2,'.xml','_Enzyme_Cent_Lib_Dir_Cyt.sif')
0083 fout = fopen(outname, 'w+');
0084 
0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0086 % finds non-zero elements of the S-matrix (in order to make the algorithm faster),
0087 % parses through each row, and considers an edge for every unlike-signs.
0088 % It also consider Reversibility for Enzyme-Enzyme network.
0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0090 for j=1:m
0091     indices=find(model.S(j,:));
0092     [a,b]=size(indices);
0093     r=0;
0094     if b~=0
0095         r=1;
0096     end
0097     while r<b
0098         i=1;
0099         while i<(b-r+1)
0100             if model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0
0101                 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1
0102                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)});
0103                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)});
0104                 else
0105                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)});
0106                 end
0107             elseif model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0
0108                 if model.rev(indices(r+i))==1 && model.rev(indices(r))==1
0109                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)});
0110                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)});
0111                 else
0112                     fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)});
0113                 end
0114             end
0115             i=i+1;
0116         end
0117         r=r+1;
0118     end
0119 end
0120 fclose(fout);
0121 
0122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0123 % End of time evaluation of program
0124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0125 toc;
0126

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