]> git.donarmstrong.com Git - mothur.git/blobdiff - seqsummarycommand.cpp
fixes while testing
[mothur.git] / seqsummarycommand.cpp
index 5dbcdec9cb90f2082912017064f876fd6210e464..5776b970e6475bf74252d357ff1fef028902a797 100644 (file)
 #include "seqsummarycommand.h"
 #include "sequence.hpp"
 
+//**********************************************************************************************************************
+vector<string> SeqSummaryCommand::getValidParameters(){        
+       try {
+               string Array[] =  {"fasta","processors","outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SeqSummaryCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+SeqSummaryCommand::SeqSummaryCommand(){        
+       try {
+               abort = true;
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["summary"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SeqSummaryCommand", "SeqSummaryCommand");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> SeqSummaryCommand::getRequiredParameters(){     
+       try {
+               string Array[] =  {"fasta"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SeqSummaryCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> SeqSummaryCommand::getRequiredFiles(){  
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SeqSummaryCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //***************************************************************************************************************
 
 SeqSummaryCommand::SeqSummaryCommand(string option)  {
@@ -49,6 +97,10 @@ SeqSummaryCommand::SeqSummaryCommand(string option)  {
                                }
                        }
                        
+                       //initialize outputTypes
+                       vector<string> tempOutNames;
+                       outputTypes["summary"] = tempOutNames;
+                       
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
@@ -289,7 +341,7 @@ int SeqSummaryCommand::execute(){
                
                m->mothurOutEndLine();
                m->mothurOut("Output File Name: "); m->mothurOutEndLine();
-               m->mothurOut(summaryFile); m->mothurOutEndLine();       
+               m->mothurOut(summaryFile); m->mothurOutEndLine();       outputNames.push_back(summaryFile); outputTypes["summary"].push_back(summaryFile);
                m->mothurOutEndLine();
                
                #ifdef USE_MPI
@@ -343,14 +395,18 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                                count++;
                        }
                        
-                       unsigned long int pos = in.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = in.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (in.eof()) { break; }
+                       #endif
                        
                        //report progress
-                       if((count) % 100 == 0){ m->mothurOut(toString(count)); m->mothurOutEndLine();           }
+                       //if((count) % 100 == 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
                }
                //report progress
-               if((count) % 100 != 0){ m->mothurOut(toString(count)); m->mothurOutEndLine();           }
+               //if((count) % 100 != 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
                
                in.close();