]> git.donarmstrong.com Git - mothur.git/blobdiff - clusterclassic.cpp
added forward and reverse barcodes to trim.seqs to process illumina seqs
[mothur.git] / clusterclassic.cpp
index 0048dc6053d0bab06130eeaa6ab5d10b576aeb48..2d1b9a6b781960a824fddafc03b904e8039179e1 100644 (file)
@@ -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) {