]> git.donarmstrong.com Git - mothur.git/commitdiff
changed all shared commands so that they read the shared file generated by the read...
authorwestcott <westcott>
Wed, 13 May 2009 18:35:14 +0000 (18:35 +0000)
committerwestcott <westcott>
Wed, 13 May 2009 18:35:14 +0000 (18:35 +0000)
bootstrapsharedcommand.cpp
collectsharedcommand.cpp
globaldata.cpp
globaldata.hpp
heatmapcommand.cpp
rarefactsharedcommand.cpp
readotucommand.cpp
summarysharedcommand.cpp
treegroupscommand.cpp
venncommand.cpp

index e88972cc19aae9c2e21efa665177925c3e86cf46..6b1f338661820d5f205556f9e62b347664e5cb4d 100644 (file)
@@ -95,23 +95,13 @@ int BootSharedCommand::execute(){
        
                //if the users entered no valid calculators don't execute command
                if (treeCalculators.size() == 0) { return 0; }
-
-               if (format == "sharedfile") {
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-                       
-                       input = globaldata->ginput;
-                       order = input->getSharedOrderVector();
-               }else {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       order = SharedList->getSharedOrderVector();
-               }
                
+               //read first line
+               read = new ReadOTUFile(globaldata->inputFileName);      
+               read->read(&*globaldata); 
+               input = globaldata->ginput;
+               order = input->getSharedOrderVector();
+                               
                //set users groups
                util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "treegroup");
                numGroups = globaldata->Groups.size();
@@ -186,17 +176,7 @@ int BootSharedCommand::execute(){
                        }
                
                        //get next line to process
-                       if (format == "sharedfile") {
-                               order = input->getSharedOrderVector();
-                       }else {
-                               //you are using a list and a groupfile
-                               SharedList = input->getSharedListVector(); //get new list vector to process
-                               if (SharedList != NULL) {
-                                       order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
-                               }else {
-                                       break;
-                               }
-                       }
+                       order = input->getSharedOrderVector();
                        count++;
                }
                
index 96e495a58f9dd1bdc58256baf1ae47c51a9c87b2..86b35a5191d268452d86a2994dd1bcafd06a3001 100644 (file)
@@ -129,21 +129,12 @@ int CollectSharedCommand::execute(){
                //if the users entered no valid calculators don't execute command
                if (cDisplays.size() == 0) { return 0; }
                
-               if (format == "sharedfile") {
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
+               read = new ReadOTUFile(globaldata->inputFileName);      
+               read->read(&*globaldata); 
                        
-                       input = globaldata->ginput;
-                       order = input->getSharedOrderVector();
-               }else {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
+               input = globaldata->ginput;
+               order = input->getSharedOrderVector();
                
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       order = SharedList->getSharedOrderVector();
-               }
                set<string> orderList;
                
                //set users groups
@@ -164,18 +155,7 @@ int CollectSharedCommand::execute(){
                        }
                        
                        //get next line to process
-                       if (format == "sharedfile") {
-                               order = input->getSharedOrderVector();
-                       }else {
-                               //you are using a list and a groupfile
-                               SharedList = input->getSharedListVector(); //get new list vector to process
-                               if (SharedList != NULL) {
-                                       order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
-                               }else {
-                                       break;
-                               }
-                       }
-                       
+                       order = input->getSharedOrderVector();
                        count++;
                }
                set<string>::iterator i;
index ae1b0e2ebbb463fefc32a2f8ad3fd1816b01109d..494b664fb841389aff6dca6305963d68a1a5a8cf 100644 (file)
@@ -290,11 +290,13 @@ string GlobalData::getScale()                     {       return scale;           }
 string GlobalData::getEnds()                   {   return ends;                }
 string GlobalData::getProcessors()             {       return processors;      }
 
-void GlobalData::setListFile(string file)      {       listfile = file;        inputFileName = file;}
-void GlobalData::setRabundFile(string file)    {       rabundfile = file;      inputFileName = file;}
-void GlobalData::setSabundFile(string file)    {       sabundfile = file;      inputFileName = file;}
-void GlobalData::setPhylipFile(string file)    {       phylipfile = file;    inputFileName = file;}
-void GlobalData::setColumnFile(string file)    {       columnfile = file;    inputFileName = file;}
+void GlobalData::setListFile(string file)              {       listfile = file;        inputFileName = file;}
+void GlobalData::setGroupFile(string file)             {       groupfile = file;       }
+void GlobalData::setRabundFile(string file)            {       rabundfile = file;      inputFileName = file;}
+void GlobalData::setSabundFile(string file)            {       sabundfile = file;      inputFileName = file;}
+void GlobalData::setPhylipFile(string file)            {       phylipfile = file;    inputFileName = file;}
+void GlobalData::setColumnFile(string file)            {       columnfile = file;    inputFileName = file;}
+void GlobalData::setSharedFile(string file)            {       sharedfile = file;      inputFileName = file; fileroot = file;}
 void GlobalData::setNameFile(string file)              {       namefile = file;                }
 void GlobalData::setFormat(string Format)              {       format = Format;                }
 void GlobalData::setRandomTree(string Random)  {       randomtree = Random;    }
index 801ca6013889e7300d99fa3763ab6701ec4bf530..3a469f08cc52dc15ca51e13d9edf23f7a380a752 100644 (file)
@@ -87,11 +87,13 @@ public:
 
 
        void setListFile(string);
+       void setGroupFile(string file); 
        void setPhylipFile(string);
        void setColumnFile(string);
        void setNameFile(string);
        void setRabundFile(string);
        void setSabundFile(string);
