Reads a list of CytoHubba outputs and construct new outputs which have 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 different files (in .csv format) which all are CytoHubba (a Cytoscape plugin) outputs (each related to a given ranking method) and construct new output files include 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_list(fileName1,fileName2) INPUTS Path1 comma separated files include CytoHubba results for different ranking method (in .csv format) Path2 Paths in which the metabolic Networks in the SBML format exist N Number of .csv files per each .xml file. Note: N must be equal for all SBML files (i.e. the algorithm is repeated N times for each SBML files). So, N is related to number of .csv files for each SBML file. Note: This function is applicable for CytoHubba analysis on Bipartite, Metabolite-Metabolite, and Enzyme-Enzyme networks. OUTPUTS *_fileName1_fileName2.dat The output files which include the name of the related SBML metabolites or reactions. Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [Output] = postprocess_CytoHubba_list(Path1,Path2,N) 0002 % Reads a list of CytoHubba outputs and construct new outputs which have 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 different files (in .csv format) which all are CytoHubba (a Cytoscape plugin) outputs (each related to a given ranking method) 0006 % and construct new output files include 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_list(fileName1,fileName2) 0012 % 0013 %INPUTS 0014 % Path1 comma separated files include CytoHubba results for different ranking method (in .csv format) 0015 % Path2 Paths in which the metabolic Networks in the SBML format exist 0016 % N Number of .csv files per each .xml file. 0017 % Note: N must be equal for all SBML files (i.e. the algorithm is repeated N times for each SBML files). So, N is related to number of .csv files for each SBML file. 0018 % Note: This function is applicable for CytoHubba analysis on Bipartite, Metabolite-Metabolite, and Enzyme-Enzyme networks. 0019 % 0020 %OUTPUTS 0021 % *_fileName1_fileName2.dat The output files which include the name of the related SBML metabolites or reactions. 0022 % 0023 % Yazdan Asgari 12/07/2012 http://lbb.ut.ac.ir 0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0025 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 % check validity of input files format 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 assert(~isnumeric(N),'Error in the third input: The N must be an integer number') 0030 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 % start time evaluation of whole program 0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0034 tic; 0035 0036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 % Reading all CytoHubba results files (.csv format) in the Path1 directory , 0038 % and reading the SBML files (.xml format) in the Path2 directory 0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 allcsvfiles=dir(fullfile(Path1,'*.csv')); 0041 [a,b]=size(allcsvfiles); 0042 sbmlfiles=dir(fullfile(Path2,'*.xml')); 0043 [c,d]=size(sbmlfiles); 0044 0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0046 % Doing algorithm for all CytoHubba files one by one 0047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0048 t=1; 0049 s=1; 0050 for r=1:a 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 % start time evaluation of each .csv algorithm process 0053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0054 tic; 0055 D=allcsvfiles(r).name; 0056 0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0058 % check to change SBML file every Nth times 0059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0060 if t==1 0061 model=readCbModel(sbmlfiles(s).name) 0062 sbmlfiles(s).name; 0063 s=s+1; 0064 end 0065 if t==N 0066 t=0; 0067 end 0068 0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0070 % building the output file name 0071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0072 outname1=strrep(sbmlfiles(s-1).name,'.xml',''); 0073 outname2=strrep(D,'.csv','.dat'); 0074 outname3=strcat(outname1,outname2); 0075 fout=fopen(outname3,'w+'); 0076 0077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0078 % reading an output (.csv format) of the CytoHubba and ignore first and second lines. 0079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0080 fid = fopen(allcsvfiles(r).name) 0081 fgetl(fid); 0082 fgetl(fid); 0083 M=textscan(fid,'%*d %s %*d','delimiter', ','); 0084 C=M{1}; 0085 0086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0087 % construct a new output file which has been added the name of the related SBML metabolites or reactions. 0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0089 [g,h]=size(C); 0090 [k,n]=size(model.mets); 0091 [kk,nn]=size(model.rxns); 0092 for i=1:g 0093 p=0; 0094 if strncmp(C(i,1),'E_',2)==1 0095 fprintf(fout,'%s\n ',C{i}); 0096 p=p+1; 0097 end 0098 if p==0 0099 for j=1:k 0100 Maddition=strcat('M_',model.mets{j}); 0101 if strcmp(C(i,1),Maddition)==1 0102 fprintf(fout,'%s\t%s\n ',model.mets{j},model.metNames{j}); 0103 p=p+1; 0104 break; 0105 end 0106 end 0107 end 0108 if p==0 0109 for j=1:kk 0110 Raddition=strcat('R_',model.rxns{j}); 0111 if strcmp(C(i,1),Raddition)==1 0112 fprintf(fout,'%s\t%s\n ',model.rxns{j},model.rxnNames{j}); 0113 p=p+1; 0114 break; 0115 end 0116 end 0117 end 0118 if p==0 0119 fprintf(fout,'%s\n ',C{i}); 0120 end 0121 end 0122 fclose(fid); 0123 fclose(fout); 0124 0125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0126 % End of time evaluation of each .csv algorithm process 0127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0128 toc; 0129 0130 t=t+1; 0131 end 0132 0133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0134 % End of time evaluation of whole program 0135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0136 toc; 0137