IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
parse_classmaps.m
Go to the documentation of this file.
1 %> @ingroup conversion classlabelsgroup string
2 %> @file
3 %> @brief Parses expression into classmaps
4 %>
5 %> Facilitates generation of lists of sub-datasets -- specified by the classes that go into each -- using expression
6 %> strings.
7 %>
8 %> "Variables" in @c ss must match class labels from the @hie_base level. Expression will be evaluated using @c eval()
9 %> after creating @c classsplitter objects whose variable names match those of the class labels of the @hie_base level.
10 %>
11 %> Possible operators are "+", "-" (unary minus), and "~".
12 %>
13 %> <h3>Example:</h3>
14 %> @code
15 %> if flag_julio
16 %> dslila = ul_load_data(1);
17 %> ss = {'-JT', '~-JT'};
18 %> else
19 %> dslila = ul_load_data(2);
20 %> ss = {'-AA', '~-AA'};
21 %> end;
22 %> dslila = data_select_hierarchy(dslila, [1, 2, 3]);
23 %> HIE_DATA = 1;
24 %> HIE_SPLIT = 2;
25 %> classmaps = parse_classmaps(ss, dslila.classlabels, HIE_DATA, HIE_SPLIT);
26 %> no_cases = numel(classmaps{1});
27 %> @endcode
28 %>
29 %> @sa classsplitter
30 %
31 %> @param ss Cell of strings.
32 %> @param classlabels
33 %> @param hie_base hierarchical dataset level
34 %> @param hie_split hierarchical split level
35 function maps = parse_classmaps(ss, classlabels, hie_base, hie_split)
36 
37 cellmaps = classlabels2cell(classlabels, hie_base);
38 varnames = unique(cellmaps(:, 3));
39 o = classsplitter();
40 o.classlabels = classlabels;
41 o.hie_base = hie_base;
42 o.hie_split = hie_split;
43 for i = 1:numel(varnames)
44  o = o.set_baselabel(varnames{i});
45  eval([varnames{i} ' = o;']);
46 end;
47 
48 for i = 1:numel(ss)
49  oo = eval(ss{i});
50  maps{i} = oo.map;
51 end;
52 
53 
54 
function data_select_hierarchy(in data, in hierarchy)
Used by parse_classmaps.m.
Definition: classsplitter.m:12
Property map
Definition: classsplitter.m:47
function parse_classmaps(in ss, in classlabels, in hie_base, in hie_split)
function classlabels2cell(in classlabels, in new_hierarchy)