+       void setSharedFile(string);
        void setFormat(string);
        void setRandomTree(string);
        void setGroups(string);
index be25f091516022e5a6414184c7ecb58518e60a94..fd7a8279e689b8226b2939ac8a07656dd290d530 100644 (file)
@@ -40,7 +40,7 @@ HeatMapCommand::~HeatMapCommand(){
 int HeatMapCommand::execute(){
        try {
                int count = 1;  
-               
+       
                if (format == "sharedfile") {
                        //you have groups
                        read = new ReadOTUFile(globaldata->inputFileName);      
@@ -48,14 +48,6 @@ int HeatMapCommand::execute(){
                        
                        input = globaldata->ginput;
                        lookup = input->getSharedRAbundVectors();
-               }else if (format == "shared") {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       lookup = SharedList->getSharedRAbundVector();
                }else if (format == "list") {
                        //you are using just a list file and have only one group
                        read = new ReadOTUFile(globaldata->inputFileName);      
index 89cf4e2732af38c6fff844490effde5f8676e76c..29dd50e749dfa097d8ac16ac6181e58c559833a8 100644 (file)
@@ -68,22 +68,12 @@ int RareFactSharedCommand::execute(){
                //if the users entered no valid calculators don't execute command
                if (rDisplays.size() == 0) { return 0; }
 
-               if (format == "sharedfile") {
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
+               read = new ReadOTUFile(globaldata->inputFileName);      
+               read->read(&*globaldata); 
                        
-                       input = globaldata->ginput;
-                       order = input->getSharedOrderVector();
-               }else {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       order = SharedList->getSharedOrderVector();
-               }
-               
+               input = globaldata->ginput;
+               order = input->getSharedOrderVector();
+                               
                //set users groups
                util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "rarefact");
                
@@ -102,18 +92,7 @@ int RareFactSharedCommand::execute(){
                        }
                        
                        //get next line to process
-                       if (format == "sharedfile") {
-                               order = input->getSharedOrderVector();
-                       }else {
-                               //you are using a list and a groupfile
-                               SharedList = input->getSharedListVector(); //get new list vector to process
-                               if (SharedList != NULL) {
-                                       order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
-                               }else {
-                                       break;
-                               }
-                       }
-                       
+                       order = input->getSharedOrderVector();
                        count++;
                }
        
index 1b2ec9e750445f7b256b978fec0298d42b3f825c..c8ec791c5c667e1f01bfdc59944ed2811e345d6c 100644 (file)
@@ -51,6 +51,12 @@ int ReadOtuCommand::execute(){
 
                        parselist = new ParseListCommand();
                        parselist->execute();
+                       
+                       //change format to shared  to speed up commands
+                       globaldata->setFormat("sharedfile");
+                       globaldata->setListFile("");
+                       globaldata->setGroupFile("");
+                       globaldata->setSharedFile(getRootName(filename) + "shared");
                }
                return 0;
        }
index a4a345e4f7fa57714b44ecda860e4753c9674338..486e6c4982b885c82a39e5387b0b987e54f843ec 100644 (file)
@@ -129,22 +129,12 @@ int SummarySharedCommand::execute(){
                        }
                }
                
-               if (format == "sharedfile") {
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
+               read = new ReadOTUFile(globaldata->inputFileName);      
+               read->read(&*globaldata); 
                        
-                       input = globaldata->ginput;
-                       order = input->getSharedOrderVector();
-               }else {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       order = SharedList->getSharedOrderVector();
-               }
-               
+               input = globaldata->ginput;
+               order = input->getSharedOrderVector();
+                               
                //set users groups
                util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "summary");
                
@@ -229,17 +219,7 @@ int SummarySharedCommand::execute(){
                        }
                
                        //get next line to process
-                       if (format == "sharedfile") {
-                               order = input->getSharedOrderVector();
-                       }else {
-                               //you are using a list and a groupfile
-                               SharedList = input->getSharedListVector(); //get new list vector to process
-                               if (SharedList != NULL) {
-                                       order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
-                               }else {
-                                       break;
-                               }
-                       }
+                       order = input->getSharedOrderVector();
                        count++;
                }
                
index 047ea6173103b5c2ad82c19c6213ab5bab9ed978..ac82da5e558d2965829de82f170b1514c8972c84 100644 (file)
@@ -88,23 +88,13 @@ int TreeGroupCommand::execute(){
                //if the users entered no valid calculators don't execute command
                if (treeCalculators.size() == 0) { return 0; }
 
-               if (format == "sharedfile") {
-                       //you have groups
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
+               //you have groups
+               read = new ReadOTUFile(globaldata->inputFileName);      
+               read->read(&*globaldata); 
                        
-                       input = globaldata->ginput;
-                       lookup = input->getSharedRAbundVectors();
-               }else {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       lookup = SharedList->getSharedRAbundVector();
-               }
-               
+               input = globaldata->ginput;
+               lookup = input->getSharedRAbundVectors();
+                               
                if (lookup.size() < 2) { cout << "You have not provided enough valid groups.  I cannot run the command." << endl; }
                
                numGroups = globaldata->Groups.size();
index e9cb47aca2c0b6291cbf57902ceb56808137704e..b2dfc89bc6ad09c283e31b15523c8a868ad01711 100644 (file)
@@ -98,14 +98,6 @@ int VennCommand::execute(){
                        
                        input = globaldata->ginput;
                        lookup = input->getSharedRAbundVectors();
-               }else if (format == "shared") {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       lookup = SharedList->getSharedRAbundVector();
                }else if (format == "list") {
                        //you are using just a list file and have only one group
                        read = new ReadOTUFile(globaldata->inputFileName);