From fc821b8c4a333be95e9ccd5a48fc14f4de077ea3 Mon Sep 17 00:00:00 2001 From: Sarah Westcott Date: Wed, 20 Jul 2016 14:04:56 -0400 Subject: [PATCH] Adjusts cutoff for agc and dgc methods cluster and cluster.split #254 --- source/commands/clustercommand.cpp | 15 ++++++++------- source/commands/clustersplitcommand.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/source/commands/clustercommand.cpp b/source/commands/clustercommand.cpp index 1b35740e..1c0de93d 100644 --- a/source/commands/clustercommand.cpp +++ b/source/commands/clustercommand.cpp @@ -257,13 +257,6 @@ ClusterCommand::ClusterCommand(string option) { temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; } sim = m->isTrue(temp); - //bool cutoffSet = false; - temp = validParameter.validFile(parameters, "cutoff", false); - if (temp == "not found") { temp = "10"; } - //else { cutoffSet = true; } - m->mothurConvert(temp, cutoff); - cutoff += (5 / (precision * 10.0)); - //temp = validParameter.validFile(parameters, "adjust", false); if (temp == "not found") { temp = "F"; } //if (m->isNumeric1(temp)) { m->mothurConvert(temp, adjust); } //else if (m->isTrue(temp)) { adjust = 1.0; } @@ -283,6 +276,14 @@ ClusterCommand::ClusterCommand(string option) { #else if ((method == "agc") || (method == "dgc")) { m->mothurOut("[ERROR]: The agc and dgc clustering methods are not available for Windows, aborting\n."); abort = true; } #endif + + //bool cutoffSet = false; + temp = validParameter.validFile(parameters, "cutoff", false); + if (temp == "not found") { temp = "10"; } + //else { cutoffSet = true; } + m->mothurConvert(temp, cutoff); + if ((method != "agc") && (method != "dgc")) { cutoff += (5 / (precision * 10.0)); } + showabund = validParameter.validFile(parameters, "showabund", false); if (showabund == "not found") { showabund = "T"; } diff --git a/source/commands/clustersplitcommand.cpp b/source/commands/clustersplitcommand.cpp index 2362d7f4..41f61b70 100644 --- a/source/commands/clustersplitcommand.cpp +++ b/source/commands/clustersplitcommand.cpp @@ -346,11 +346,6 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { //not using file option and don't have fasta method with classic if (((splitmethod != "fasta") && classic) && (file == "")) { m->mothurOut("[ERROR]: splitmethod must be fasta to use cluster.classic, or you must use the file option.\n"); abort=true; } - - cutoffNotSet = false; - temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { cutoffNotSet = true; temp = "0.25"; } - m->mothurConvert(temp, cutoff); - cutoff += (5 / (precision * 10.0)); temp = validParameter.validFile(parameters, "taxlevel", false); if (temp == "not found") { temp = "3"; } m->mothurConvert(temp, taxLevelCutoff); @@ -369,6 +364,11 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { if ((method == "agc") || (method == "dgc")) { m->mothurOut("[ERROR]: The agc and dgc clustering methods are not available for Windows, aborting\n."); abort = true; } #endif + cutoffNotSet = false; + temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { cutoffNotSet = true; temp = "0.25"; } + m->mothurConvert(temp, cutoff); + if ((method != "agc") && (method != "dgc")) { cutoff += (5 / (precision * 10.0)); } + if ((splitmethod == "distance") || (splitmethod == "classify") || (splitmethod == "fasta")) { } else { m->mothurOut("[ERROR]: " + splitmethod + " is not a valid splitting method. Valid splitting algorithms are distance, classify or fasta."); m->mothurOutEndLine(); abort = true; }