+ string seqRepName = "";
+ int numSeqsRep = 0;
+
+ if (countfile == "") {
+ sort(binNames.begin(), binNames.end());
+ bin = "";
+ for (int j = 0; j < binNames.size()-1; j++) {
+ bin += binNames[j] + ',';
+ }
+ bin += binNames[binNames.size()-1];
+ map<string, string>::iterator it = repNames.find(bin);
+
+ if (it == repNames.end()) {
+ m->mothurOut("[ERROR: OTU " + otuLabels[index] + " is not in the repnames file. Make sure you are using files for the same distance.\n"); m->control_pressed = true; break;
+ }else { seqRepName = it->second; numSeqsRep = binNames.size(); }
+
+ //sanity check
+ if (binNames.size() != classifyOtuSizes[index]) {
+ m->mothurOut("[ERROR: OTU " + otuLabels[index] + " contains " + toString(binNames.size()) + " sequence, but the rep and taxonomy files indicated this OTU should have " + toString(classifyOtuSizes[index]) + ". Make sure you are using files for the same distance.\n"); m->control_pressed = true; break;
+ }
+ }else {
+ //find rep sequence in bin
+ for (int j = 0; j < binNames.size(); j++) {
+ map<string, int>::iterator itNameMap = nameMap.find(binNames[j]); //if you are in the counttable you must be the rep. because get.oturep with a countfile only includes the rep sequences in the rep.count file.
+ if (itNameMap != nameMap.end()) {
+ seqRepName = itNameMap->first;
+ numSeqsRep = itNameMap->second;
+ j += binNames.size();
+ }
+ }
+
+ if (seqRepName == "") {
+ m->mothurOut("[ERROR: OTU " + otuLabels[index] + " is not in the count file. Make sure you are using files for the same distance.\n"); m->control_pressed = true; break;
+ }
+
+ if (numSeqsRep != classifyOtuSizes[i]) {
+ m->mothurOut("[ERROR: OTU " + otuLabels[index] + " contains " + toString(numSeqsRep) + " sequence, but the rep and taxonomy files indicated this OTU should have " + toString(classifyOtuSizes[index]) + ". Make sure you are using files for the same distance.\n"); m->control_pressed = true; break;
+ }