Home > scan_toolbox > enz_cent_Lib_dir_single_node.m

enz_cent_Lib_dir_single_node

PURPOSE ^

Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) and considering single nodes (without any edges)

SYNOPSIS ^

function [Output] = enz_cent_Lib_dir_single_node(fileName1,fileName2)

DESCRIPTION ^

 Builds Directed Enzyme-Enzyme Network with Removing Currency Metabolites (based-on a Library file) and considering single nodes (without any edges)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 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.
 This file also contains single nodes (without any edges) in Cytoscape-compatible files.
 Note: COBRA Toolbox must be installed in MATLAB before running this function

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

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