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);
22 cout << endl << "Reading in the " << fastaFileName << " template sequences...\t"; cout.flush();
24 //all of this is elsewhere already!
25 numSeqs=count(istreambuf_iterator<char>(fastaFile),istreambuf_iterator<char>(), '>'); // count the number of
26 fastaFile.seekg(0); // sequences
28 templateSequences.resize(numSeqs);
30 string seqName, sequence;
31 for(int i=0;i<numSeqs;i++){
33 seqName = seqName.substr(1);
37 while(fastaFile && (letter=fastaFile.get()) != '>'){
39 letter = toupper(letter);
40 if(letter == 'U'){letter = 'T';}
44 templateSequences[i] = new Sequence(seqName, aligned);
45 fastaFile.putback(letter);
49 //all of this is elsewhere already!
51 cout << "DONE." << endl; cout.flush();
55 /**************************************************************************************************/
57 float Database::getSearchScore() { return searchScore; } // we're assuming that the search is already done
59 /**************************************************************************************************/