5 * Created by Pat Schloss on 12/16/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
13 #include "sequence.hpp"
14 #include "database.hpp"
16 /**************************************************************************************************/
18 Database::Database(string fastaFileName){ // This assumes that the template database is in fasta format, may
19 // need to alter this in the future?
22 openInputFile(fastaFileName, fastaFile);
24 cout << endl << "Reading in the " << fastaFileName << " template sequences...\t"; cout.flush();
26 //all of this is elsewhere already!
27 numSeqs=count(istreambuf_iterator<char>(fastaFile),istreambuf_iterator<char>(), '>'); // count the number of
28 fastaFile.seekg(0); // sequences
30 templateSequences.resize(numSeqs);
32 string seqName, sequence;
33 for(int i=0;i<numSeqs;i++){
35 seqName = seqName.substr(1);
39 while(fastaFile && (letter=fastaFile.get()) != '>'){
41 letter = toupper(letter);
42 if(letter == 'U'){letter = 'T';}
46 templateSequences[i] = new Sequence(seqName, aligned);
47 fastaFile.putback(letter);
51 //all of this is elsewhere already!
53 cout << "DONE." << endl; cout.flush();
57 /**************************************************************************************************/
59 float Database::getSearchScore() { return searchScore; } // we're assuming that the search is already done
61 /**************************************************************************************************/