Permalink
Browse files

Adds group name check to designmap

  • Loading branch information...
1 parent 82f62ff commit f1112ecd78687634bb16e341f16bdbd5085de7d6 @mothur-westcott mothur-westcott committed Jul 14, 2016
Showing with 6 additions and 1 deletion.
  1. +6 −1 source/datastructures/designmap.cpp
@@ -67,13 +67,15 @@ int DesignMap::read(string file) {
//file without headers, fix it
if (temp != "group") {
group = temp;
+ m->checkGroupName(group);
if (m->debug) { m->mothurOut("[DEBUG]: group = " + group + "\n"); }
//if group info, then read it
vector<string> categoryValues; categoryValues.resize(numCategories, "not found");
for (int i = 0; i < numCategories; i++) {
int thisIndex = indexCategoryMap[originalGroupIndexes[i]]; //find index of this category because we sort the values.
string temp = tempColumnHeaders[i];
+ m->checkGroupName(temp);
categoryValues[thisIndex] = temp;
if (m->debug) { m->mothurOut("[DEBUG]: value = " + temp + "\n"); }
@@ -101,7 +103,8 @@ int DesignMap::read(string file) {
if (m->control_pressed) { break; }
- in >> group; m->gobble(in);
+ in >> group; m->gobble(in);
+ m->checkGroupName(group);
if (m->debug) { m->mothurOut("[DEBUG]: group = " + group + "\n"); }
//if group info, then read it
@@ -110,6 +113,7 @@ int DesignMap::read(string file) {
int thisIndex = indexCategoryMap[originalGroupIndexes[i]]; //find index of this category because we sort the values.
string temp = "not found";
in >> temp; categoryValues[thisIndex] = temp; m->gobble(in);
+ m->checkGroupName(temp);
if (m->debug) { m->mothurOut("[DEBUG]: value = " + temp + "\n"); }
@@ -231,6 +235,7 @@ string DesignMap::get(string groupName, string categoryName) {
//add group, assumes order is correct
int DesignMap::push_back(string group, vector<string> values) {
try {
+ m->checkGroupName(group);
map<string, int>::iterator it = indexGroupNameMap.find(group);
if (it == indexGroupNameMap.end()) {
if (values.size() != getNumCategories()) { m->mothurOut("[ERROR]: Your design file has a " + toString(getNumCategories()) + " categories and " + group + " has " + toString(values.size()) + ", please correct."); m->mothurOutEndLine(); m->control_pressed = true; return 0; }

0 comments on commit f1112ec

Please sign in to comment.