else {
//valid paramters for this command
- string Array[] = {"cutoff","precision","method","showabund","timing"};
+ string Array[] = {"cutoff","precision","method","showabund","timing","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
}
}
+ //if the user changes the output directory command factory will send this info to us in the output parameter
+ outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
+
//error checking to make sure they read a distance file
if ((globaldata->gSparseMatrix == NULL) || (globaldata->gListVector == NULL)) {
mothurOut("Before you use the cluster command, you first need to read in a distance matrix."); mothurOutEndLine();
}
//create cluster
- if (method == "furthest") { cluster = new CompleteLinkage(rabund, list, matrix); }
- else if(method == "nearest"){ cluster = new SingleLinkage(rabund, list, matrix); }
- else if(method == "average"){ cluster = new AverageLinkage(rabund, list, matrix); }
+ 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); }
tag = cluster->getTag();
-
- fileroot = getRootName(globaldata->inputFileName);
+
+ if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
+ fileroot = outputDir + getRootName(getSimpleName(globaldata->inputFileName));
openOutputFile(fileroot+ tag + ".sabund", sabundFile);
openOutputFile(fileroot+ tag + ".rabund", rabundFile);
if (abort == true) { return 0; }
time_t estart = time(NULL);
- int ndist = matrix->getNNodes();
+ //int ndist = matrix->getNNodes();
float previousDist = 0.00000;
float rndPreviousDist = 0.00000;
oldRAbund = *rabund;
sabundFile.close();
rabundFile.close();
listFile.close();
- if (isTrue(timing)) {
- mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster " + toString(ndist) + " distances"); mothurOutEndLine();
- }
+ //if (isTrue(timing)) {
+ mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster"); mothurOutEndLine();
+ //}
return 0;
}
catch(exception& e) {