]> git.donarmstrong.com Git - mothur.git/blobdiff - parselistcommand.cpp
fixed some bugs and added scriptengine
[mothur.git] / parselistcommand.cpp
index c0622f219cc252be7ca0bf29d28ac349cddb3357..332074d14ee990c00e6a444e235af111121d778d 100644 (file)
@@ -18,7 +18,6 @@ ParseListCommand::ParseListCommand(){
                groupMap = new GroupMap(globaldata->getGroupFile());
                groupMap->readMap();
 
-               
                //fill filehandles with neccessary ofstreams
                int i;
                ofstream* temp;
@@ -86,7 +85,6 @@ void ParseListCommand::parse(int index, SharedListVector* list) {
 
 int ParseListCommand::execute(){
        try{
-                       globaldata = GlobalData::getInstance();
                        int count = 1;
                        
                        //read in listfile
@@ -100,10 +98,6 @@ int ParseListCommand::execute(){
                        set<string> processedLabels;
                        set<string> userLabels = globaldata->labels;
                        set<int> userLines = globaldata->lines;
-
-                       //read in group map info.
-                       groupMap = new GroupMap(globaldata->getGroupFile());
-                       groupMap->readMap();
                        
                        //create new list vectors to fill with parsed data
                        for (int i=0; i<groupMap->getNumGroups(); i++) {
@@ -163,6 +157,18 @@ int ParseListCommand::execute(){
                        if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
                        globaldata->gGroupmap = groupMap; 
                        
+                       //close files
+                       for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { 
+                               ofstream* temp = it3->second;
+                               (*temp).close(); 
+                               delete it3->second;
+                       }
+                       
+                       //delete list vectors to fill with parsed data
+                       for (it2 = groupOfLists.begin(); it2 != groupOfLists.end(); it2++) {
+                               delete it2->second;
+                       }
+
                        return 0;
        }
        catch(exception& e) {