Permalink
Browse files

Fixed negative values in opticluster for cluster command

  • Loading branch information...
1 parent d8d5d75 commit 419917496fc5c194e9d4e225991ea833120db7fc @mothur-westcott mothur-westcott committed Aug 11, 2016
Showing with 24 additions and 10 deletions.
  1. +9 −3 source/commands/clustercommand.cpp
  2. +15 −7 source/commands/clustersplitcommand.cpp
@@ -885,9 +885,15 @@ int ClusterCommand::runOptiCluster(){
iters++;
results = cluster.getStats();
- m->mothurOut(toString(iters) + "\t" + toString(cutoff) + "\t" + toString(cutoff) + "\t");
- for (int i = 0; i < results.size(); i++) { m->mothurOut(toString(results[i]) + "\t"); }
- m->mothurOutEndLine();
+
+ bool stop = false;
+ for (int i = 0; i < results.size(); i++) { if (results[i] < 0) { stop = true; } }
+ if (!stop) {
+ m->mothurOut(toString(iters) + "\t" + toString(cutoff) + "\t" + toString(cutoff) + "\t");
+ for (int i = 0; i < results.size(); i++) { m->mothurOut(toString(results[i]) + "\t"); }
+ m->mothurOutEndLine();
+ }else { break; }
+
}
m->mothurOutEndLine(); m->mothurOutEndLine();
@@ -408,6 +408,7 @@ ClusterSplitCommand::ClusterSplitCommand(string option) {
temp = validParameter.validFile(parameters, "dist", false); if (temp == "not found") { temp = "F"; }
makeDist = m->isTrue(temp);
if (method == "opti") { makeDist = true; }
+ if (((phylipfile != "") || (columnfile != "")) && (method == "opti")) { makeDist = false; }
if (((phylipfile != "") || (columnfile != "")) && makeDist) { m->mothurOut("[ERROR]: You already provided a distance matrix. Mothur will ignore the dist parameter.\n"); makeDist = false; }
if (classic && makeDist) { m->mothurOut("[ERROR]: You cannot use the dist parameter with the classic parameter. Mothur will ignore the dist parameter.\n"); makeDist = false; }
@@ -1647,13 +1648,20 @@ int ClusterSplitCommand::runSensSpec() {
if ((itTypes->second).size() != 0) { listFile = (itTypes->second)[0]; }
}
- string columnFile = "";
- itTypes = outputTypes.find("column");
- if (itTypes != outputTypes.end()) {
- if ((itTypes->second).size() != 0) { columnFile = (itTypes->second)[0]; }
- }
-
- string inputString = "list=" + listFile + ", column=" + columnFile;
+ string columnFile = ""; string phylipFile = "";
+ if (makeDist) {
+ itTypes = outputTypes.find("column");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { columnFile = (itTypes->second)[0]; }
+ }
+ }else if (columnfile != "") { columnFile = columnfile; }
+ else { phylipFile = phylipfile; }
+
+ string inputString = "list=" + listFile;
+ if (columnfile != "") { inputString += ", column=" + columnFile; }
+ else if (phylipfile != "") { inputString += ", phylip=" + phylipfile; }
+ else { m->mothurOut("[WARNING]: Cannot run sens.spec analysis without a phylip or column file, skipping."); return 0; }
+
if (namefile != "") { inputString += ", name=" + namefile; }
else if (countfile != "") { inputString += ", count=" + countfile; }
else { m->mothurOut("[WARNING]: Cannot run sens.spec analysis without a name or count file, skipping."); return 0; }

0 comments on commit 4199174

Please sign in to comment.