BlastDB::BlastDB(float gO, float gE, float m, float mM) : Database(),
gapOpen(gO), gapExtend(gE), match(m), misMatch(mM) {
- globaldata = GlobalData::getInstance();
count = 0;
int randNumber = rand();
BlastDB::BlastDB() : Database() {
try {
- globaldata = GlobalData::getInstance();
count = 0;
int randNumber = rand();
vector<int> topMatches;
ofstream queryFile;
- openOutputFile((queryFileName+seq->getName()), queryFile);
+ m->openOutputFile((queryFileName+seq->getName()), queryFile);
queryFile << '>' << seq->getName() << endl;
queryFile << seq->getUnaligned() << endl;
queryFile.close();
system(blastCommand.c_str());
ifstream m8FileHandle;
- openInputFile(blastFileName+seq->getName(), m8FileHandle, "no error");
+ m->openInputFile(blastFileName+seq->getName(), m8FileHandle, "no error");
string dummy;
int templateAccession;
- gobble(m8FileHandle);
+ m->gobble(m8FileHandle);
while(!m8FileHandle.eof()){
m8FileHandle >> dummy >> templateAccession >> searchScore;
//get rest of junk in line
while (!m8FileHandle.eof()) { char c = m8FileHandle.get(); if (c == 10 || c == 13){ break; } }
- gobble(m8FileHandle);
+ m->gobble(m8FileHandle);
topMatches.push_back(templateAccession);
}
m8FileHandle.close();
vector<int> BlastDB::findClosestMegaBlast(Sequence* seq, int n) {
try{
vector<int> topMatches;
+ Scores.clear();
ofstream queryFile;
- openOutputFile((queryFileName+seq->getName()), queryFile);
+
+ m->openOutputFile((queryFileName+seq->getName()), queryFile);
queryFile << '>' << seq->getName() << endl;
queryFile << seq->getUnaligned() << endl;
queryFile.close();
system(blastCommand.c_str());
ifstream m8FileHandle;
- openInputFile(blastFileName+seq->getName(), m8FileHandle, "no error");
+ m->openInputFile(blastFileName+seq->getName(), m8FileHandle, "no error");
string dummy;
int templateAccession;
- gobble(m8FileHandle);
+ m->gobble(m8FileHandle);
while(!m8FileHandle.eof()){
m8FileHandle >> dummy >> templateAccession >> searchScore;
+ //cout << templateAccession << '\t' << searchScore << endl;
//get rest of junk in line
while (!m8FileHandle.eof()) { char c = m8FileHandle.get(); if (c == 10 || c == 13){ break; } }
- gobble(m8FileHandle);
+ m->gobble(m8FileHandle);
topMatches.push_back(templateAccession);
+ Scores.push_back(searchScore);
//cout << templateAccession << endl;
}
m8FileHandle.close();
remove((queryFileName+seq->getName()).c_str());
remove((blastFileName+seq->getName()).c_str());
-//cout << "\n\n" ;
+//cout << "\n" ;
return topMatches;
}
catch(exception& e) {
- m->errorOut(e, "BlastDB", "findClosest");
+ m->errorOut(e, "BlastDB", "findClosestMegaBlast");
exit(1);
}
}
try {
ofstream unalignedFastaFile;
- openOutputFileAppend(dbFileName, unalignedFastaFile);
+ m->openOutputFileAppend(dbFileName, unalignedFastaFile);
// generating a fasta file with unaligned template
unalignedFastaFile << '>' << count << endl; // sequences, which will be input to formatdb
//m->mothurOut("Generating the temporary BLAST database...\t"); cout.flush();
- path = globaldata->argv;
+ path = m->argv;
path = path.substr(0, (path.find_last_of('m')));
string formatdbCommand = path + "blast/bin/formatdb -p F -o T -i " + dbFileName; // format the database, -o option gives us the ability