]> git.donarmstrong.com Git - mothur.git/blobdiff - clustercommand.cpp
added parse.list command
[mothur.git] / clustercommand.cpp
index 9d09d2cbe465da6531bbf720f0fd7d89aec08bce..e4e2d2104e3af44829990b01cef6782147359b98 100644 (file)
@@ -84,9 +84,9 @@ ClusterCommand::ClusterCommand(string option){
                                }
                                
                                //create cluster
-                               if (method == "furthest")       {       cluster = new CompleteLinkage(rabund, list, matrix, cutoff); }
-                               else if(method == "nearest"){   cluster = new SingleLinkage(rabund, list, matrix, cutoff); }
-                               else if(method == "average"){   cluster = new AverageLinkage(rabund, list, matrix, cutoff);     }
+                               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);     }
                                tag = cluster->getTag();
                                
                                if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
@@ -146,6 +146,7 @@ int ClusterCommand::execute(){
                print_start = true;
                start = time(NULL);
                loops = 0;
+               double saveCutoff = cutoff;
                
                while (matrix->getSmallDist() < cutoff && matrix->getNNodes() > 0){
                        if (print_start && isTrue(timing)) {
@@ -158,7 +159,7 @@ int ClusterCommand::execute(){
 
                        loops++;
 
-                       cluster->update();
+                       cluster->update(cutoff);
                        float dist = matrix->getSmallDist();
                        float rndDist = roundDist(dist, precision);
 
@@ -204,9 +205,14 @@ int ClusterCommand::execute(){
                sabundFile.close();
                rabundFile.close();
                listFile.close();
+               
+               if (saveCutoff != cutoff) { mothurOut("changed cutoff to " + toString(cutoff)); mothurOutEndLine();  }
+               
                //if (isTrue(timing)) {
                        mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster"); mothurOutEndLine();
                //}
+               
+               
                return 0;
        }
        catch(exception& e) {