From 16f9c4ab6f39769856b13e048eae2c8eaa413c02 Mon Sep 17 00:00:00 2001 From: Sarah Westcott Date: Fri, 2 Nov 2012 13:06:05 -0400 Subject: [PATCH] fix to summary.tax for 1.28.0 --- Mothur.xcodeproj/project.pbxproj | 8 ++++---- mothurout.cpp | 27 +++++++++++++++++++++++---- randomforest.hpp | 0 rarefactcommand.cpp | 2 +- summarytaxcommand.cpp | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) mode change 100755 => 100644 randomforest.hpp diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 1b298df..d360d2f 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -2337,8 +2337,8 @@ GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = ( "MOTHUR_FILES=\"\\\"../release\\\"\"", - "VERSION=\"\\\"1.26.0\\\"\"", - "RELEASE_DATE=\"\\\"7/9/2012\\\"\"", + "VERSION=\"\\\"1.28.0\\\"\"", + "RELEASE_DATE=\"\\\"11/2/2012\\\"\"", ); "GCC_VERSION[arch=*]" = ""; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; @@ -2373,8 +2373,8 @@ GCC_MODEL_TUNING = ""; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = ( - "VERSION=\"\\\"1.27.0\\\"\"", - "RELEASE_DATE=\"\\\"8/8/2012\\\"\"", + "VERSION=\"\\\"1.28.0\\\"\"", + "RELEASE_DATE=\"\\\"11/2/2012\\\"\"", ); GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/mothurout.cpp b/mothurout.cpp index 124fbb8..468c063 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -1608,8 +1608,17 @@ int MothurOut::readTax(string namefile, map& taxMap) { if (pairDone) { //are there confidence scores, if so remove them if (secondCol.find_first_of('(') != -1) { removeConfidences(secondCol); } - taxMap[firstCol] = secondCol; - if (debug) { mothurOut("[DEBUG]: name = '" + firstCol + "' tax = '" + secondCol + "'\n"); } + map::iterator itTax = taxMap.find(firstCol); + + if(itTax == taxMap.end()) { + bool ignore = false; + if (secondCol != "") { if (secondCol[secondCol.length()-1] != ';') { mothurOut("[ERROR]: " + firstCol + " is missing the final ';', ignoring.\n"); ignore=true; } + } + if (!ignore) { taxMap[firstCol] = secondCol; } + if (debug) { mothurOut("[DEBUG]: name = '" + firstCol + "' tax = '" + secondCol + "'\n"); } + }else { + mothurOut("[ERROR]: " + firstCol + " is already in your taxonomy file, names must be unique./n"); control_pressed = true; + } pairDone = false; } } @@ -1626,8 +1635,18 @@ int MothurOut::readTax(string namefile, map& taxMap) { if (pairDone) { //are there confidence scores, if so remove them if (secondCol.find_first_of('(') != -1) { removeConfidences(secondCol); } - taxMap[firstCol] = secondCol; - if (debug) { mothurOut("[DEBUG]: name = '" + firstCol + "' tax = '" + secondCol + "'\n"); } + map::iterator itTax = taxMap.find(firstCol); + + if(itTax == taxMap.end()) { + bool ignore = false; + if (secondCol != "") { if (secondCol[secondCol.length()-1] != ';') { mothurOut("[ERROR]: " + firstCol + " is missing the final ';', ignoring.\n"); ignore=true; } + } + if (!ignore) { taxMap[firstCol] = secondCol; } + if (debug) { mothurOut("[DEBUG]: name = '" + firstCol + "' tax = '" + secondCol + "'\n"); } + }else { + mothurOut("[ERROR]: " + firstCol + " is already in your taxonomy file, names must be unique./n"); control_pressed = true; + } + pairDone = false; } } diff --git a/randomforest.hpp b/randomforest.hpp old mode 100755 new mode 100644 diff --git a/rarefactcommand.cpp b/rarefactcommand.cpp index 612e3b4..c4a104b 100644 --- a/rarefactcommand.cpp +++ b/rarefactcommand.cpp @@ -56,7 +56,7 @@ string RareFactCommand::getHelpString(){ try { ValidCalculators validCalculator; string helpString = ""; - helpString += "The rarefaction.single command parameters are list, sabund, rabund, shared, label, iters, freq, calc, processors and abund. list, sabund, rabund or shared is required unless you have a valid current file. \n"; + helpString += "The rarefaction.single command parameters are list, sabund, rabund, shared, label, iters, freq, calc, processors, groupmode and abund. list, sabund, rabund or shared is required unless you have a valid current file. \n"; helpString += "The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n"; helpString += "The processors parameter allows you to specify the number of processors to use. The default is 1.\n"; helpString += "The rarefaction.single command should be in the following format: \n"; diff --git a/summarytaxcommand.cpp b/summarytaxcommand.cpp index e932eee..7f5e5e5 100644 --- a/summarytaxcommand.cpp +++ b/summarytaxcommand.cpp @@ -277,7 +277,7 @@ int SummaryTaxCommand::execute(){ } } in.close(); - } + }else { numSeqs = taxaSum->summarize(taxfile); } if (m->control_pressed) { if (groupMap != NULL) { delete groupMap; } if (ct != NULL) { delete ct; } delete taxaSum; return 0; } -- 2.39.2