]> git.donarmstrong.com Git - mothur.git/blobdiff - inputdata.cpp
added name option to trim.seqs
[mothur.git] / inputdata.cpp
index 283fb7edc33856613612e10b0d293d0eea1f056d..08bab60dbd71f4e4c4d0b56472ccb199a026d85b 100644 (file)
 
 InputData::InputData(string fName, string f) : format(f){
        m = MothurOut::getInstance();
-       globaldata = GlobalData::getInstance();
        m->openInputFile(fName, fileHandle);
        filename = fName;
+       m->saveNextLabel = "";
        
 }
-
 /***********************************************************************/
 
-
 InputData::~InputData(){
        fileHandle.close();
-       globaldata = GlobalData::getInstance();
-       globaldata->saveNextLabel = "";
-//     delete output;
-       
+       m->saveNextLabel = "";
 }
 
 /***********************************************************************/
@@ -38,7 +33,6 @@ InputData::~InputData(){
 InputData::InputData(string fName, string orderFileName, string f) : format(f){
        try {
                m = MothurOut::getInstance();
-               globaldata = GlobalData::getInstance();
                ifstream ofHandle;
                m->openInputFile(orderFileName, ofHandle);
                string name;
@@ -298,7 +292,7 @@ OrderVector* InputData::getOrderVector(){
                        else if(format == "sabund"){
                                input = new SAbundVector(fileHandle);
                        }
-                       
+                                               
                        m->gobble(fileHandle);
                        
                        output = new OrderVector();     
@@ -400,7 +394,7 @@ OrderVector* InputData::getOrderVector(string label){
                                }
 
                        }
-                       
+                                               
                        in.close();             
 
                        output = new OrderVector();
@@ -431,6 +425,7 @@ vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(){
                                }
                        }else if (format == "shared") {
                                SharedList = new SharedListVector(fileHandle);
+                               
                                if (SharedList != NULL) {
                                        return SharedList->getSharedRAbundVector();
                                }
@@ -455,7 +450,7 @@ vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(string label){
                string  thisLabel;
                
                m->openInputFile(filename, in);
-               globaldata->saveNextLabel = "";
+               m->saveNextLabel = "";
        
                if(in){
                        if (format == "sharedfile")  {
@@ -481,6 +476,7 @@ vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(string label){
                                while (in.eof() != true) {
                                        
                                        SharedList = new SharedListVector(in);
+                                       
                                        if (SharedList != NULL) {
                                                thisLabel = SharedList->getLabel();
                                                //if you are at the last label
@@ -549,7 +545,7 @@ vector<SharedRAbundFloatVector*> InputData::getSharedRAbundFloatVectors(string l
                string  thisLabel;
                
                m->openInputFile(filename, in);
-               globaldata->saveNextLabel = "";
+               m->saveNextLabel = "";
                
                if(in){
                        if (format == "relabund")  {
@@ -626,8 +622,7 @@ SAbundVector* InputData::getSAbundVector(){
                        }
                        else if(format == "sabund"){
                                input = new SAbundVector(fileHandle);
-                       }
-                                       
+                       }                                       
                        m->gobble(fileHandle);
 
                        sabund = new SAbundVector();
@@ -766,7 +761,7 @@ RAbundVector* InputData::getRAbundVector(){
                        else if(format == "sabund"){
                                input = new SAbundVector(fileHandle);
                        }
-                                       
+                       
                        m->gobble(fileHandle);
 
                        rabund = new RAbundVector();
@@ -866,7 +861,8 @@ RAbundVector* InputData::getRAbundVector(string label){
                                        
                                }
 
-                       }
+                       }                       
+                       
                        
                        in.close();