it = parameters.find("phylip");
//user has given a template file
if(it != parameters.end()){
- path = hasPath(it->second);
+ path = m->hasPath(it->second);
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["phylip"] = inputDir + it->second; }
}
it = parameters.find("column");
//user has given a template file
if(it != parameters.end()){
- path = hasPath(it->second);
+ path = m->hasPath(it->second);
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["column"] = inputDir + it->second; }
}
it = parameters.find("name");
//user has given a template file
if(it != parameters.end()){
- path = hasPath(it->second);
+ path = m->hasPath(it->second);
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["name"] = inputDir + it->second; }
}
convert(temp, precision);
temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "F"; }
- hard = isTrue(temp);
+ hard = m->isTrue(temp);
temp = validParameter.validFile(parameters, "cutoff", false);
if (temp == "not found") { temp = "10"; }
convert(temp, cutoff);
- if (!hard) { cutoff += (5 / (precision * 10.0)); }
+ cutoff += (5 / (precision * 10.0));
method = validParameter.validFile(parameters, "method", false);
if (method == "not found") { method = "furthest"; }
sort = validParameter.validFile(parameters, "sorted", false);
if (sort == "not found") { sort = "F"; }
- sorted = isTrue(sort);
+ sorted = m->isTrue(sort);
timing = validParameter.validFile(parameters, "timing", false);
if (timing == "not found") { timing = "F"; }
if (abort == false) {
- if (outputDir == "") { outputDir += hasPath(distfile); }
- fileroot = outputDir + getRootName(getSimpleName(distfile));
+ if (outputDir == "") { outputDir += m->hasPath(distfile); }
+ fileroot = outputDir + m->getRootName(m->getSimpleName(distfile));
if (method == "furthest") { tag = "fn"; }
else if (method == "nearest") { tag = "nn"; }
else { tag = "an"; }
- 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);
outputNames.push_back(fileroot+ tag + ".sabund");
outputNames.push_back(fileroot+ tag + ".rabund");
m->mothurOut("The name parameter allows you to enter your name file and is required if your distance file is in column format. \n");
m->mothurOut("The hcluster command should be in the following format: \n");
m->mothurOut("hcluster(column=youDistanceFile, name=yourNameFile, method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
- m->mothurOut("The acceptable hcluster methods are furthest and nearest, but we hope to add average in the future.\n\n");
+ m->mothurOut("The acceptable hcluster methods are furthest, nearest and average.\n\n");
}
catch(exception& e) {
m->errorOut(e, "HClusterCommand", "help");
time_t estart = time(NULL);
if (!sorted) {
- read = new ReadCluster(distfile, cutoff, outputDir);
+ read = new ReadCluster(distfile, cutoff, outputDir, true);
read->setFormat(format);
read->read(globaldata->nameMap);
return 0;
}
-
- float rndDist = roundDist(seqs[i].dist, precision);
+
+ float rndDist;
+ if (hard) {
+ rndDist = m->ceilDist(seqs[i].dist, precision);
+ }else{
+ rndDist = m->roundDist(seqs[i].dist, precision);
+ }
+
if((previousDist <= 0.0000) && (seqs[i].dist != previousDist)){
printData("unique");
void HClusterCommand::printData(string label){
try {
- if (isTrue(timing)) {
+ if (m->isTrue(timing)) {
m->mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins())
+ "\tclusters. Updates: " + toString(loops)); m->mothurOutEndLine();
}
start = time(NULL);
oldRAbund.setLabel(label);
- if (isTrue(showabund)) {
+ if (m->isTrue(showabund)) {
oldRAbund.getSAbundVector().print(cout);
}
oldRAbund.print(rabundFile);