From b7cce6e0a45013919e76a266533fcca4052cf157 Mon Sep 17 00:00:00 2001 From: westcott Date: Fri, 19 Jun 2009 17:15:00 +0000 Subject: [PATCH] version working on mac with .tellg changed to unget for windows --- readotu.cpp | 3 +++ readotucommand.cpp | 7 +------ screenseqscommand.cpp | 4 ++-- shared.cpp | 2 +- shared.h | 2 +- sharedcommand.cpp | 3 ++- sharedrabundvector.cpp | 15 ++++++--------- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/readotu.cpp b/readotu.cpp index b97c902..a99f343 100644 --- a/readotu.cpp +++ b/readotu.cpp @@ -44,12 +44,15 @@ void ReadOTUFile::read(GlobalData* globaldata){ sabund = inputSabund->getSAbundVector(); //if (globaldata->sabund != NULL) { delete globaldata->sabund; } globaldata->sabund = sabund; //saving to be used by summary command. + delete inputSabund; rabund = inputRabund->getRAbundVector(); //if (globaldata->rabund != NULL) { delete globaldata->rabund; } globaldata->rabund = rabund; //saving to be used by heatmap.bin command. + delete inputRabund; list = inputList->getListVector(); //if (globaldata->gListVector != NULL) { delete globaldata->gListVector; } globaldata->gListVector = list; + delete inputList; }else if (globaldata->getFormat() == "shared") { SharedList = input->getSharedListVector(); //you are reading for collect.shared, rarefaction.shared, summary.shared, parselist command, or shared commands. diff --git a/readotucommand.cpp b/readotucommand.cpp index 2df74e4..50ee5c1 100644 --- a/readotucommand.cpp +++ b/readotucommand.cpp @@ -107,7 +107,6 @@ ReadOtuCommand::ReadOtuCommand(string option){ if (abort == false) { //gets whichever one of the above is set filename = globaldata->inputFileName; - //read = new ReadOTUFile(filename); } } @@ -156,9 +155,7 @@ void ReadOtuCommand::help(){ //********************************************************************************************************************** ReadOtuCommand::~ReadOtuCommand(){ - if (abort == false) { //delete read; - } -} + } //********************************************************************************************************************** @@ -167,9 +164,7 @@ int ReadOtuCommand::execute(){ if (abort == true) { return 0; } - //read->read(&*globaldata); if (globaldata->getFormat() == "shared") { - //groupMap->readMap(); parselist = new ParseListCommand(); parselist->execute(); diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index ca1d616..70094f2 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -39,7 +39,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option){ fastafile = validParameter.validFile(parameters, "fasta", true); if (fastafile == "not found") { cout << "fasta is a required parameter for the screen.seqs command." << endl; abort = true; } else if (fastafile == "not open") { abort = true; } - + groupfile = validParameter.validFile(parameters, "group", true); if (groupfile == "not open") { abort = true; } else if (groupfile == "not found") { groupfile = ""; } @@ -50,7 +50,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option){ alignreport = validParameter.validFile(parameters, "alignreport", true); if (alignreport == "not open") { abort = true; } - else if (alignreport == "not found") { namefile = ""; } + else if (alignreport == "not found") { alignreport = ""; } //check for optional parameter and set defaults // ...at some point should added some additional type checking... diff --git a/shared.cpp b/shared.cpp index 36dbbb1..b15ef93 100644 --- a/shared.cpp +++ b/shared.cpp @@ -40,7 +40,7 @@ void Shared::getSharedVectors(SharedListVector* list) { } //updates sharedVector - sharedRAbund.push_back(sharedGroups); + //sharedRAbund.push_back(sharedGroups); } diff --git a/shared.h b/shared.h index c80ef66..515c2a0 100644 --- a/shared.h +++ b/shared.h @@ -26,7 +26,7 @@ class Shared { GlobalData* globaldata; map::iterator it; void parse(int, SharedListVector*); - vector< map > sharedRAbund; //contains all the info needed to create the .shared file not sure if we will need + //vector< map > sharedRAbund; //contains all the info needed to create the .shared file not sure if we will need }; #endif diff --git a/sharedcommand.cpp b/sharedcommand.cpp index dd90064..42601f4 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -81,6 +81,7 @@ int SharedCommand::execute(){ if (count != 1) { delete lastList; } lastList = SharedList; SharedList = input->getSharedListVector(); //get new list vector to process + count++; //if (count != 1) { for (int i = 0; i < lastLookup.size(); i++) { delete lastLookup[i]; } } //lastLookup = lookup; @@ -106,7 +107,7 @@ int SharedCommand::execute(){ printSharedData(); //prints info to the .shared file } - delete lastList; + delete lastList; globaldata->gSharedList = NULL; delete shared; out.close(); diff --git a/sharedrabundvector.cpp b/sharedrabundvector.cpp index f60562a..6bf4916 100644 --- a/sharedrabundvector.cpp +++ b/sharedrabundvector.cpp @@ -63,7 +63,7 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), if (globaldata->gGroupmap == NULL) { groupmap = new GroupMap(); } - int num, inputData, pos, count; + int num, inputData, count; count = 0; string holdLabel, nextLabel, groupN; individual newguy; @@ -99,9 +99,6 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), } - //save position in file in case next line is a new label. - pos = f.tellg(); - if (f.eof() != true) { f >> nextLabel; } //read the rest of the groups info in @@ -127,14 +124,12 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), lookup[count]->push_back(inputData, i, groupN); //abundance, bin, group } - //save position in file in case next line is a new label. - pos = f.tellg(); - + if (f.eof() != true) { f >> nextLabel; } } //put file pointer back since you are now at a new distance label - f.seekg(pos, ios::beg); + for (int i = 0; i < nextLabel.length(); i++) { f.unget(); } if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; } @@ -392,7 +387,9 @@ vector SharedRAbundVector::getSharedRAbundVectors(){ i--; } } - + + delete util; + return lookup; } catch(exception& e) { -- 2.39.2