]> git.donarmstrong.com Git - mothur.git/commitdiff
bug fixes
authorwestcott <westcott>
Fri, 17 Sep 2010 16:55:59 +0000 (16:55 +0000)
committerwestcott <westcott>
Fri, 17 Sep 2010 16:55:59 +0000 (16:55 +0000)
17 files changed:
Mothur.xcodeproj/project.pbxproj
aligncommand.cpp
chimeraccodecommand.cpp
chimeracheckcommand.cpp
chimerapintailcommand.cpp
chimeraslayercommand.cpp
classifyotucommand.cpp
classifyseqscommand.cpp
filterseqscommand.cpp
groupmap.cpp
groupmap.h
makefile
mothurout.cpp
screenseqscommand.cpp
seqsummarycommand.cpp
sequence.cpp
trimseqscommand.cpp

index 0f03784a89e8beafb1aeec97a0e650aa20092e6d..c59b63772f9f8b2cccda2ce0cd4f23bdaaa1b419 100644 (file)
                                A7DA207D113FECD400BF472F /* heatmapsimcommand.h */,
                                A7DA207E113FECD400BF472F /* helpcommand.cpp */,
                                A7DA207F113FECD400BF472F /* helpcommand.h */,
-                               A7DA208D113FECD400BF472F /* libshuffcommand.cpp */,
                                A7DA208E113FECD400BF472F /* libshuffcommand.h */,
+                               A7DA208D113FECD400BF472F /* libshuffcommand.cpp */,
                                A7DA2090113FECD400BF472F /* listseqscommand.h */,
                                A7DA208F113FECD400BF472F /* listseqscommand.cpp */,
                                A703FE931194645F002C397E /* makegroupcommand.h */,
