]> git.donarmstrong.com Git - mothur.git/commitdiff
testing 1.13.0
authorwestcott <westcott>
Wed, 8 Sep 2010 15:36:06 +0000 (15:36 +0000)
committerwestcott <westcott>
Wed, 8 Sep 2010 15:36:06 +0000 (15:36 +0000)
chimerapintailcommand.cpp
chimeraslayer.cpp
clearcutcommand.cpp
cmdargs.cpp
getopt_long.cpp
hcluster.cpp
heatmapsimcommand.cpp
inputdata.cpp
inputdata.h
splitabundcommand.cpp
trimseqscommand.cpp

index a8a85eb07bd8df6639ee7a3db7122d588c889e34..398d37ac7d4a25d51c56a1ce4bfea3051c2c12eb 100644 (file)
@@ -131,9 +131,21 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option)  {
                                }
 
                                ifstream in;
-                               int     ableToOpen = m->openInputFile(maskfile, in);
-                               if (ableToOpen == 1) { abort = true; }
-                               in.close();
+                               int     ableToOpen = m->openInputFile(maskfile, in, "no error");
+                               if (ableToOpen == 1) { 
+                                       if (m->getDefaultPath() != "") { //default path is set
+                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(maskfile);
+                                                       m->mothurOut("Unable to open " + maskfile + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                       ableToOpen = m->openInputFile(tryPath, in, "noerror");
+                                                       maskfile = tryPath;
+                                       }
+                               }
+                                       in.close();
+                                       
+                               if (ableToOpen == 1) { 
+                                               m->mothurOut("Unable to open " + maskfile + "."); m->mothurOutEndLine(); 
+                                               abort = true;
+                               }
                        }
 
                        
@@ -159,6 +171,15 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option)  {
                                        if (GoodFile) {  
                                                m->mothurOut("I found " + tempConsFile + " in your input file directory. I will use it to save time."); m->mothurOutEndLine();  consfile = tempConsFile;  FileTest.close();     
                                        }
+                               }else {
+                                       string tempConsFile = m->getDefaultPath() + m->getRootName(m->getSimpleName(templatefile)) + "freq";
+                                       ifstream FileTest2(tempConsFile.c_str());
+                                       if(FileTest2){  
+                                               bool GoodFile = m->checkReleaseVersion(FileTest2, m->getVersion());
+                                               if (GoodFile) {  
+                                                       m->mothurOut("I found " + tempConsFile + " in your input file directory. I will use it to save time."); m->mothurOutEndLine();  consfile = tempConsFile;  FileTest2.close();    
+                                               }
+                                       }
                                }
                        }       
                        
@@ -242,14 +263,34 @@ int ChimeraPintailCommand::execute(){
                                if (GoodFile) {  
                                        m->mothurOut("I found " + tempQuan + " in your input file directory. I will use it to save time."); m->mothurOutEndLine();  quanfile = tempQuan;  FileTest.close();     
                                }
+                       }else {
+                               string tryPath = m->getDefaultPath();
+                               string tempQuan = "";
+                               if ((!filter) && (maskfile == "")) {
+                                       tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.quan";
+                               }else if ((!filter) && (maskfile != "")) { 
+                                       tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.masked.quan";
+                               }else if ((filter) && (maskfile != "")) { 
+                                       tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastaFileNames[s])) + "masked.quan";
+                               }else if ((filter) && (maskfile == "")) { 
+                                       tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastaFileNames[s])) + "quan";
+                               }
+                               
+                               ifstream FileTest2(tempQuan.c_str());
+                               if(FileTest2){  
+                                       bool GoodFile = m->checkReleaseVersion(FileTest2, m->getVersion());
+                                       if (GoodFile) {  
+                                               m->mothurOut("I found " + tempQuan + " in your input file directory. I will use it to save time."); m->mothurOutEndLine();  quanfile = tempQuan;  FileTest2.close();    
+                                       }
+                               }
                        }
                        
                        chimera = new Pintail(fastaFileNames[s], templatefile, filter, processors, maskfile, consfile, quanfile, window, increment, outputDir);
                        
                        string outputFileName, accnosFileName;
                        if (maskfile != "") {
-                               outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + maskfile + ".pintail.chimeras";
-                               accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + maskfile + ".pintail.accnos";
+                               outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.chimeras";
+                               accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.accnos";
                        }else {
                                outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s]))  + "pintail.chimeras";
                                accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s]))  + "pintail.accnos";
