*
*/
-using namespace std;
-
-
+#include "mothur.h"
#include "sequence.hpp"
#include "database.hpp"
cout << endl << "Reading in the " << fastaFileName << " template sequences...\t"; cout.flush();
+ //all of this is elsewhere already!
numSeqs=count(istreambuf_iterator<char>(fastaFile),istreambuf_iterator<char>(), '>'); // count the number of
fastaFile.seekg(0); // sequences
string seqName, sequence;
for(int i=0;i<numSeqs;i++){
- templateSequences[i] = new Sequence(); // We're storing the aligned template sequences as a vector of
- // pointers to Sequence objects
fastaFile >> seqName;
- templateSequences[i]->setName(seqName);
-
+ seqName = seqName.substr(1);
char letter;
string aligned;
aligned += letter;
}
}
- templateSequences[i]->setAligned(aligned); // Obviously, we need the fully aligned template sequence
- templateSequences[i]->setUnaligned(aligned);// We will also need the unaligned sequence for pairwise alignments
- fastaFile.putback(letter); // and database searches
+ templateSequences[i] = Sequence(seqName, aligned);
+ fastaFile.putback(letter);
}
fastaFile.close();
+ //all of this is elsewhere already!
+
cout << "DONE." << endl; cout.flush();
}
+/**************************************************************************************************/
+
+Database::~Database(){
+ try {
+
+ //for (int i = 0; i < templateSequences.size(); i++) { delete templateSequences[i]; }
+ templateSequences.clear();
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Database class Function ~Database. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Database class function ~Database. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
/**************************************************************************************************/