index 5aabeef9437bd9f5fdd90f6b785e52065afc3115..877e7c76773ece0f459142e674382fb2747bb8fb 100644 (file)
@@ -488,7 +488,7 @@ int AlignCommand::driver(linePair* filePos, string alignFName, string reportFNam
                        if (m->control_pressed) {  return 0; }
                        
                        Sequence* candidateSeq = new Sequence(inFASTA);  m->gobble(inFASTA);
-       
+                       
                        int origNumBases = candidateSeq->getNumBases();
                        string originalUnaligned = candidateSeq->getUnaligned();
                        int numBasesNeeded = origNumBases * threshold;
@@ -565,8 +565,12 @@ int AlignCommand::driver(linePair* filePos, string alignFName, string reportFNam
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut(toString(count)); m->mothurOutEndLine();           }
index 6a1904f16deed06b0a0515253a47a2dc8038c430..753bc9ad9f43dc1008689ac877aa5c16ca11d0a5 100644 (file)
@@ -423,8 +423,12 @@ int ChimeraCcodeCommand::driver(linePair* filePos, string outputFName, string fi
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index 4d99aa4d32a19b3f8db893c9f30186ad878a50d5..18554399e43220b596723a745142b49d2d8c123e 100644 (file)
@@ -394,8 +394,12 @@ int ChimeraCheckCommand::driver(linePair* filePos, string outputFName, string fi
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index 398d37ac7d4a25d51c56a1ce4bfea3051c2c12eb..7c3b24b8c4595079a053eab7ecd9179a1ac72d69 100644 (file)
@@ -494,8 +494,12 @@ int ChimeraPintailCommand::driver(linePair* filePos, string outputFName, string
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index 8a80d4dc2517309b3778186ed6ac4e5c937a73f1..996843b7da9a1c246dc6b38310c0e8f35c327c94 100644 (file)
@@ -439,8 +439,12 @@ int ChimeraSlayerCommand::driver(linePair* filePos, string outputFName, string f
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index 0e23461c39803cd49cac67023d6c99255284f851..b724a68fb2ec34b63e740ae5bcaa3d9981af8ed8 100644 (file)
@@ -245,7 +245,7 @@ int ClassifyOtuCommand::readNamesFile() {
                
                string name, names;
        
-               while(inNames){
+               while(!inNames.eof()){
                        inNames >> name;                        //read from first column  A
                        inNames >> names;               //read from second column  A,B,C,D
                        m->gobble(inNames);
@@ -313,9 +313,10 @@ string ClassifyOtuCommand::findConsensusTaxonomy(int bin, ListVector* thisList,
                
                size = 0;
                for (int i = 0; i < names.size(); i++) {
-               
+       
                        //if namesfile include the names
                        if (namefile != "") {
+       
                                //is this sequence in the name file - namemap maps seqName -> repSeqName
                                it2 = nameMap.find(names[i]);
                                
@@ -327,7 +328,8 @@ string ClassifyOtuCommand::findConsensusTaxonomy(int bin, ListVector* thisList,
                                        it = taxMap.find(it2->second);
                        
                                        if (it == taxMap.end()) { //this name is not in taxonomy file, skip it
-                                               if (names[i] != it->second) { m->mothurOut(names[i] + " is represented by " +  it2->second + " and is not in your taxonomy file.  I will not include it in the consensus."); m->mothurOutEndLine(); }
+                                       
+                                               if (names[i] != it2->second) { m->mothurOut(names[i] + " is represented by " +  it2->second + " and is not in your taxonomy file.  I will not include it in the consensus."); m->mothurOutEndLine(); }
                                                else {  m->mothurOut(names[i] + " is not in your taxonomy file.  I will not include it in the consensus."); m->mothurOutEndLine(); }
                                        }else{
                                
@@ -426,8 +428,9 @@ int ClassifyOtuCommand::process(ListVector* processList) {
                
                //for each bin in the list vector
                for (int i = 0; i < processList->getNumBins(); i++) {
+       
                        conTax  = findConsensusTaxonomy(i, processList, size);
-                       
+               
                        if (m->control_pressed) { out.close();  return 0; }
                        
                        //output to new names file
index e934d9d6d114a18759ec317185cd01085ac72052..33f49e5fc4b322301c4620cf4c9263fe751ab259 100644 (file)
@@ -767,8 +767,12 @@ int ClassifySeqsCommand::driver(linePair* filePos, string taxFName, string tempT
                        }
                        delete candidateSeq;
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index 1b3b3cfd415cd51605fe3c09a8b3b5a9f11b160d..addc5f338c9202811a7d6e341167c8a097e03ea0 100644 (file)
@@ -485,8 +485,12 @@ int FilterSeqsCommand::driverRunFilter(string F, string outputFilename, string i
                                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();           }
@@ -786,8 +790,12 @@ int FilterSeqsCommand::driverCreateFilter(Filters& F, string filename, linePair*
                                        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();           }
index 0e0be0e8cf2799527e2664bb79b1cdded09e215c..f6705e53db2048691b95050f3005bdccecf21347 100644 (file)
@@ -46,6 +46,32 @@ int GroupMap::readMap() {
                fileHandle.close();
                return error;
 }
+/************************************************************/
+int GroupMap::readDesignMap() {
+               string seqName, seqGroup;
+               int error = 0;
+
+               while(fileHandle){
+                       fileHandle >> seqName;  m->gobble(fileHandle);          //read from first column
+                       fileHandle >> seqGroup;                 //read from second column
+                       
+                       if (m->control_pressed) {  fileHandle.close();  return 1; }
+       
+                       setNamesOfGroups(seqGroup);
+                       
+                       it = groupmap.find(seqName);
+                       
+                       if (it != groupmap.end()) { error = 1; m->mothurOut("Your designfile contains more than 1 group named " + seqName + ", group names must be unique. Please correct."); m->mothurOutEndLine();  }
+                       else {
+                               groupmap[seqName] = seqGroup;   //store data in map
+                               seqsPerGroup[seqGroup]++;  //increment number of seqs in that group
+                       }
+                       m->gobble(fileHandle);
+               }
+               fileHandle.close();
+               return error;
+}
+
 /************************************************************/
 int GroupMap::getNumGroups() { return namesOfGroups.size();    }
 /************************************************************/
index 8a1cfff6f660e0042f8a44784e8abff7864c5c2e..d0e43c5b16a8989786146ec2026b18bbd86c8121 100644 (file)
@@ -21,6 +21,7 @@ public:
        GroupMap(string);
        ~GroupMap();
        int readMap();
+       int readDesignMap();
        int getNumGroups();
        bool isValidGroup(string);  //return true if string is a valid group
        string getGroup(string);
index 44f54846d78c405c54f94897f3306417509e6347..92c20134b7911b1cb2aa570da7c2e95cdc1b119b 100644 (file)
--- a/makefile
+++ b/makefile
@@ -15,7 +15,7 @@ CXXFLAGS += -O3
 
 MOTHUR_FILES = "\"../Release\""
 
-RELEASE_DATE = "\"9/9/2010\""
+RELEASE_DATE = "\"9/17/2010\""
 VERSION = "\"1.13.0\""
 
 CXXFLAGS += -DRELEASE_DATE=${RELEASE_DATE} -DVERSION=${VERSION}
index 0c3ef3d9cddf5cc90544d9a6d0117882d60db6b6..1231700a42e03b3d733e27141762a6c1e5708f00 100644 (file)
@@ -276,8 +276,9 @@ int MothurOut::openOutputFileAppend(string fileName, ofstream& fileHandle){
 /***********************************************************************/
 void MothurOut::gobble(istream& f){
        try {
+               
                char d;
-               while(isspace(d=f.get()))               {;}
+               while(isspace(d=f.get()))               { ;}
                f.putback(d);
        }
        catch(exception& e) {
@@ -984,7 +985,7 @@ vector<unsigned long int> MothurOut::divideFile(string filename, int& proc) {
                //estimate file breaks
                unsigned long int chunkSize = 0;
                chunkSize = size / proc;
-       
+
                //file to small to divide by processors
                if (chunkSize == 0)  {  proc = 1;       filePos.push_back(size); return filePos;        }
        
@@ -1002,7 +1003,7 @@ vector<unsigned long int> MothurOut::divideFile(string filename, int& proc) {
                           char c = in.get();
                           if (c == '>') {   in.putback(c); newSpot = in.tellg(); break;  }
                        }
-                       
+               
                        //there was not another sequence before the end of the file
                        unsigned long int sanityPos = in.tellg();
 
@@ -1017,7 +1018,7 @@ vector<unsigned long int> MothurOut::divideFile(string filename, int& proc) {
 
                //sanity check filePos
                for (int i = 0; i < (filePos.size()-1); i++) {
-                       if (filePos[(i+1)] <= filePos[i]) {  filePos.erase(filePos.begin()+(i+1)); i--; }
+                       if (filePos[(i+1)] <= filePos[i]) {  cout << "erasing " << (i+1) << endl; filePos.erase(filePos.begin()+(i+1)); i--; }
                }
 
                proc = (filePos.size() - 1);
index 5f5d22f0e4a3775a4cea1902c460a77378f645f0..581264cbe62b1ecc6b56a848476bdccff1d31545 100644 (file)
@@ -662,8 +662,12 @@ int ScreenSeqsCommand::driver(linePair* filePos, string goodFName, string badAcc
                        count++;
                        }
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= filePos->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
                        
                        //report progress
                        if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine();         }
index abef12696c9f09e065a8d76223858e89ee129582..a47364adf9cf436a6f780f541f1fcfbf6bf3ef04 100644 (file)
@@ -343,8 +343,12 @@ 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();           }
index 04f97a8c2e22e0ccef1f8322ec23be45615b6380..78fa266105c6be21ce5442250ef8c00f389ab078 100644 (file)
@@ -74,14 +74,14 @@ Sequence::Sequence(istringstream& fastaString){
                                }
                        }
                        
-                       while (!fastaString.eof())      {       char c = fastaString.get();  if (c == 10 || c == 13){   break;  }       } // get rest of line if there's any crap there
+                       while (!fastaString.eof())      {       char c = fastaString.get();  if (c == 10 || c == 13){ break;    }       } // get rest of line if there's any crap there
                        
                        sequence = getSequenceString(fastaString);              
                        setAligned(sequence);   
                        //setUnaligned removes any gap characters for us                                                
                        setUnaligned(sequence);         
                }else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaString.tellg()) + ". Blank name."); m->mothurOutEndLine(); }
-
+               
        }
        catch(exception& e) {
                m->errorOut(e, "Sequence", "Sequence");
@@ -116,13 +116,14 @@ Sequence::Sequence(istringstream& fastaString, string JustUnaligned){
                                }
                        }
                        
-                       while (!fastaString.eof())      {       char c = fastaString.get();  if (c == 10 || c == 13){   break;  }       } // get rest of line if there's any crap there
+                       while (!fastaString.eof())      {       char c = fastaString.get();  if (c == 10 || c == 13){ break;    }       } // get rest of line if there's any crap there
                        
                        sequence = getSequenceString(fastaString);              
                        
                        //setUnaligned removes any gap characters for us                                                
                        setUnaligned(sequence);         
                }else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaString.tellg()) + ". Blank name."); m->mothurOutEndLine(); }
+               
        }
        catch(exception& e) {
                m->errorOut(e, "Sequence", "Sequence");
@@ -160,15 +161,15 @@ Sequence::Sequence(ifstream& fastaFile){
                        }
                        
                        //read real sequence
-                       while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){      break;  }       } // get rest of line if there's any crap there
+                       while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){  break;      }       } // get rest of line if there's any crap there
                        
                        sequence = getSequenceString(fastaFile);                
-               
+       
                        setAligned(sequence);   
                        //setUnaligned removes any gap characters for us                                                
                        setUnaligned(sequence); 
                }else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); }
-               
+
        }
        catch(exception& e) {
                m->errorOut(e, "Sequence", "Sequence");
@@ -202,14 +203,14 @@ Sequence::Sequence(ifstream& fastaFile, string JustUnaligned){
                        }
                        
                        //read real sequence
-                       while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){      break;  }       } // get rest of line if there's any crap there
+                       while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){       break; }       } // get rest of line if there's any crap there
                        
                        sequence = getSequenceString(fastaFile);                
                        
                        //setUnaligned removes any gap characters for us                                                
                        setUnaligned(sequence); 
                }else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); }
-
+               
        }
        catch(exception& e) {
                m->errorOut(e, "Sequence", "Sequence");
index 320bc41f4816eccb8f4b0fb19cb92864e91055d2..1d70fb17d7fd7391de4a147ea73367c67f96f786 100644 (file)
@@ -571,9 +571,13 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                count++;
                        }
                        
-                       unsigned long int pos = inFASTA.tellg();
-                       if ((pos == -1) || (pos >= line->end)) { break; }
-                       
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               unsigned long int pos = inFASTA.tellg();
+                               if ((pos == -1) || (pos >= line->end)) { break; }
+                       #else
+                               if (inFASTA.eof()) { break; }
+                       #endif
+                               
                        //report progress
                        if((count) % 1000 == 0){        m->mothurOut(toString(count)); m->mothurOutEndLine();           }