+ //phylip file given and cutoff not given - use cluster.classic because it uses less memory and is faster
+ if ((format == "phylip") && (cutoff > 10.0)) {
+ m->mothurOutEndLine(); m->mothurOut("You are using a phylip file and no cutoff. I will run cluster.classic to save memory and time."); m->mothurOutEndLine();
+
+ //run unique.seqs for deconvolute results
+ string inputString = "phylip=" + distfile;
+ if (namefile != "") { inputString += ", name=" + namefile; }
+ inputString += ", precision=" + toString(precision);
+ inputString += ", method=" + method;
+ if (hard) { inputString += ", hard=T"; }
+ else { inputString += ", hard=F"; }
+ if (sim) { inputString += ", sim=T"; }
+ else { inputString += ", sim=F"; }
+
+
+ m->mothurOutEndLine();
+ m->mothurOut("/------------------------------------------------------------/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: cluster.classic(" + inputString + ")"); m->mothurOutEndLine();
+
+ Command* clusterClassicCommand = new ClusterDoturCommand(inputString);
+ clusterClassicCommand->execute();
+ delete clusterClassicCommand;
+
+ m->mothurOut("/------------------------------------------------------------/"); m->mothurOutEndLine();
+
+ return 0;
+ }
+
+ ReadMatrix* read;
+ if (format == "column") { read = new ReadColumnMatrix(columnfile, sim); } //sim indicates whether its a similarity matrix
+ else if (format == "phylip") { read = new ReadPhylipMatrix(phylipfile, sim); }
+
+ read->setCutoff(cutoff);
+
+ NameAssignment* nameMap = NULL;
+ if(namefile != ""){
+ nameMap = new NameAssignment(namefile);
+ nameMap->readMap();
+ }
+
+ read->read(nameMap);
+ list = read->getListVector();
+ matrix = read->getMatrix();
+ rabund = new RAbundVector(list->getRAbundVector());
+ delete read;
+
+ if (m->control_pressed) { //clean up
+ delete list; delete matrix; delete rabund;
+ sabundFile.close();rabundFile.close();listFile.close();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
+ return 0;
+ }
+
+ //create cluster
+ 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 += m->hasPath(distfile); }
+ fileroot = outputDir + m->getRootName(m->getSimpleName(distfile));
+
+ m->openOutputFile(fileroot+ tag + ".sabund", sabundFile);
+ m->openOutputFile(fileroot+ tag + ".rabund", rabundFile);
+ m->openOutputFile(fileroot+ tag + ".list", listFile);
+
+ outputNames.push_back(fileroot+ tag + ".sabund"); outputTypes["sabund"].push_back(fileroot+ tag + ".sabund");
+ outputNames.push_back(fileroot+ tag + ".rabund"); outputTypes["rabund"].push_back(fileroot+ tag + ".rabund");
+ outputNames.push_back(fileroot+ tag + ".list"); outputTypes["list"].push_back(fileroot+ tag + ".list");
+
+