5 // Created by SarahsWork on 6/17/13.
6 // Copyright (c) 2013 Schloss Lab. All rights reserved.
9 #ifndef __Mothur__designmap__
10 #define __Mothur__designmap__
12 #include "mothurout.h"
14 /* This class is a representation of the design file.
16 group treatment sex age
17 F000142 Early female young
26 DesignMap() { m = MothurOut::getInstance(); defaultClass = "not found"; }
31 string get(string, string); //groupName, category returns value. example F000132, sex -> male
32 string get(string); //groupName, returns first categories value. example F000132, -> late
33 vector<string> getValues(string); //categoryName, returns values. example treatment, -> early,late,mid
34 int set(string, map<string, string>); //groupName, map<category, value>
35 int push_back(string, vector<string>); //groupName, vector<value> - assumes you put values in order of getNamesOfCategories
36 vector<string> getNamesOfCategories() {
37 sort(namesOfCategories.begin(), namesOfCategories.end());
38 return namesOfCategories;
40 int getNumCategories() { return namesOfCategories.size(); }
41 int getNum() { return designMap.size(); }
42 int getNumUnique(map<string, vector<string> >); //get number of groups belonging to a category or set of categories, with value or a set of values. Must have all categories and values. Example:
43 // map<treatment - > early, late>, <sex -> male> would return 1. Only one group is male and from early or late.
44 int getNumShared(map<string, vector<string> >); //get number of groups belonging to a category or set of categories, with value or a set of values. Must have at least one categories and values. Example:
45 // map<treatment - > early, late>, <sex -> male> would return 3. All three group have are either male or from early or late.
47 vector<string> getNames();
48 vector<string> getNames(string, string); //get names group from category and value.
49 vector<string> getNamesUnique(map<string, vector<string> >); //get names of groups belonging to a category or set of categories, with value or a set of values. Must have all categories and values. Example:
50 // map<treatment - > early, late>, <sex -> male> would return F000132. F000132 is the only group which is male and from early or late.
51 vector<string> getNamesShared(map<string, vector<string> >); //get names of groups belonging to a category or set of categories, with value or a set of values. Must have at least one categories and values. Example:
52 // map<treatment - > early, late>, <sex -> male> would return F000132, F000142, F000138. All three group have are either male or from early or late.
55 int print(ofstream&, vector<string>); //print certain categories
57 string getDefaultClass() { return defaultClass; }
61 vector<string> namesOfCategories;
63 vector< vector<string> > designMap;
64 vector< map<string, int> > totalCategories; //for each category, total groups assigned to it. vector[0] early -> 1, vector[1] male -> 2
65 map<string, int> indexNameMap;
66 map<string, int> indexCategoryMap;
70 #endif /* defined(__Mothur__designmap__) */