-Knn::Knn(string tfile, string tempFile, string method, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int n)
-: Classify(tfile, tempFile, method, kmerSize, gapOpen, gapExtend, match, misMatch), num(n) {}
+Knn::Knn(string tfile, string tempFile, string method, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int n, int tid)
+: Classify(), num(n), search(method) {
+ try {
+ threadID = tid;
+ shortcuts = true;
+
+ //create search database and names vector
+ generateDatabaseAndNames(tfile, tempFile, method, kmerSize, gapOpen, gapExtend, match, misMatch);
+ }
+ catch(exception& e) {
+ m->errorOut(e, "Knn", "Knn");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+void Knn::setDistName(string s) {
+ try {
+ outDistName = s;
+ ofstream outDistance;
+ m->openOutputFile(outDistName, outDistance);
+ outDistance << "Name\tBestMatch\tDistance" << endl;
+ outDistance.close();
+ }
+ catch(exception& e) {
+ m->errorOut(e, "Knn", "setDistName");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+Knn::~Knn() {
+ try {
+ delete phyloTree;
+ if (database != NULL) { delete database; }
+ }
+ catch(exception& e) {
+ m->errorOut(e, "Knn", "~Knn");
+ exit(1);
+ }
+}