Reads an output of the CytoHubba and construct a new output file which has been added the name of the related SBML metabolites or reactions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The "PostProcess" Functions in this toolbox do some changes on some useful structural plugins in the Cytoscape software. This function reads an output (.csv format) of the CytoHubba (a Cytoscape plugin), and construct a new output file which has been added the name of the related SBML metabolites or reactions. http://hub.iis.sinica.edu.tw/cytoHubba/ Note: COBRA Toolbox must be installed in MATLAB before running this function Note: This function is applicable for CytoHubba analysis on Bipartite, Metabolite-Metabolite, and Enzyme-Enzyme networks (both Directed and Undirected). [Output] = postprocess_CytoHubba(fileName1,fileName2) INPUTS fileName1 comma separated file includes CytoHubba results for a given ranking method (in .csv format) fileName2 The metabolic Network in the SBML format OUTPUTS *_fileName1_fileName2.dat The output file which includes the name of the related SBML metabolites or reactions. Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = postprocess_CytoHubba(fileName1,fileName2) 0002 % Reads an output of the CytoHubba and construct a new output file which has been added the name of the related SBML metabolites or reactions 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % The "PostProcess" Functions in this toolbox do some changes on some useful structural plugins in the Cytoscape software. 0005 % This function reads an output (.csv format) of the CytoHubba (a Cytoscape plugin), 0006 % and construct a new output file which has been added the name of the related SBML metabolites or reactions. 0007 % http://hub.iis.sinica.edu.tw/cytoHubba/ 0008 % Note: COBRA Toolbox must be installed in MATLAB before running this function 0009 % Note: This function is applicable for CytoHubba analysis on Bipartite, Metabolite-Metabolite, and Enzyme-Enzyme networks (both Directed and Undirected). 0010 % 0011 % [Output] = postprocess_CytoHubba(fileName1,fileName2) 0012 % 0013 %INPUTS 0014 % fileName1 comma separated file includes CytoHubba results for a given ranking method (in .csv format) 0015 % fileName2 The metabolic Network in the SBML format 0016 % 0017 %OUTPUTS 0018 % *_fileName1_fileName2.dat The output file which includes the name of the related SBML metabolites or reactions. 0019 % 0020 % Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 % check validity of input files format 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 check1=regexp(fileName1,'.csv'); 0027 assert(~isempty(check1),'Error in the first input: The fileName1 must contain .csv 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 SBML file using COBRA Toolbox Command 0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0039 model=readCbModel(fileName2); 0040 0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0042 % building the output file name 0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0044 outname1=strrep(fileName1,'.xml',''); 0045 outname2=strrep(fileName2,'.csv','.dat'); 0046 outname3=strcat(outname1,outname2) 0047 fout = fopen(outname3, 'w+'); 0048 0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0050 % reading an output (.csv format) of the CytoHubba and ignore first and second lines. 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 fid = fopen(fileName1); 0053 fgetl(fid); 0054 fgetl(fid); 0055 M=textscan(fid,'%*d %s %*d','delimiter', ','); 0056 C=M{1}; 0057 0058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0059 % construct a new output file which has been added the name of the related SBML metabolites or reactions. 0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0061 [g,h]=size(C); 0062 [k,n]=size(model.mets); 0063 [kk,nn]=size(model.rxns); 0064 for i=1:g 0065 p=0; 0066 if strncmp(C(i,1),'E_',2)==1 0067 fprintf(fout,'%s\n ',C{i}); 0068 p=p+1; 0069 end 0070 if p==0 0071 for j=1:k 0072 Maddition=strcat('M_',model.mets{j}); 0073 if strcmp(C(i,1),Maddition)==1 0074 fprintf(fout,'%s\t%s\n ',model.mets{j},model.metNames{j}); 0075 p=p+1; 0076 break; 0077 end 0078 end 0079 end 0080 if p==0 0081 for j=1:kk 0082 Raddition=strcat('R_',model.rxns{j}); 0083 if strcmp(C(i,1),Raddition)==1 0084 fprintf(fout,'%s\t%s\n ',model.rxns{j},model.rxnNames{j}); 0085 p=p+1; 0086 break; 0087 end 0088 end 0089 end 0090 if p==0 0091 fprintf(fout,'%s\n ',C{i}); 0092 end 0093 end 0094 fclose(fid); 0095 fclose(fout); 0096 0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0098 % End of time evaluation of program 0099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0100 toc; 0101