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 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++){
33 templateSequences[i] = new Sequence(); // We're storing the aligned template sequences as a vector of
34 // pointers to Sequence objects
36 templateSequences[i]->setName(seqName);
41 while(fastaFile && (letter=fastaFile.get()) != '>'){
43 letter = toupper(letter);
44 if(letter == 'U'){letter = 'T';}
48 templateSequences[i]->setAligned(aligned); // Obviously, we need the fully aligned template sequence
49 templateSequences[i]->setUnaligned(aligned);// We will also need the unaligned sequence for pairwise alignments
50 fastaFile.putback(letter); // and database searches
54 cout << "DONE." << endl; cout.flush();
58 /**************************************************************************************************/
60 float Database::getSearchScore() { return searchScore; } // we're assuming that the search is already done
62 /**************************************************************************************************/