index 1bfdafeaa5f6540e4e8254572b0202c81c1a0325..3497579167210514496ac904f6c9f19d17140b16 100644 (file)
@@ -67,10 +67,11 @@ int ChimeraSlayer::doPrep() {
        
                //generate the kmerdb to pass to maligner
                if (searchMethod == "kmer") { 
-                       string rightTemplateFileName = "right." + templateFileName;
+                       string templatePath = m->hasPath(templateFileName);
+                       string rightTemplateFileName = templatePath + "right." + m->getRootName(m->getSimpleName(templateFileName));
                        databaseRight = new KmerDB(rightTemplateFileName, kmerSize);
                                
-                       string leftTemplateFileName = "left." + templateFileName;
+                       string leftTemplateFileName = templatePath + "left." + m->getRootName(m->getSimpleName(templateFileName));
                        databaseLeft = new KmerDB(leftTemplateFileName, kmerSize);      
                #ifdef USE_MPI
                        for (int i = 0; i < templateSeqs.size(); i++) {
index eabcc7360bfd8c96793a577b3a98953d33199227..590394670d13ef75ef3ec0e47db7256b18d2e66e 100644 (file)
@@ -231,7 +231,7 @@ int ClearcutCommand::execute() {
                if (jukes)                              {  char* temp = new char[7];  strcpy(temp, "--jukes");  cPara.push_back(temp);          }
                if (kimura)                             { char* temp = new char[8];  strcpy(temp, "--kimura");  cPara.push_back(temp);          }
                if (matrixout != "")    {  
-                       string tempMatrix =  "--matrixout=" + matrixout; 
+                       string tempMatrix =  "--matrixout=" + outputDir + matrixout; 
                        char* temp = new char[tempMatrix.length()];
                        strcpy(temp, tempMatrix.c_str());
                        cPara.push_back(temp);
@@ -262,7 +262,7 @@ int ClearcutCommand::execute() {
                        m->mothurOutEndLine();
                        m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                        m->mothurOut(outputName); m->mothurOutEndLine();
-                       if (matrixout != "")    {  m->mothurOut(matrixout); m->mothurOutEndLine();  }
+                       if (matrixout != "")    {  m->mothurOut(outputDir+matrixout); m->mothurOutEndLine();  }
                        m->mothurOutEndLine();
                }
 
index 416ced88ddb1a0dc765b73a5c973570f7925709b..481244256a0274bafa970461d4296e5bb6c065d2 100644 (file)
@@ -70,6 +70,8 @@ NJ_handle_args(int argc,
   
   static NJ_ARGS nj_args;
   int option_index, c;
+  
+  optind = 0;  //neccasary to read in arguments if code is run more than once
 
   struct option NJ_long_options[] = {
 
@@ -139,7 +141,8 @@ NJ_handle_args(int argc,
     if(c == -1) {
       break;
     }
-
+//printf("%d\t%d\n", option_index, argc);
+//for (int red = 0; red < argc; red++) { printf("%s\n", argv[red]); }
     switch(c) {
 
     case 0:
index c113881625ad8061d46b43ee36b4efdb8d167225..3baa3ce97ef15a95122cc6c384666082e22f22a5 100644 (file)
@@ -101,14 +101,15 @@ insert_argv(char **argv, int src, int dest)
 
     if (src > dest) {
         for (i = src; i > dest; i--)
-            argv[i] = argv[i-1];
+            argv[i] = argv[i-1];  //printf("%s\n", argv[i]);
     }
     if (src < dest) {
         for (i = src; i < dest; i++)
-            argv[i] = argv[i+1];
+            argv[i] = argv[i+1]; //printf("%s\n", argv[i]);
     }
 
     argv[dest] = tmp;
+       //printf("%s\n", argv[dest]);
 
     return 0;
 }
@@ -122,10 +123,13 @@ search_longopt(char *arg, struct option *longopts)
         ;
 
     for (i = 0; longopts[i].name; i++) {
+       //printf("%d\t%s\t", i, longopts[i].name); 
+       //printf("%s\n", arg);
         if (strncmp(arg, longopts[i].name, len) == 0) {
             if (found != -1)
                 return -1;      /* found some candidate */
             found = i;
+       //printf("found = %d\n", found);
         }
     }
     return found;
index e1830cd8fbaacaf518f17b74a8822b475e485b53..597aac889f9842fa87508dcde5cc319c5ff1b0f6 100644 (file)
@@ -517,7 +517,7 @@ int HCluster::combineFile() {
                //in = fopen(distfile.c_str(), "rb");
        
                ifstream in;
-               m->openInputFile(distfile, in);
+               m->openInputFile(distfile, in, "no error");
                
                int first, second;
                float dist;
@@ -741,7 +741,7 @@ int HCluster::processFile() {
                float distance;
                
                ifstream in;
-               m->openInputFile(distfile, in);
+               m->openInputFile(distfile, in, "no error");
                
                ofstream out;
                string outTemp = distfile + ".temp";
index 61e29390c21ae0a851a3acaede4c9da681d4d7d4..7e77980659681cd6aa4bbafbc6d502e4e0064bc7 100644 (file)
@@ -264,11 +264,11 @@ int HeatMapSimCommand::runCommandShared() {
                //you have groups
                read = new ReadOTUFile(globaldata->inputFileName);      
                read->read(&*globaldata); 
-                       
+                               
                input = globaldata->ginput;
                lookup = input->getSharedRAbundVectors();
                string lastLabel = lookup[0]->getLabel();
-               
+                       
                if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); return 0;}
                                
                //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
@@ -315,7 +315,8 @@ int HeatMapSimCommand::runCommandShared() {
 
                        //get next line to process
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
-                       lookup = input->getSharedRAbundVectors();                               
+                       lookup = input->getSharedRAbundVectors();
+
                }
                
                        
@@ -352,10 +353,10 @@ int HeatMapSimCommand::runCommandShared() {
                        
                //reset groups parameter
                globaldata->Groups.clear();  
-               
+                       
                delete input;  globaldata->ginput = NULL;
                delete read;
-
+       
                return 0;
        }
        catch(exception& e) {
index a4d66921629cc700f2042d676f9e52e50674ba56..5d71450ef60bb0fe5c972d6c38fe67565a5687e7 100644 (file)
@@ -26,6 +26,8 @@ InputData::InputData(string fName, string f) : format(f){
 
 InputData::~InputData(){
        fileHandle.close();
+       globaldata = GlobalData::getInstance();
+       globaldata->saveNextLabel = "";
 //     delete output;
        
 }
index 658b21d8cdfe649d8434e883655ecd18922f2554..ccf35512264023384e3426040dcddcad691f8a42 100644 (file)
@@ -46,6 +46,7 @@ private:
        map<string,int> orderMap;
        string filename;
        MothurOut* m;
+       GlobalData* globaldata;
 };
 
 
index 9679642d9b62fb4a621701d21ad4c0d7cadb7281..17809631f9e9cc590e510a33ec5528e493a14d3c 100644 (file)
@@ -366,11 +366,11 @@ int SplitAbundCommand::writeList(ListVector* thisList) {
                        
                        string rare = outputDir + m->getRootName(m->getSimpleName(listfile))  + "rare.list";
                        m->openOutputFileAppend(rare, rout);
-                       outputNames.push_back(rare);
+                       //outputNames.push_back(rare);
                        
                        string abund = outputDir + m->getRootName(m->getSimpleName(listfile))  + "abund.list";
                        m->openOutputFileAppend(abund, aout);
-                       outputNames.push_back(abund);
+                       //outputNames.push_back(abund);
 
                        if (rareNames.size() != 0)      {  rout << thisList->getLabel() << '\t' << numRareBins << '\t';         }
                        if (abundNames.size() != 0) {   aout << thisList->getLabel() << '\t' << numAbundBins << '\t';   }
index e47e71d581d9a24f5b4c5ced4ac1875a94b1d269..320bc41f4816eccb8f4b0fb19cb92864e91055d2 100644 (file)
@@ -428,10 +428,10 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                vector<ofstream*> fastaFileNames;
                vector<ofstream*> qualFileNames;
                
-       cout << "here" << endl; 
                if (oligoFile != "") {          
                        m->openOutputFile(groupFile, outGroups);   
                        for (int i = 0; i < fastaNames.size(); i++) {
+
                        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                                fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(getpid()) + ".temp").c_str(), ios::ate)); 
                                if(qFileName != ""){
@@ -445,17 +445,17 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                        #endif
                        }
                }
-cout << "here " << filename << endl;           
+               
                ifstream inFASTA;
                m->openInputFile(filename, inFASTA);
                inFASTA.seekg(line->start);
-       cout << "here " << qFileName << endl;   
+               
                ifstream qFile;
                if(qFileName != "")     {       m->openInputFile(qFileName, qFile);     qFile.seekg(qline->start);  }
                
                bool done = false;
                int count = 0;
-       cout << "here" << endl;
+       
                while (!done) {
                                
                        if (m->control_pressed) {