]> git.donarmstrong.com Git - mothur.git/blobdiff - clustercommand.cpp
changed file divide for trim.seqs
[mothur.git] / clustercommand.cpp
index 30c45e167ad6a398b23727293577f92362f5d6c7..3f27560ae9bfbc69c5ac3d49875847a829f49bf3 100644 (file)
@@ -67,8 +67,8 @@ ClusterCommand::ClusterCommand(string option)  {
                        method = validParameter.validFile(parameters, "method", false);
                        if (method == "not found") { method = "furthest"; }
                        
-                       if ((method == "furthest") || (method == "nearest") || (method == "average")) { }
-                       else { m->mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); m->mothurOutEndLine(); abort = true; }
+                       if ((method == "furthest") || (method == "nearest") || (method == "average") || (method == "weighted")) { }
+                       else { m->mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest, average, and weighted."); m->mothurOutEndLine(); abort = true; }
 
                        showabund = validParameter.validFile(parameters, "showabund", false);
                        if (showabund == "not found") { showabund = "T"; }
@@ -91,6 +91,7 @@ ClusterCommand::ClusterCommand(string option)  {
                                if (method == "furthest")       {       cluster = new CompleteLinkage(rabund, list, matrix, cutoff, method); }
                                else if(method == "nearest"){   cluster = new SingleLinkage(rabund, list, matrix, cutoff, method); }
                                else if(method == "average"){   cluster = new AverageLinkage(rabund, list, matrix, cutoff, method);     }
+                               else if(method == "weighted"){  cluster = new WeightedLinkage(rabund, list, matrix, cutoff, method);    }
                                tag = cluster->getTag();
                                
                                if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
@@ -231,7 +232,12 @@ int ClusterCommand::execute(){
                rabundFile.close();
                listFile.close();
        
-               if (saveCutoff != cutoff) { m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();  }
+               if (saveCutoff != cutoff) { 
+                       if (hard)       {  saveCutoff = ceilDist(saveCutoff, precision);        }
+                       else            {       saveCutoff = roundDist(saveCutoff, precision);  }
+
+                       m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine(); 
+               }
                
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();