Home > . > 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 12/07/2012         http://lbb.ut.ac.ir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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 12/07/2012         http://lbb.ut.ac.ir
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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089 for j=1:m
0090     indices=find(model.S(j,:));
0091     [a,b]=size(indices);
0092     r=0;
0093     if b~=0
0094         r=1;
0095     end 
0096     while r<b
0097         i=1;
0098         while i<(b-r+1)
0099             if model.S(j,indices(1,r))<0 && model.S(j,indices(1,r+i))>0
0100                 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r)},'reaction-product',model.rxns{indices(1,r+i)});
0101             elseif model.S(j,indices(1,r))>0 && model.S(j,indices(1,r+i))<0
0102                 fprintf(fout,'%s\t%s\t%s\n',model.rxns{indices(1,r+i)},'reaction-product',model.rxns{indices(1,r)});
0103             end
0104             i=i+1;
0105         end
0106         r=r+1;
0107     end
0108 end
0109 fclose(fout);
0110 
0111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0112 % End of time evaluation of program
0113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0114 toc;
0115

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