- string Array[] = {"cutoff","precision","method","showabund","timing","outputdir","inputdir"};
+ string Array[] = {"cutoff","precision","method","showabund","timing","hard","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
temp = validParameter.validFile(parameters, "cutoff", false);
if (temp == "not found") { temp = "10"; }
convert(temp, cutoff);
temp = validParameter.validFile(parameters, "cutoff", false);
if (temp == "not found") { temp = "10"; }
convert(temp, cutoff);
method = validParameter.validFile(parameters, "method", false);
if (method == "not found") { method = "furthest"; }
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"; }
showabund = validParameter.validFile(parameters, "showabund", false);
if (showabund == "not found") { showabund = "T"; }
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); }
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); }
- if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
- fileroot = outputDir + getRootName(getSimpleName(globaldata->inputFileName));
+ if (outputDir == "") { outputDir += m->hasPath(globaldata->inputFileName); }
+ fileroot = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName));
- openOutputFile(fileroot+ tag + ".sabund", sabundFile);
- openOutputFile(fileroot+ tag + ".rabund", rabundFile);
- openOutputFile(fileroot+ tag + ".list", listFile);
+ m->openOutputFile(fileroot+ tag + ".sabund", sabundFile);
+ m->openOutputFile(fileroot+ tag + ".rabund", rabundFile);
+ m->openOutputFile(fileroot+ tag + ".list", listFile);
void ClusterCommand::help(){
try {
m->mothurOut("The cluster command can only be executed after a successful read.dist command.\n");
void ClusterCommand::help(){
try {
m->mothurOut("The cluster command can only be executed after a successful read.dist command.\n");
- m->mothurOut("The cluster command parameter options are method, cuttoff, precision, showabund and timing. No parameters are required.\n");
+ m->mothurOut("The cluster command parameter options are method, cuttoff, hard, precision, showabund and timing. No parameters are required.\n");
m->mothurOut("The cluster command should be in the following format: \n");
m->mothurOut("cluster(method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
m->mothurOut("The acceptable cluster methods are furthest, nearest and average. If no method is provided then furthest is assumed.\n\n");
m->mothurOut("The cluster command should be in the following format: \n");
m->mothurOut("cluster(method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
m->mothurOut("The acceptable cluster methods are furthest, nearest and average. If no method is provided then furthest is assumed.\n\n");
- float rndDist = roundDist(dist, precision);
+ float rndDist;
+ if (hard) {
+ rndDist = m->ceilDist(dist, precision);
+ }else{
+ rndDist = m->roundDist(dist, precision);
+ }
m->mothurOut("Clustering (" + tag + ") for distance " + toString(previousDist) + "/" + toString(rndPreviousDist)
+ "\t(precision: " + toString(precision) + ", Nodes: " + toString(matrix->getNNodes()) + ")");
cout.flush();
m->mothurOut("Clustering (" + tag + ") for distance " + toString(previousDist) + "/" + toString(rndPreviousDist)
+ "\t(precision: " + toString(precision) + ", Nodes: " + toString(matrix->getNNodes()) + ")");
cout.flush();
//delete globaldata's copy of the sparsematrix and listvector to free up memory
delete globaldata->gSparseMatrix; globaldata->gSparseMatrix = NULL;
delete globaldata->gListVector; globaldata->gListVector = NULL;
//delete globaldata's copy of the sparsematrix and listvector to free up memory
delete globaldata->gSparseMatrix; globaldata->gSparseMatrix = NULL;
delete globaldata->gListVector; globaldata->gListVector = NULL;
//saves .list file so you can do the collect, rarefaction and summary commands without doing a read.list
if (globaldata->getFormat() == "phylip") { globaldata->setPhylipFile(""); }
else if (globaldata->getFormat() == "column") { globaldata->setColumnFile(""); }
//saves .list file so you can do the collect, rarefaction and summary commands without doing a read.list
if (globaldata->getFormat() == "phylip") { globaldata->setPhylipFile(""); }
else if (globaldata->getFormat() == "column") { globaldata->setColumnFile(""); }
-
- if (saveCutoff != cutoff) { m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine(); }
+
+ if (saveCutoff != cutoff) {
+ if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); }
+ else { saveCutoff = m->roundDist(saveCutoff, precision); }
+
+ m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();
+ }
m->mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins())
+ "\tclusters. Updates: " + toString(loops)); m->mothurOutEndLine();
}
m->mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins())
+ "\tclusters. Updates: " + toString(loops)); m->mothurOutEndLine();
}