m->mothurOut("Generating search database... "); cout.flush();
#ifdef USE_MPI
int pid, processors;
- vector<long> positions;
+ vector<unsigned long int> positions;
int tag = 2001;
MPI_Status status;
//delete inFileName;
if (pid == 0) { //only one process needs to scan file
- positions = setFilePosFasta(tempFile, numSeqs); //fills MPIPos, returns numSeqs
+ positions = m->setFilePosFasta(tempFile, numSeqs); //fills MPIPos, returns numSeqs
//send file positions to all processes
for(int i = 1; i < processors; i++) {
//need to know number of template seqs for suffixdb
if (method == "suffix") {
ifstream inFASTA;
- openInputFile(tempFile, inFASTA);
- numSeqs = count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+ m->openInputFile(tempFile, inFASTA);
+ m->getNumSeqs(inFASTA, numSeqs);
inFASTA.close();
}
kmerDBName = tempFile.substr(0,tempFile.find_last_of(".")+1) + char('0'+ kmerSize) + "mer";
ifstream kmerFileTest(kmerDBName.c_str());
- if(kmerFileTest){ needToGenerate = false; }
+ if(kmerFileTest){
+ bool GoodFile = m->checkReleaseVersion(kmerFileTest, m->getVersion());
+ if (GoodFile) { needToGenerate = false; }
+ }
}
else if(method == "suffix") { database = new SuffixDB(numSeqs); }
- else if(method == "blast") { database = new BlastDB(gapOpen, gapExtend, match, misMatch); }
+ else if(method == "blast") { database = new BlastDB(tempFile.substr(0,tempFile.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch); }
else if(method == "distance") { database = new DistanceDB(); }
else {
m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8.");
if (needToGenerate) {
ifstream fastaFile;
- openInputFile(tempFile, fastaFile);
+ m->openInputFile(tempFile, fastaFile);
while (!fastaFile.eof()) {
Sequence temp(fastaFile);
- gobble(fastaFile);
+ m->gobble(fastaFile);
names.push_back(temp.getName());
}else if ((method == "kmer") && (!needToGenerate)) {
ifstream kmerFileTest(kmerDBName.c_str());
database->readKmerDB(kmerFileTest);
-
+
ifstream fastaFile;
- openInputFile(tempFile, fastaFile);
+ m->openInputFile(tempFile, fastaFile);
while (!fastaFile.eof()) {
Sequence temp(fastaFile);
- gobble(fastaFile);
+ m->gobble(fastaFile);
names.push_back(temp.getName());
}
fastaFile.close();
}
-#endif
+#endif
+
database->setNumSeqs(names.size());
//sanity check
#ifdef USE_MPI
int pid, num, processors;
- vector<long> positions;
+ vector<unsigned long int> positions;
int tag = 2001;
MPI_Status status;
//delete inFileName;
if (pid == 0) {
- positions = setFilePosEachLine(file, num);
+ positions = m->setFilePosEachLine(file, num);
//send file positions to all processes
for(int i = 1; i < processors; i++) {
MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
#else
ifstream inTax;
- openInputFile(file, inTax);
+ m->openInputFile(file, inTax);
//read template seqs and save
while (!inTax.eof()) {
phyloTree->addSeqToTree(name, taxInfo);
- gobble(inTax);
+ m->gobble(inTax);
}
inTax.close();
#endif
phyloTree->assignHeirarchyIDs(0);
phyloTree->setUp(file);
-
+
m->mothurOut("DONE.");
m->mothurOutEndLine(); cout.flush();