[results] = ViewStructures(run_structures,n,maxgen,nruns,varargin) ViewStructures: Allows the visualization of the structures using different visualization methods. INPUTS namefile: file that contains the structures n: Number of variables mangen: maximum number of generations nruns: number of runs of the algorithm Optional INPUTS 'viewmatrix_method' followed by 'viewproc_filename' and array "viewparams": determines the procedure to view the data. The procedure is implemented in the matlab program: 'viewproc_filename.m' which receives as parameters the structures computed by the program ReadStructures.m and the array of parameters "viewparams" Currently, the following procedures have been implemented: 'ViewSummStruct' : Show one image where each edge has a color proportional to the times it has been present in the structures learned in all generations. viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the images. fs: Font size for the images 'ViewInGenStruct' : Shows images where each edge has a color proportional (relative to nruns) to the times it has been present in the structures learned in those generations included in viewparams{2}. There is one figure for each generation. For showing all the generations, set viewparams{2}=[1:ngen]. viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the images. fs: Font size for the images 'ViewEdgDepStruct' : Searches for substructures in the set of all the structures learned and show the adjacency matrices corresponding to the structures viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the images. fs: Font size for the images viewparams{2}: Describe the substructure by giving values of absence/presence to a subset of edges. (see Example below) viewparams{3}: % Vector of with the selected runs that will be inspected viewparams{4}; % Vector of with the selected generations that will be inspected viewparams{5}; % Display type that could be one of the following: 'all_graphs': There is an image for each structure that contain the substructure. 'one_graph': an image adding all the structures that contain the substructure. 'no_graph': no image is generated. This option is for the cases where we only want the list of runs and generations where the substructure is included. This is an output of the function (see ViewEdgDepStruct.m for details) 'ViewPCStruct' : Searches for substructures in the set of all the structures learned and show the parallel coordinates of the edges and the generations at which they are learned. viewparams{1} = fs; % fs: Font size for the images viewparams{2} : Vector with indices of edges that will be shown. For showing all the edges, set viewparams{2}=[1:m]. viewparams{3} = const_edg : Minimal number of times that an edge has to appear in (all) the structures learned to be selected for visualization. viewparams{4} : Method used to order the variables before displaying them using parallel coordinates. Ordering may help to reduce cluttering, improving visualization. viewparams{4} = 'none' if no ordering method is used. Ordering methods can be implemented by the user. Currently implemented is 'ClusterUsingCorr' which clusters togethers variables with strong correlation. More than one than one kind of graphs can be generated in the same call to the function by including several options together (see examples below) User can add more methods for visualization by passing them the appropriate output computed by ReadStructures.m (see program Help) OUTPUTS EXAMPLES First Example [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); [results] = ViewStructures(run_structures,20,maxgen,nruns,'viewmatrix_method','ViewSummStruct',{[150,14]},'viewmatrix_method','ViewInGenStruct',{[150,14];[1,5,10]}) The first figure corresponds to edges learned in all runs, all generations. The following figures corresponds to structures learned at generations 1, 5, 10 computed using all runs. Second Example We want to see all adjacency matrices of those structures learned in all runs such that edges (3,4) and (4,5) appear together and edge (3,5) does not appear viewparams{1} = [100,14]; viewparams{2} = [3 4 1; 4 5 1; 3 5 0]; % The substructure is described viewparams{3} = [1:nruns]; % Selected runs (All) viewparams{4} = [1:maxgen]; % Selected generations (All) viewparams{5} = 'all_graphs'; % Graphs to be seen (All) [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewEdgDepStruct',viewparams) Third Example Parallel coordinate visualization of the generations at which most frequent edges appearing in the structures learned by an EDA viewparams{1} = [14]; viewparams{2} = []; % The edges will be found by the algorithm viewparams{3} = 60; % Only those edges that appear at least 20 times will be shown viewparams{4} = 2; % Only substructures that have at least two edges are visualized in the PC viewparams{5} = 'ClusterUsingDist'; % Variables will be ordered according correlation viewparams{6} = 'correlation'; [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewPCStruct',viewparams) Fourth Example Glyph visualization of the generations at which most frequent edges appearing in the structures learned by an EDA viewparams{1} = [14]; viewparams{2} = results{3}; % The edges will be found by the algorithm viewparams{3} = [1:10]; % Vector with the selected runs that will be inspected viewparams{4} = [1:13]; % Vector of the selected generations that will be inspected [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); [newresults] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewGlyphStruct',viewparams) Fith Example Dendrogram visualization of the generations at which most frequent edges appearing in the structures learned by an EDA viewparams{1} = [14]; viewparams{2} = []; % The edges will be found by the algorithm viewparams{3} = 60; % Only those edges that appear at least 20 times will be shown viewparams{4} = 2; % Only substructures that have at least two edges are visualized in the PC viewparams{5} = 'correlation'; [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewDendroStruct',viewparams) Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0001 function[results] = ViewStructures(run_structures,n,maxgen,nruns,varargin) 0002 % [results] = ViewStructures(run_structures,n,maxgen,nruns,varargin) 0003 % ViewStructures: Allows the visualization of the structures using 0004 % different visualization methods. 0005 % INPUTS 0006 % namefile: file that contains the structures 0007 % n: Number of variables 0008 % mangen: maximum number of generations 0009 % nruns: number of runs of the algorithm 0010 % Optional INPUTS 0011 % 'viewmatrix_method' followed by 'viewproc_filename' and array "viewparams": determines the procedure 0012 % to view the data. The procedure is implemented in the matlab program: 0013 % 'viewproc_filename.m' which receives as parameters the structures computed 0014 % by the program ReadStructures.m and the array of parameters "viewparams" 0015 % Currently, the following procedures have been implemented: 0016 % 0017 % 'ViewSummStruct' : Show one image where each edge has a color proportional 0018 % to the times it has been present in the structures learned in all generations. 0019 % viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the images. fs: Font size for the images 0020 % 0021 % 'ViewInGenStruct' : Shows images where each edge has a color 0022 % proportional (relative to nruns) to the times it has been present in the structures 0023 % learned in those generations included in viewparams{2}. 0024 % There is one figure for each generation. 0025 % For showing all the generations, set viewparams{2}=[1:ngen]. 0026 % viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the images. fs: Font size for the images 0027 % 0028 % 0029 % 'ViewEdgDepStruct' : Searches for substructures in the set of all the structures learned 0030 % and show the adjacency matrices corresponding to 0031 % the structures 0032 % viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the 0033 % images. fs: Font size for the images 0034 % viewparams{2}: Describe the substructure by giving values of 0035 % absence/presence to a subset of edges. (see Example below) 0036 % viewparams{3}: % Vector of with the selected runs that will be 0037 % inspected 0038 % viewparams{4}; % Vector of with the selected generations that will be 0039 % inspected 0040 % viewparams{5}; % Display type that could be one of the following: 0041 % 'all_graphs': There is an image for each structure that contain the 0042 % substructure. 0043 % 'one_graph': an image adding all the structures that contain the 0044 % substructure. 0045 % 'no_graph': no image is generated. This option is for the cases where we only 0046 % want the list of runs and generations where the substructure is 0047 % included. This is an output of the function (see ViewEdgDepStruct.m 0048 % for details) 0049 % 0050 % 'ViewPCStruct' : Searches for substructures in the set of all the structures learned 0051 % and show the parallel coordinates of the edges and the 0052 % generations at which they are learned. 0053 % viewparams{1} = fs; % fs: Font size for the images 0054 % viewparams{2} : Vector with indices of edges that will be shown. For showing all the edges, set viewparams{2}=[1:m]. 0055 % viewparams{3} = const_edg : Minimal number of times that an edge has to appear in (all) the structures learned 0056 % to be selected for visualization. 0057 % viewparams{4} : Method used to order the variables before displaying them 0058 % using parallel coordinates. Ordering may help to reduce cluttering, improving 0059 % visualization. viewparams{4} = 'none' if no ordering method is used. 0060 % Ordering methods can be implemented by the user. Currently implemented is 0061 % 'ClusterUsingCorr' which clusters togethers variables with strong 0062 % correlation. 0063 % 0064 % More than one than one kind of graphs can be generated in the same call to 0065 % the function by including several options together (see examples below) 0066 % User can add more methods for visualization by passing them the 0067 % appropriate output computed by ReadStructures.m (see program Help) 0068 % 0069 % OUTPUTS 0070 % 0071 % EXAMPLES 0072 % 0073 % First Example 0074 % [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); 0075 % [results] = ViewStructures(run_structures,20,maxgen,nruns,'viewmatrix_method','ViewSummStruct',{[150,14]},'viewmatrix_method','ViewInGenStruct',{[150,14];[1,5,10]}) 0076 % The first figure corresponds to edges learned in all runs, all 0077 % generations. The following figures corresponds to structures learned at 0078 % generations 1, 5, 10 computed using all runs. 0079 % 0080 % Second Example 0081 % We want to see all adjacency matrices of those structures learned in all runs 0082 % such that edges (3,4) and (4,5) appear together and edge (3,5) does not appear 0083 % viewparams{1} = [100,14]; 0084 % viewparams{2} = [3 4 1; 4 5 1; 3 5 0]; % The substructure is described 0085 % viewparams{3} = [1:nruns]; % Selected runs (All) 0086 % viewparams{4} = [1:maxgen]; % Selected generations (All) 0087 % viewparams{5} = 'all_graphs'; % Graphs to be seen (All) 0088 % [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); 0089 % [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewEdgDepStruct',viewparams) 0090 % 0091 % Third Example 0092 % Parallel coordinate visualization of the generations at which most 0093 % frequent edges appearing in the structures learned by an EDA 0094 % 0095 % viewparams{1} = [14]; 0096 % viewparams{2} = []; % The edges will be found by the algorithm 0097 % viewparams{3} = 60; % Only those edges that appear at least 20 times will be shown 0098 % viewparams{4} = 2; % Only substructures that have at least two edges are visualized in the PC 0099 % viewparams{5} = 'ClusterUsingDist'; % Variables will be ordered according correlation 0100 % viewparams{6} = 'correlation'; 0101 % [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); 0102 % [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewPCStruct',viewparams) 0103 % 0104 % Fourth Example 0105 % Glyph visualization of the generations at which most 0106 % frequent edges appearing in the structures learned by an EDA 0107 % 0108 % viewparams{1} = [14]; 0109 % viewparams{2} = results{3}; % The edges will be found by the algorithm 0110 % viewparams{3} = [1:10]; % Vector with the selected runs that will be inspected 0111 % viewparams{4} = [1:13]; % Vector of the selected generations that will be inspected 0112 % [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); 0113 % [newresults] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewGlyphStruct',viewparams) 0114 % 0115 % Fith Example 0116 % Dendrogram visualization of the generations at which most 0117 % frequent edges appearing in the structures learned by an EDA 0118 % 0119 % viewparams{1} = [14]; 0120 % viewparams{2} = []; % The edges will be found by the algorithm 0121 % viewparams{3} = 60; % Only those edges that appear at least 20 times will be shown 0122 % viewparams{4} = 2; % Only substructures that have at least two edges are visualized in the PC 0123 % viewparams{5} = 'correlation'; 0124 % [run_structures,maxgen,nruns] = ReadStructures('ProteinStructsExR.txt',20); 0125 % [results] = ViewStructures(run_structures,20,maxgen,nruns, 'viewmatrix_method','ViewDendroStruct',viewparams) 0126 % 0127 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es) 0128 0129 0130 % Default params value 0131 0132 viewparams{1}(1) = 100; % Range of colors 0133 viewparams{1}(2) = 14; % Font size 0134 0135 viewmethod = 'ViewSummStruct'; % Default view method 0136 0137 args = varargin; 0138 nargs = length(args); 0139 if length(args) > 0 0140 if isstr(args{1}) 0141 for i = 1:3:nargs 0142 switch args{i} 0143 case 'viewmatrix_method', viewmethod = args{i+1};, viewparams = args{i+2}; 0144 end; 0145 results = eval([viewmethod,'(run_structures,viewparams)']); 0146 end; 0147 end; 0148 end; 0149 0150 0151 0152 0153