]> git.donarmstrong.com Git - mothur.git/commitdiff
final commit before testing 1.11
authorwestcott <westcott>
Tue, 15 Jun 2010 12:05:46 +0000 (12:05 +0000)
committerwestcott <westcott>
Tue, 15 Jun 2010 12:05:46 +0000 (12:05 +0000)
removeseqscommand.cpp
seqsummarycommand.cpp
sequence.cpp

index 35d9bea3aa07255f872e5c7cbe195bd720a531ba..5816cfd0ab07d7718c73e66a7fc2c9e0c1c61187 100644 (file)
@@ -334,7 +334,7 @@ int RemoveSeqsCommand::readName(){
                string name, firstCol, secondCol;
                
                bool wroteSomething = false;
-       int numSeqsInNames = 0; 
+               
                while(!in.eof()){
                        if (m->control_pressed) { in.close();  out.close();  remove(outputFileName.c_str());  return 0; }
 
@@ -359,7 +359,7 @@ int RemoveSeqsCommand::readName(){
                                        validSecond.push_back(parsedNames[i]);
                                }
                        }
-               numSeqsInNames += parsedNames.size();   
+                       
                        if ((dups) && (validSecond.size() != parsedNames.size())) {  //if dups is true and we want to get rid of anyone, get rid of everyone
                                for (int i = 0; i < parsedNames.size(); i++) {  names.insert(parsedNames[i]);  }
                        }else {
@@ -394,7 +394,7 @@ int RemoveSeqsCommand::readName(){
                }
                in.close();
                out.close();
-cout << "your names file contains " << numSeqsInNames << endl;         
+
                if (wroteSomething == false) {
                        m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
index f225d50a15670d23f4b3d484901cfb7e30cd2c29..d613391fb5e27da1d2d933e1b4b2375b69170a95 100644 (file)
@@ -230,7 +230,7 @@ int SeqSummaryCommand::execute(){
                                        openInputFile(fastafile, inFASTA);
                                        numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
                                        inFASTA.close();
-                                       
+                       cout << numSeqs << endl;                
                                        lines.push_back(new linePair(0, numSeqs));
                                        
                                        driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, summaryFile, lines[0]);
@@ -334,6 +334,7 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                        if (m->control_pressed) { in.close(); outSummary.close(); return 1; }
                                        
                        Sequence current(in);
+       
                        if (current.getName() != "") {
                                startPosition.push_back(current.getStartPos());
                                endPosition.push_back(current.getEndPos());
index 71dd3a925fab8eb7771803c6db557dfb9d10200b..0afe3a971dcb1884160cd25f6c3d1b1d7012fa68 100644 (file)
@@ -129,31 +129,37 @@ Sequence::Sequence(ifstream& fastaFile){
                m = MothurOut::getInstance();
                initialize();
                fastaFile >> name;
-               name = name.substr(1);
-               string sequence;
+
+               if (name.length() != 0) { 
                
-               //read comments
-               while ((name[0] == '#') && fastaFile) { 
-                       while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){      break;  }       } // get rest of line if there's any crap there
-                       sequence = getCommentString(fastaFile);
+                       name = name.substr(1); 
                        
-                       if (fastaFile) {  
-                               fastaFile >> name;  
-                               name = name.substr(1);  
-                       }else { 
-                               name = "";
-                               break;
-                       }
-               }
+                       string sequence;
                
-               //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
+                       //read comments
+                       while ((name[0] == '#') && fastaFile) { 
+                               while (!fastaFile.eof())        {       char c = fastaFile.get(); if (c == 10 || c == 13){      break;  }       } // get rest of line if there's any crap there
+                               sequence = getCommentString(fastaFile);
+                               
+                               if (fastaFile) {  
+                                       fastaFile >> name;  
+                                       name = name.substr(1);  
+                               }else { 
+                                       name = "";
+                                       break;
+                               }
+                       }
+                       
+                       //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
+                       
+                       sequence = getSequenceString(fastaFile);                
                
-               sequence = getSequenceString(fastaFile);                
+                       setAligned(sequence);   
+                       //setUnaligned removes any gap characters for us                                                
+                       setUnaligned(sequence); 
+               }
                
-               setAligned(sequence);   
-               //setUnaligned removes any gap characters for us                                                
-               setUnaligned(sequence); 
        }
        catch(exception& e) {
                m->errorOut(e, "Sequence", "Sequence");