X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=clusterclassic.cpp;h=2d1b9a6b781960a824fddafc03b904e8039179e1;hb=8e67e9de1b200106bea5a468ac02125954656499;hp=0048dc6053d0bab06130eeaa6ab5d10b576aeb48;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/clusterclassic.cpp b/clusterclassic.cpp index 0048dc6..2d1b9a6 100644 --- a/clusterclassic.cpp +++ b/clusterclassic.cpp @@ -19,6 +19,10 @@ ClusterClassic::ClusterClassic(float c, string f, bool s) : method(f), smallDist cutoff = c; aboveCutoff = cutoff + 10000.0; m = MothurOut::getInstance(); + if(method == "furthest") { tag = "fn"; } + else if (method == "average") { tag = "an"; } + else if (method == "weighted") { tag = "wn"; } + else if (method == "nearest") { tag = "nn"; } } catch(exception& e) { m->errorOut(e, "ClusterClassic", "ClusterClassic"); @@ -36,7 +40,12 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) { ifstream fileHandle; m->openInputFile(filename, fileHandle); - fileHandle >> nseqs >> name; + string numTest; + fileHandle >> numTest >> name; + + if (!m->isContainingOnlyDigits(numTest)) { m->mothurOut("[ERROR]: expected a number and got " + numTest + ", quitting."); m->mothurOutEndLine(); exit(1); } + else { convert(numTest, nseqs); } + matrixNames.push_back(name); @@ -434,11 +443,11 @@ void ClusterClassic::print() { try { //update location of seqs in smallRow since they move to smallCol now for (int i = 0; i < dMatrix.size(); i++) { - cout << "row = " << i << '\t'; + m->mothurOut("row = " + toString(i) + "\t"); for (int j = 0; j < dMatrix[i].size(); j++) { - cout << dMatrix[i][j] << '\t'; + m->mothurOut(toString(dMatrix[i][j]) + "\t"); } - cout << endl; + m->mothurOutEndLine(); } } catch(exception& e) {