}
string temp = validParameter.validFile(parameters, "size", false); if (temp == "not found"){ temp = "0"; }
- convert(temp, size);
+ m->mothurConvert(temp, size);
temp = validParameter.validFile(parameters, "persample", false); if (temp == "not found"){ temp = "f"; }
persample = m->isTrue(temp);
if ((groupfile != "") && ((fastafile != "") && (listfile != ""))) {
m->mothurOut("A new group file can only be made from the subsample of a listfile or fastafile, not both. Please correct."); m->mothurOutEndLine(); abort = true; }
+ if ((fastafile != "") && (namefile == "")) {
+ vector<string> files; files.push_back(fastafile);
+ parser.getNameFile(files);
+ }
}
}
if (persample) {
//initialize counts
map<string, int> groupCounts;
+ map<string, int>::iterator itGroupCounts;
for (int i = 0; i < Groups.size(); i++) { groupCounts[Groups[i]] = 0; }
for (int j = 0; j < names.size(); j++) {
string group = groupMap->getGroup(names[j]);
if (group == "not found") { m->mothurOut("[ERROR]: " + names[j] + " is not in your groupfile. please correct."); m->mothurOutEndLine(); group = "NOTFOUND"; }
else{
- if (groupCounts[group] < size) { subset.insert(names[j]); }
+ itGroupCounts = groupCounts.find(group);
+ if (itGroupCounts != groupCounts.end()) {
+ if (groupCounts[group] < size) { subset.insert(names[j]); groupCounts[group]++; }
+ }
}
}
}else {
if (persample) {
//initialize counts
map<string, int> groupCounts;
+ map<string, int>::iterator itGroupCounts;
for (int i = 0; i < Groups.size(); i++) { groupCounts[Groups[i]] = 0; }
for (int j = 0; j < names.size(); j++) {
string group = groupMap->getGroup(names[j]);
if (group == "not found") { m->mothurOut("[ERROR]: " + names[j] + " is not in your groupfile. please correct."); m->mothurOutEndLine(); group = "NOTFOUND"; }
else{
- if (groupCounts[group] < size) { subset.insert(names[j]); }
+ itGroupCounts = groupCounts.find(group);
+ if (itGroupCounts != groupCounts.end()) {
+ if (groupCounts[group] < size) { subset.insert(names[j]); groupCounts[group]++; }
+ }
}
}
}else{