5 * Created by Pat Schloss on 12/16/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
11 #include "sequence.hpp"
12 #include "database.hpp"
14 /**************************************************************************************************/
16 Database::Database(string fastaFileName){ // This assumes that the template database is in fasta format, may
17 // need to alter this in the future?
20 openInputFile(fastaFileName, fastaFile);
23 mothurOut("Reading in the " + fastaFileName + " template sequences...\t"); cout.flush();
25 //all of this is elsewhere already!
26 numSeqs=count(istreambuf_iterator<char>(fastaFile),istreambuf_iterator<char>(), '>'); // count the number of
27 fastaFile.seekg(0); // sequences
29 templateSequences.resize(numSeqs);
31 string seqName, sequence;
32 for(int i=0;i<numSeqs;i++){
34 seqName = seqName.substr(1);
38 while(fastaFile && (letter=fastaFile.get()) != '>'){
40 letter = toupper(letter);
41 if(letter == 'U'){letter = 'T';}
45 templateSequences[i] = Sequence(seqName, aligned);
46 fastaFile.putback(letter);
50 //all of this is elsewhere already!
53 mothurOutEndLine(); cout.flush();
56 /**************************************************************************************************/
58 Database::~Database(){
60 templateSequences.clear();
63 /**************************************************************************************************/
65 float Database::getSearchScore() { return searchScore; } // we're assuming that the search is already done
67 /**************************************************************************************************/