Permalink
Browse files

Merge in v.1.39.0

  • Loading branch information...
2 parents 56f522b + 2abaf46 commit 8d9afcbd303278366947146b082e1d76e610dbf8 @pschloss pschloss committed Aug 5, 2016

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -152,6 +152,7 @@
#include "biominfocommand.h"
#include "renamefilecommand.h"
#include "chimeravsearchcommand.h"
+#include "mergecountcommand.hpp"
//needed for testing project
//CommandFactory* CommandFactory::_uniqueInstance;
@@ -327,6 +328,7 @@ CommandFactory::CommandFactory(){
commands["biom.info"] = "biom.info";
commands["set.seed"] = "set.seed";
commands["rename.file"] = "rename.file";
+ commands["merge.count"] = "merge.count";
}
@@ -526,6 +528,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
else if(commandName == "corr.axes") { command = new CorrAxesCommand(optionString); }
else if(commandName == "remove.rare") { command = new RemoveRareCommand(optionString); }
else if(commandName == "merge.groups") { command = new MergeGroupsCommand(optionString); }
+ else if(commandName == "merge.count") { command = new MergeCountCommand(optionString); }
else if(commandName == "amova") { command = new AmovaCommand(optionString); }
else if(commandName == "homova") { command = new HomovaCommand(optionString); }
else if(commandName == "mantel") { command = new MantelCommand(optionString); }
@@ -699,6 +702,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str
else if(commandName == "corr.axes") { pipecommand = new CorrAxesCommand(optionString); }
else if(commandName == "remove.rare") { pipecommand = new RemoveRareCommand(optionString); }
else if(commandName == "merge.groups") { pipecommand = new MergeGroupsCommand(optionString); }
+ else if(commandName == "merge.count") { pipecommand = new MergeCountCommand(optionString); }
else if(commandName == "amova") { pipecommand = new AmovaCommand(optionString); }
else if(commandName == "homova") { pipecommand = new HomovaCommand(optionString); }
else if(commandName == "mantel") { pipecommand = new MantelCommand(optionString); }
@@ -858,6 +862,7 @@ Command* CommandFactory::getCommand(string commandName){
else if(commandName == "corr.axes") { shellcommand = new CorrAxesCommand(); }
else if(commandName == "remove.rare") { shellcommand = new RemoveRareCommand(); }
else if(commandName == "merge.groups") { shellcommand = new MergeGroupsCommand(); }
+ else if(commandName == "merge.count") { shellcommand = new MergeCountCommand(); }
else if(commandName == "amova") { shellcommand = new AmovaCommand(); }
else if(commandName == "homova") { shellcommand = new HomovaCommand(); }
else if(commandName == "mantel") { shellcommand = new MantelCommand(); }
@@ -973,11 +978,15 @@ bool CommandFactory::isValidCommand(string command, string noError) {
/***********************************************************************/
void CommandFactory::printCommands(ostream& out) {
try {
- out << "Valid commands are: ";
- for (it = commands.begin(); it != commands.end(); it++) {
- out << it->first << ",";
+ it = commands.begin();
+ out << "Valid commands are: " << it->first << ", ";
+ it++;
+ out << it->first;
+ it++;
+ for (; it != commands.end(); it++) {
+ out << ", " << it->first;
}
- out << endl;
+ out << "." << endl;
}
catch(exception& e) {
m->errorOut(e, "CommandFactory", "printCommands");
@@ -32,8 +32,7 @@ vector<string> ClusterCommand::setParameters(){
CommandParameter pshowabund("showabund", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pshowabund);
CommandParameter ptiming("timing", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(ptiming);
CommandParameter psim("sim", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(psim);
- CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard);
- CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
+ CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
//CommandParameter padjust("adjust", "String", "", "F", "", "", "","",false,false); parameters.push_back(padjust);
CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors);
@@ -259,10 +258,7 @@ ClusterCommand::ClusterCommand(string option) {
if (temp == "not found") { temp = "100"; }
//saves precision legnth for formatting below
length = temp.length();
- m->mothurConvert(temp, precision);
-
- temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; }
- hard = m->isTrue(temp);
+ m->mothurConvert(temp, precision);
temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; }
sim = m->isTrue(temp);
@@ -323,7 +319,6 @@ ClusterCommand::ClusterCommand(string option) {
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"; }
@@ -356,9 +351,7 @@ int ClusterCommand::execute(){
else if (countfile != "") { inputString += ", count=" + countfile; }
inputString += ", precision=" + toString(precision);
inputString += ", method=" + method;
- if (hard) { inputString += ", hard=T"; }
- else { inputString += ", hard=F"; }
- if (sim) { inputString += ", sim=T"; }
+ if (sim) { inputString += ", sim=T"; }
else { inputString += ", sim=F"; }
@@ -736,12 +729,7 @@ int ClusterCommand::runMothurCluster(){
cluster->update(cutoff);
float dist = matrix->getSmallDist();
- float rndDist;
- if (hard) {
- rndDist = m->ceilDist(dist, precision);
- }else{
- rndDist = m->roundDist(dist, precision);
- }
+ float rndDist = m->ceilDist(dist, precision);
if(previousDist <= 0.0000 && dist != previousDist){
printData("unique", counts);
@@ -780,10 +768,8 @@ int ClusterCommand::runMothurCluster(){
}
listFile.close();
- if (saveCutoff != cutoff) {
- if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); }
- else { saveCutoff = m->roundDist(saveCutoff, precision); }
-
+ if (saveCutoff != cutoff) {
+ saveCutoff = m->ceilDist(saveCutoff, precision);
m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();
}
@@ -19,7 +19,6 @@ vector<string> ClusterDoturCommand::setParameters(){
CommandParameter pcutoff("cutoff", "Number", "", "10", "", "", "","",false,false,true); parameters.push_back(pcutoff);
CommandParameter pprecision("precision", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pprecision);
CommandParameter pmethod("method", "Multiple", "furthest-nearest-average-weighted", "average", "", "", "","",false,false); parameters.push_back(pmethod);
- CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard);
CommandParameter psim("sim", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(psim);
CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
@@ -39,7 +38,7 @@ string ClusterDoturCommand::getHelpString(){
try {
string helpString = "";
helpString += "The cluster.classic command clusters using the algorithm from dotur. \n";
- helpString += "The cluster.classic command parameter options are phylip, name, count, method, cuttoff, hard, sim, precision. Phylip is required, unless you have a valid current file.\n";
+ helpString += "The cluster.classic command parameter options are phylip, name, count, method, cuttoff, sim, precision. Phylip is required, unless you have a valid current file.\n";
helpString += "The cluster.classic command should be in the following format: \n";
helpString += "cluster.classic(phylip=yourDistanceMatrix, method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n";
helpString += "The acceptable cluster methods are furthest, nearest, weighted and average. If no method is provided then average is assumed.\n";
@@ -183,11 +182,7 @@ ClusterDoturCommand::ClusterDoturCommand(string option) {
temp = validParameter.validFile(parameters, "cutoff", false);
if (temp == "not found") { temp = "10"; }
- m->mothurConvert(temp, cutoff);
- cutoff += (5 / (precision * 10.0));
-
- temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; }
- hard = m->isTrue(temp);
+ m->mothurConvert(temp, cutoff);
temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; }
sim = m->isTrue(temp);
@@ -280,12 +275,7 @@ int ClusterDoturCommand::execute(){
cluster->update(cutoff);
float dist = cluster->getSmallDist();
- float rndDist;
- if (hard) {
- rndDist = m->ceilDist(dist, precision);
- }else{
- rndDist = m->roundDist(dist, precision);
- }
+ float rndDist = m->ceilDist(dist, precision);
if(previousDist <= 0.0000 && dist != previousDist){
printData("unique", counts);
@@ -37,7 +37,7 @@ class ClusterDoturCommand : public Command {
void help() { m->mothurOut(getHelpString()); }
private:
- bool abort, hard, sim;
+ bool abort, sim;
string method, fileroot, tag, outputDir, phylipfile, namefile, countfile;
double cutoff;
int precision, length;
@@ -341,9 +341,6 @@ ClusterSplitCommand::ClusterSplitCommand(string option) {
length = temp.length();
m->mothurConvert(temp, precision);
- temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; }
- hard = m->isTrue(temp);
-
temp = validParameter.validFile(parameters, "large", false); if (temp == "not found") { temp = "F"; }
large = m->isTrue(temp);
@@ -395,6 +392,7 @@ ClusterSplitCommand::ClusterSplitCommand(string option) {
temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { cutoffNotSet = true; temp = "1.0"; }
m->mothurConvert(temp, cutoff);
+
if (method != "opti") { cutoff += (5 / (precision * 10.0)); }
if ((splitmethod == "distance") || (splitmethod == "classify") || (splitmethod == "fasta")) { }
@@ -1188,13 +1186,8 @@ string ClusterSplitCommand::clusterClassicFile(string thisDistFile, string thisN
cluster->update(cutoff);
float dist = cluster->getSmallDist();
- float rndDist;
- if (hard) {
- rndDist = m->ceilDist(dist, precision);
- }else{
- rndDist = m->roundDist(dist, precision);
- }
-
+ float rndDist = m->ceilDist(dist, precision);
+
if(previousDist <= 0.0000 && dist != previousDist){
oldList.setLabel("unique");
oldList.print(listFile);
@@ -1328,12 +1321,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile
cluster->update(saveCutoff);
float dist = matrix->getSmallDist();
- float rndDist;
- if (hard) {
- rndDist = m->ceilDist(dist, precision);
- }else{
- rndDist = m->roundDist(dist, precision);
- }
+ float rndDist = m->ceilDist(dist, precision);
if(previousDist <= 0.0000 && dist != previousDist){
oldList.setLabel("unique");
@@ -1378,9 +1366,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile
}
if (saveCutoff != cutoff) {
- if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); }
- else { saveCutoff = m->roundDist(saveCutoff, precision); }
-
+ saveCutoff = m->ceilDist(saveCutoff, precision);
m->mothurOut("Cutoff was " + toString(cutoff) + " changed cutoff to " + toString(saveCutoff)); m->mothurOutEndLine();
}
@@ -54,6 +54,7 @@ class ClusterSplitCommand : public Command {
double cutoff, splitcutoff, stableMetric, numSingletons;
int precision, length, processors, taxLevelCutoff, maxIters;
bool print_start, abort, hard, large, classic, runCluster, deleteFiles, isList, cutoffNotSet, makeDist;
+
time_t start;
ofstream outList, outRabund, outSabund;
@@ -589,7 +589,7 @@ set<string> GetMIMarksPackageCommand::createGroupNames(Oligos& oligos) {
//overwrite global oligos - assume fastq data like make.contigs
Oligos oligos;
if ((fileOption == 3) || (fileOption == 5)) { oligos.read(oligosfile, false); } //like make.contigs
- else { oligos.read(oligosfile); }
+ else { oligos.read(oligosfile, false); }
map<int, oligosPair> barcodes = oligos.getPairedBarcodes();
map<int, oligosPair> primers = oligos.getPairedPrimers();
Oops, something went wrong.

0 comments on commit 8d9afcb

Please sign in to comment.