Permalink
Browse files

Adds constaxonomy file to current files

  • Loading branch information...
1 parent 1a683be commit 7f0ffe00c67e6d6c9c1ae9a8b2d63af1f681137c @mothur-westcott mothur-westcott committed Jan 23, 2017
View
@@ -27,6 +27,9 @@ ifeq ($(strip $(OPTIMIZE)),yes)
CXXFLAGS += -O3
endif
+#CPP_11
+ CXXFLAGS += -std=c++11
+
CXXFLAGS += -DRELEASE_DATE=${RELEASE_DATE} -DVERSION=${VERSION} -O3
ifeq ($(strip $(MOTHUR_FILES)),"\"Enter_your_default_path_here\"")
@@ -3553,7 +3553,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
- CLANG_CXX_LIBRARY = "libc++";
+ CLANG_CXX_LIBRARY = "libstdc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = NO;
@@ -3591,7 +3591,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
- CLANG_CXX_LIBRARY = "libc++";
+ CLANG_CXX_LIBRARY = "libstdc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = NO;
View
@@ -91,6 +91,10 @@
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
+//inline std::string toString( std::nullptr_t null ) {
+// return "nullptr";
+//}
+
#ifdef __cplusplus
# if __cplusplus >= 201103L
@@ -41,23 +41,23 @@ TestOptiCluster::~TestOptiCluster() {
/**************************************************************************************************/
TEST_CASE("Testing OptiCluster Class") {
TestOptiCluster testOcluster;
- OptiMatrix matrix(testOcluster.columnFile, testOcluster.filenames[1], "name", 0.03, false);
+ OptiMatrix matrix(testOcluster.columnFile, testOcluster.filenames[1], "name", "column", 0.03, false);
testOcluster.setVariables(&matrix, "mcc");
SECTION("Testing Initialize") {
INFO("Using First 100 sequences of final.fasta and final.names") // Only appears on a FAIL
double initialMetricValue;
- CAPTURE(testOcluster.initialize(initialMetricValue, true)); //
+ CAPTURE(testOcluster.initialize(initialMetricValue, true, "singleton")); //
- CHECK(testOcluster.initialize(initialMetricValue, true) == 0); //metric value
+ CHECK(testOcluster.initialize(initialMetricValue, true, "singleton") == 0); //metric value
}
SECTION("Testing calcMCC") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ long long tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
CAPTURE(testOcluster.calcMCC(tp,tn,fp,fn)); // Displays this variable on a FAIL
@@ -67,7 +67,7 @@ TEST_CASE("Testing OptiCluster Class") {
SECTION("Testing calcSens") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ long long tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
CAPTURE(testOcluster.calcSens(tp,tn,fp,fn)); // Displays this variable on a FAIL
@@ -77,7 +77,7 @@ TEST_CASE("Testing OptiCluster Class") {
SECTION("Testing calcSpec") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ long long tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
CAPTURE(testOcluster.calcSpec(tp,tn,fp,fn)); // Displays this variable on a FAIL
@@ -87,23 +87,13 @@ TEST_CASE("Testing OptiCluster Class") {
SECTION("Testing calcTPTN") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ long long tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
CAPTURE(testOcluster.calcTPTN(tp,tn,fp,fn)); // Displays this variable on a FAIL
CHECK((int)(testOcluster.calcTPTN(tp,tn,fp,fn)*10000) == 9861); //metric value
}
- SECTION("Testing calcTP2TN") {
- INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
-
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
-
- CAPTURE(testOcluster.calcTP2TN(tp,tn,fp,fn)); // Displays this variable on a FAIL
-
- CHECK((int)(testOcluster.calcTP2TN(tp,tn,fp,fn)*10000) == 16436); //metric value
- }
-
SECTION("Testing calcFPFN") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
@@ -117,9 +107,9 @@ TEST_CASE("Testing OptiCluster Class") {
SECTION("Testing moveAdjustTFValues") {
INFO("Using tp=5000, tn=10000, fp=10, fn=200 and mcc") // Only appears on a FAIL
- double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ long long tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
double initialMetricValue;
- testOcluster.initialize(initialMetricValue, false); //no randomization
+ testOcluster.initialize(initialMetricValue, false, "singleton"); //no randomization
CAPTURE(testOcluster.moveAdjustTFValues(0, 10, 1, tp,tn,fp,fn)); // Displays this variable on a FAIL
@@ -130,7 +120,7 @@ TEST_CASE("Testing OptiCluster Class") {
INFO("Using mcc") // Only appears on a FAIL
double initialMetricValue;
- testOcluster.initialize(initialMetricValue, false); //no randomization
+ testOcluster.initialize(initialMetricValue, false, "singleton"); //no randomization
testOcluster.update(initialMetricValue);
CAPTURE(initialMetricValue); // Displays this variable on a FAIL
@@ -26,7 +26,6 @@ class TestOptiCluster : public OptiCluster {
using OptiCluster::calcSens;
using OptiCluster::calcSpec;
using OptiCluster::calcTPTN;
- using OptiCluster::calcTP2TN;
using OptiCluster::calcFPFN;
using OptiCluster::moveAdjustTFValues;
using OptiCluster::setVariables;
View
@@ -7,6 +7,8 @@ VERSION = "\"1.39.0\""
# Optimize to level 3:
CXXFLAGS += -O3
+#CPP_11
+ CXXFLAGS += -std=c++11
ifeq ($(strip $(64BIT_VERSION)),yes)
#if you are a mac user use the following line
@@ -192,6 +192,12 @@ int BiomInfoCommand::execute(){
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
}
+ //set constaxonomy file as new current constaxonomyfile
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
@@ -388,6 +388,13 @@ int ClassifyOtuCommand::execute(){
if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
+ //set constaxonomy file as new current constaxonomyfile
+ string current = "";
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
@@ -162,6 +162,8 @@ int GetCurrentCommand::execute(){
m->setAccnosFile("");
}else if (types[i] == "taxonomy") {
m->setTaxonomyFile("");
+ }else if (types[i] == "constaxonomy") {
+ m->setConsTaxonomyFile("");
}else if (types[i] == "flow") {
m->setFlowFile("");
}else if (types[i] == "biom") {
@@ -412,6 +412,12 @@ int GetLineageCommand::execute(){
if (itTypes != outputTypes.end()) {
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setCountTableFile(current); }
}
+
+ //set constaxonomy file as new current constaxonomyfile
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
}
return 0;
@@ -268,6 +268,12 @@ int GetOtuLabelsCommand::execute(){
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
}
+ //set constaxonomy file as new current constaxonomyfile
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
@@ -416,6 +416,12 @@ int RemoveLineageCommand::execute(){
if (itTypes != outputTypes.end()) {
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setCountTableFile(current); }
}
+
+ //set constaxonomy file as new current constaxonomyfile
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
}
return 0;
@@ -270,6 +270,12 @@ int RemoveOtuLabelsCommand::execute(){
if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
}
+ //set constaxonomy file as new current constaxonomyfile
+ itTypes = outputTypes.find("constaxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setConsTaxonomyFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
@@ -584,7 +584,7 @@ int RenameFileCommand::execute(){
if (constaxonomyfile != "") {
newName = getNewName(constaxonomyfile, "constaxonomy");
renameOrCopy(constaxonomyfile, newName);
- m->setTaxonomyFile(newName);
+ m->setConsTaxonomyFile(newName);
}
if (flowfile != "") {
newName = getNewName(flowfile, "flow");
@@ -644,8 +644,8 @@ string RenameFileCommand::getNewName(string name, string type){
}else { basicName = prefix; }
if ((type == "shared") || (type == "list") || (type == "relabund") || (type == "rabund") || (type == "sabund")) {
- vector<string> tags; tags.push_back(".an."); tags.push_back(".tx."); tags.push_back(".agc."); tags.push_back(".dgc."); tags.push_back(".nn."); tags.push_back(".fn."); tags.push_back(".wn.");
- vector<string> newTags; newTags.push_back("an"); newTags.push_back("tx"); newTags.push_back("agc"); newTags.push_back("dgc"); newTags.push_back("nn"); newTags.push_back("fn"); newTags.push_back("wn");
+ vector<string> tags; tags.push_back(".an."); tags.push_back(".tx."); tags.push_back(".agc."); tags.push_back(".dgc."); tags.push_back(".nn."); tags.push_back(".fn."); tags.push_back(".wn."); tags.push_back(".opti.");
+ vector<string> newTags; newTags.push_back("an"); newTags.push_back("tx"); newTags.push_back("agc"); newTags.push_back("dgc"); newTags.push_back("nn"); newTags.push_back("fn"); newTags.push_back("wn"); tags.push_back(".opti.");
for (int i = 0; i < tags.size(); i++) {
int pos2 = name.find_first_of(tags[i]);
@@ -25,6 +25,7 @@ vector<string> SetCurrentCommand::setParameters(){
CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pgroup);
CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(plist);
CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(ptaxonomy);
+ CommandParameter pconstaxonomy("constaxonomy", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pconstaxonomy);
CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pqfile);
CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(paccnos);
CommandParameter prabund("rabund", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(prabund);
@@ -58,7 +59,7 @@ string SetCurrentCommand::getHelpString(){
try {
string helpString = "";
helpString += "The set.current command allows you to set the current files saved by mothur.\n";
- helpString += "The set.current command parameters are: current, clear, phylip, column, list, rabund, sabund, name, group, design, order, tree, shared, ordergroup, relabund, fasta, qfile, sff, oligos, accnos, biom, count, summary, file and taxonomy.\n";
+ helpString += "The set.current command parameters are: current, clear, phylip, column, list, rabund, sabund, name, group, design, order, tree, shared, ordergroup, relabund, fasta, qfile, sff, oligos, accnos, biom, count, summary, file, constaxonomy and taxonomy.\n";
helpString += "The current parameter is used to input the output file from get.current. This function is intended to allow you to input filenames from previous instances on mothur. NOTE: If you have a current file set in the file *.current_files.summary file, and also set a value for that file type, the value set takes precedence. For example, if you run set.current(current=current_files.summary, fasta=abrecovery.fasta) and your have fasta=final.fasta in the *.current_files.summary file the current fasta file will be set to abrecovery.fasta.\n";
helpString += "The clear paramter is used to indicate which file types you would like to clear values for, multiple types can be separated by dashes.\n";
helpString += "The set.current command should be in the following format: \n";
@@ -298,6 +299,14 @@ SetCurrentCommand::SetCurrentCommand(string option) {
//if the user has not given a path then, add inputdir. else leave path alone.
if (path == "") { parameters["taxonomy"] = inputDir + it->second; }
}
+
+ it = parameters.find("constaxonomy");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["constaxonomy"] = inputDir + it->second; }
+ }
it = parameters.find("flow");
//user has given a template file
@@ -448,6 +457,11 @@ SetCurrentCommand::SetCurrentCommand(string option) {
if (taxonomyfile == "not open") { m->mothurOut("Ignoring: " + parameters["taxonomy"]); m->mothurOutEndLine(); taxonomyfile = ""; }
else if (taxonomyfile == "not found") { taxonomyfile = ""; }
if (taxonomyfile != "") { m->setTaxonomyFile(taxonomyfile); }
+
+ constaxonomyfile = validParameter.validFile(parameters, "constaxonomy", true);
+ if (constaxonomyfile == "not open") { m->mothurOut("Ignoring: " + parameters["constaxonomy"]); m->mothurOutEndLine(); constaxonomyfile = ""; }
+ else if (constaxonomyfile == "not found") { constaxonomyfile = ""; }
+ if (constaxonomyfile != "") { m->setConsTaxonomyFile(constaxonomyfile); }
flowfile = validParameter.validFile(parameters, "flow", true);
if (flowfile == "not open") { m->mothurOut("Ignoring: " + parameters["flow"]); m->mothurOutEndLine(); flowfile = ""; }
@@ -536,6 +550,8 @@ int SetCurrentCommand::execute(){
m->setAccnosFile("");
}else if (types[i] == "taxonomy") {
m->setTaxonomyFile("");
+ }else if (types[i] == "constaxonomy") {
+ m->setConsTaxonomyFile("");
}else if (types[i] == "flow") {
m->setFlowFile("");
}else if (types[i] == "biom") {
@@ -41,7 +41,7 @@ class SetCurrentCommand : public Command {
vector<string> types;
string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile, biomfile, countfile, summaryfile, currentFile, outputDir;
- string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile, filefile;
+ string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile, filefile, constaxonomyfile;
int readCurrentFiles();
View
@@ -44,6 +44,7 @@ set<string> MothurOut::getCurrentTypes() {
types.insert("sff");
types.insert("shared");
types.insert("taxonomy");
+ types.insert("constaxonomy");
types.insert("tree");
types.insert("flow");
types.insert("biom");
@@ -83,6 +84,7 @@ void MothurOut::printCurrentFiles(string filename) {
if (sfffile != "") { mothurOut("sff=" + sfffile, out); mothurOutEndLine(out); }
if (sharedfile != "") { mothurOut("shared=" + sharedfile, out); mothurOutEndLine(out); }
if (taxonomyfile != "") { mothurOut("taxonomy=" + taxonomyfile, out); mothurOutEndLine(out); }
+ if (constaxonomyfile != "") { mothurOut("constaxonomy=" + constaxonomyfile, out); mothurOutEndLine(out);}
if (treefile != "") { mothurOut("tree=" + treefile, out); mothurOutEndLine(out); }
if (flowfile != "") { mothurOut("flow=" + flowfile, out); mothurOutEndLine(out); }
if (biomfile != "") { mothurOut("biom=" + biomfile, out); mothurOutEndLine(out); }
@@ -112,6 +114,7 @@ void MothurOut::printCurrentFiles(string filename) {
if (sfffile != "") { mothurOut("sff=" + sfffile); mothurOutEndLine(); }
if (sharedfile != "") { mothurOut("shared=" + sharedfile); mothurOutEndLine(); }
if (taxonomyfile != "") { mothurOut("taxonomy=" + taxonomyfile); mothurOutEndLine(); }
+ if (constaxonomyfile != "") { mothurOut("constaxonomy=" + constaxonomyfile); mothurOutEndLine();}
if (treefile != "") { mothurOut("tree=" + treefile); mothurOutEndLine(); }
if (flowfile != "") { mothurOut("flow=" + flowfile); mothurOutEndLine(); }
if (biomfile != "") { mothurOut("biom=" + biomfile); mothurOutEndLine(); }
@@ -150,6 +153,7 @@ bool MothurOut::hasCurrentFiles() {
if (sfffile != "") { return true; }
if (sharedfile != "") { return true; }
if (taxonomyfile != "") { return true; }
+ if (constaxonomyfile != "") { return true; }
if (treefile != "") { return true; }
if (flowfile != "") { return true; }
if (biomfile != "") { return true; }
Oops, something went wrong.

0 comments on commit 7f0ffe0

Please sign in to comment.