From e911fa88572a16ef40e0b51fb132ab6e02370797 Mon Sep 17 00:00:00 2001 From: westcott Date: Tue, 15 Sep 2009 17:43:32 +0000 Subject: [PATCH] fixed some issues while testing 1.6 --- Mothur.xcodeproj/project.pbxproj | 4 ++-- binsequencecommand.cpp | 2 +- bootstrapsharedcommand.cpp | 2 +- chimera.cpp | 2 +- collectcommand.cpp | 2 +- collectsharedcommand.cpp | 4 ++-- getoturepcommand.cpp | 2 +- getrabundcommand.cpp | 2 +- getsabundcommand.cpp | 2 +- heatmapcommand.cpp | 4 ++-- heatmapsimcommand.cpp | 2 +- matrixoutputcommand.cpp | 2 +- mothur.cpp | 4 ++-- mothur.h | 21 +++++++++++---------- rarefactcommand.cpp | 2 +- rarefactsharedcommand.cpp | 2 +- readdistcommand.cpp | 18 +++++++++--------- sharedcommand.cpp | 2 +- summarycommand.cpp | 2 +- summarysharedcommand.cpp | 2 +- treegroupscommand.cpp | 2 +- unifracweightedcommand.h | 2 +- venncommand.cpp | 4 ++-- 23 files changed, 46 insertions(+), 45 deletions(-) diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 6aa6b27..fda0adc 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -515,8 +515,8 @@ A70B53A70F4CD7AD0064797E /* getlabelcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getlabelcommand.h; sourceTree = SOURCE_ROOT; }; A70B53A80F4CD7AD0064797E /* getlinecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getlinecommand.cpp; sourceTree = SOURCE_ROOT; }; A70B53A90F4CD7AD0064797E /* getlinecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getlinecommand.h; sourceTree = SOURCE_ROOT; }; - A7283FF61056CAE100D0CC69 /* chimeracheckrdp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimeracheckrdp.h; sourceTree = ""; }; - A7283FF71056CAE100D0CC69 /* chimeracheckrdp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeracheckrdp.cpp; sourceTree = ""; }; + A7283FF61056CAE100D0CC69 /* chimeracheckrdp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimeracheckrdp.h; sourceTree = SOURCE_ROOT; }; + A7283FF71056CAE100D0CC69 /* chimeracheckrdp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeracheckrdp.cpp; sourceTree = SOURCE_ROOT; }; A75B887B104C16860083C454 /* ccode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ccode.cpp; sourceTree = SOURCE_ROOT; }; A75B887C104C16860083C454 /* ccode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccode.h; sourceTree = SOURCE_ROOT; }; C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = ""; }; diff --git a/binsequencecommand.cpp b/binsequencecommand.cpp index e1f98eb..e4e4c48 100644 --- a/binsequencecommand.cpp +++ b/binsequencecommand.cpp @@ -213,7 +213,7 @@ int BinSeqCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete list; + if (list != NULL) { delete list; } list = input->getListVector(lastLabel); error = process(list); diff --git a/bootstrapsharedcommand.cpp b/bootstrapsharedcommand.cpp index 12c0b5e..0c6c53c 100644 --- a/bootstrapsharedcommand.cpp +++ b/bootstrapsharedcommand.cpp @@ -272,7 +272,7 @@ int BootSharedCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete order; + if (order != NULL) { delete order; } order = input->getSharedOrderVector(lastLabel); mothurOut(order->getLabel()); mothurOutEndLine(); process(order); diff --git a/chimera.cpp b/chimera.cpp index 7e997b9..6ec24d1 100644 --- a/chimera.cpp +++ b/chimera.cpp @@ -142,7 +142,7 @@ vector< vector > Chimera::readQuantiles() { openInputFile(quanfile, in); vector< vector > quan; - vector temp; + vector temp; temp.resize(6, 0); //to fill 0 quan.push_back(temp); diff --git a/collectcommand.cpp b/collectcommand.cpp index fac13ec..58aa32c 100644 --- a/collectcommand.cpp +++ b/collectcommand.cpp @@ -271,7 +271,7 @@ int CollectCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete order; + if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); mothurOut(order->getLabel()); mothurOutEndLine(); diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index ae2c52e..697bc53 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -296,11 +296,11 @@ int CollectSharedCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete order; + if (order != NULL) { delete order; } order = input->getSharedOrderVector(lastLabel); cCurve = new Collect(order, cDisplays); - cCurve->getCurve(freq); + cCurve->getSharedCurve(freq); delete cCurve; mothurOut(order->getLabel()); mothurOutEndLine(); diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index 4aab740..441e824 100644 --- a/getoturepcommand.cpp +++ b/getoturepcommand.cpp @@ -245,7 +245,7 @@ int GetOTURepCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete list; + if (list != NULL) { delete list; } list = input->getListVector(lastLabel); mothurOut(list->getLabel() + "\t" + toString(list->size())); mothurOutEndLine(); error = process(list); diff --git a/getrabundcommand.cpp b/getrabundcommand.cpp index 8718e16..dd4fdd5 100644 --- a/getrabundcommand.cpp +++ b/getrabundcommand.cpp @@ -187,7 +187,7 @@ int GetRAbundCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete list; + if (list != NULL) { delete list; } list = input->getListVector(lastLabel); mothurOut(list->getLabel()); mothurOutEndLine(); diff --git a/getsabundcommand.cpp b/getsabundcommand.cpp index 5d99b69..8cbb9d4 100644 --- a/getsabundcommand.cpp +++ b/getsabundcommand.cpp @@ -175,7 +175,7 @@ int GetSAbundCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete order; + if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); mothurOut(order->getLabel()); mothurOutEndLine(); diff --git a/heatmapcommand.cpp b/heatmapcommand.cpp index 271a379..e2fdc64 100644 --- a/heatmapcommand.cpp +++ b/heatmapcommand.cpp @@ -211,7 +211,7 @@ int HeatMapCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); @@ -274,7 +274,7 @@ int HeatMapCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete rabund; + if (rabund != NULL) { delete rabund; } rabund = input->getRAbundVector(lastLabel); mothurOut(rabund->getLabel()); mothurOutEndLine(); diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 1b00298..004a3bf 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -249,7 +249,7 @@ int HeatMapSimCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); diff --git a/matrixoutputcommand.cpp b/matrixoutputcommand.cpp index 00dff4b..9b4935f 100644 --- a/matrixoutputcommand.cpp +++ b/matrixoutputcommand.cpp @@ -246,7 +246,7 @@ int MatrixOutputCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); diff --git a/mothur.cpp b/mothur.cpp index 5bb9c05..99ff5c6 100644 --- a/mothur.cpp +++ b/mothur.cpp @@ -41,9 +41,9 @@ int main(int argc, char *argv[]){ //header - mothurOut("mothur v.1.5.1"); + mothurOut("mothur v.1.6.0"); mothurOutEndLine(); - mothurOut("Last updated: 9/02/2009"); + mothurOut("Last updated: 9/15/2009"); mothurOutEndLine(); mothurOutEndLine(); mothurOut("by"); diff --git a/mothur.h b/mothur.h index c5afe86..e3e2ef4 100644 --- a/mothur.h +++ b/mothur.h @@ -171,6 +171,16 @@ inline int openOutputFileAppend(string fileName, ofstream& fileHandle){ } /***********************************************************************/ +inline void gobble(istream& f){ + + char d; + while(isspace(d=f.get())) {;} + f.putback(d); + +} + +/***********************************************************************/ + inline string getline(ifstream& fileHandle) { try { @@ -181,7 +191,7 @@ inline string getline(ifstream& fileHandle) { char c = fileHandle.get(); //are you at the end of the line - if ((c == '\n') || (c == '\r') || (c == '\f')){ break; } + if ((c == '\n') || (c == '\r') || (c == '\f')){ break; } else { line += c; } } @@ -265,15 +275,6 @@ inline void errorOut(exception& e, string object, string function) { -/***********************************************************************/ - -inline void gobble(istream& f){ - - char d; - while(isspace(d=f.get())) {;} - f.putback(d); - -} /***********************************************************************/ inline bool isTrue(string f){ diff --git a/rarefactcommand.cpp b/rarefactcommand.cpp index 41c38e8..5584b9b 100644 --- a/rarefactcommand.cpp +++ b/rarefactcommand.cpp @@ -244,7 +244,7 @@ int RareFactCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete order; + if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); rCurve = new Rarefact(order, rDisplays); diff --git a/rarefactsharedcommand.cpp b/rarefactsharedcommand.cpp index 79bf7bb..7e1b477 100644 --- a/rarefactsharedcommand.cpp +++ b/rarefactsharedcommand.cpp @@ -239,7 +239,7 @@ int RareFactSharedCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); diff --git a/readdistcommand.cpp b/readdistcommand.cpp index 579f848..263d57b 100644 --- a/readdistcommand.cpp +++ b/readdistcommand.cpp @@ -152,7 +152,7 @@ int ReadDistCommand::execute(){ if (abort == true) { return 0; } - time_t start = time(NULL); + //time_t start = time(NULL); size_t numDists = 0; if (format == "matrix") { @@ -192,15 +192,15 @@ int ReadDistCommand::execute(){ } } - string dist_string = "Dist:"; - string count_string = "Count: "; - for (int i = 0; i <= lines;i++) { - dist_string = dist_string.append("\t").append(toString(dist_cutoff[i])); - count_string = count_string.append("\t").append(toString(dist_count[i])); - } - mothurOut(dist_string); mothurOutEndLine(); mothurOut(count_string); mothurOutEndLine(); + // string dist_string = "Dist:"; + // string count_string = "Count: "; + //for (int i = 0; i <= lines;i++) { + //dist_string = dist_string.append("\t").append(toString(dist_cutoff[i])); + // count_string = count_string.append("\t").append(toString(dist_count[i])); + // } + //mothurOut(dist_string); mothurOutEndLine(); mothurOut(count_string); mothurOutEndLine(); } - mothurOut("It took " + toString(time(NULL) - start) + " secs to read " + toString(numDists) + " distances (cutoff: " + toString(cutoff) + ")"); mothurOutEndLine(); + //mothurOut("It took " + toString(time(NULL) - start) + " secs to read " + toString(numDists) + " distances (cutoff: " + toString(cutoff) + ")"); mothurOutEndLine(); return 0; } diff --git a/sharedcommand.cpp b/sharedcommand.cpp index c49e56a..4b35138 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -119,7 +119,7 @@ int SharedCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete SharedList; + if (SharedList != NULL) { delete SharedList; } SharedList = input->getSharedListVector(lastLabel); //get new list vector to process lookup = SharedList->getSharedRAbundVector(); diff --git a/summarycommand.cpp b/summarycommand.cpp index 6ef1fae..731a410 100644 --- a/summarycommand.cpp +++ b/summarycommand.cpp @@ -290,7 +290,7 @@ int SummaryCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete sabund; + if (sabund != NULL) { delete sabund; } sabund = input->getSAbundVector(lastLabel); mothurOut(sabund->getLabel()); mothurOutEndLine(); diff --git a/summarysharedcommand.cpp b/summarysharedcommand.cpp index 74327ba..9f951de 100644 --- a/summarysharedcommand.cpp +++ b/summarysharedcommand.cpp @@ -318,7 +318,7 @@ int SummarySharedCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index ab81f42..27f701f 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -490,7 +490,7 @@ void TreeGroupCommand::makeSimsShared() { //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); diff --git a/unifracweightedcommand.h b/unifracweightedcommand.h index 9ea78ba..5f55dee 100644 --- a/unifracweightedcommand.h +++ b/unifracweightedcommand.h @@ -24,7 +24,7 @@ class UnifracWeightedCommand : public Command { public: UnifracWeightedCommand(string); - ~UnifracWeightedCommand() { delete weighted; delete util; } + ~UnifracWeightedCommand() { if (abort == false) { delete weighted; delete util; } } int execute(); void help(); diff --git a/venncommand.cpp b/venncommand.cpp index 84d33f2..f288001 100644 --- a/venncommand.cpp +++ b/venncommand.cpp @@ -275,7 +275,7 @@ int VennCommand::execute(){ //run last line if you need to if (needToRun == true) { - for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } + for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); @@ -341,7 +341,7 @@ int VennCommand::execute(){ //run last line if you need to if (needToRun == true) { - delete sabund; + if (sabund != NULL) { delete sabund; } sabund = input->getSAbundVector(lastLabel); mothurOut(sabund->getLabel()); mothurOutEndLine(); -- 2.39.2