vector<int> ambigBases;
vector<int> longHomoPolymer;
- if (namefile != "") { readNames(); }
+ if (namefile != "") { nameMap = m->readNames(namefile); }
if (m->control_pressed) { return 0; }
sort(seqLength.begin(), seqLength.end());
sort(ambigBases.begin(), ambigBases.end());
sort(longHomoPolymer.begin(), longHomoPolymer.end());
-
- int ptile0_25 = int(numSeqs * 0.025);
- int ptile25 = int(numSeqs * 0.250);
- int ptile50 = int(numSeqs * 0.500);
- int ptile75 = int(numSeqs * 0.750);
- int ptile97_5 = int(numSeqs * 0.975);
- int ptile100 = numSeqs - 1;
+ int size = startPosition.size();
+
+ int ptile0_25 = int(size * 0.025);
+ int ptile25 = int(size * 0.250);
+ int ptile50 = int(size * 0.500);
+ int ptile75 = int(size * 0.750);
+ int ptile97_5 = int(size * 0.975);
+ int ptile100 = size - 1;
//to compensate for blank sequences that would result in startPosition and endPostion equalling -1
if (startPosition[0] == -1) { startPosition[0] = 0; }
//make sure this sequence is in the namefile, else error
map<string, int>::iterator it = nameMap.find(current.getName());
- if (it == nameMap.end()) { m->mothurOut("[ERROR]: " + current.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); m->control_pressed = true; }
+ if (it == nameMap.end()) { cout << "[ERROR]: " << current.getName() << " is not in your namefile, please correct." << endl; m->control_pressed = true; }
else { num = it->second; }
}
}
}
/**********************************************************************************************************************/
-int SeqSummaryCommand::readNames() {
- try {
- //open input file
- ifstream in;
- m->openInputFile(namefile, in);
-
- while (!in.eof()) {
- if (m->control_pressed) { break; }
-
- string firstCol, secondCol;
- in >> firstCol >> secondCol; m->gobble(in);
-
- int num = m->getNumNames(secondCol);
-
- nameMap[firstCol] = num;
- }
- in.close();
-
- return 0;
-
- }
- catch(exception& e) {
- m->errorOut(e, "SeqSummaryCommand", "readNames");
- exit(1);
- }
-}
-
-/**********************************************************************************************************************/