Skip to content

Commit

Permalink
Improve naming of prefilter merging stages
Browse files Browse the repository at this point in the history
  • Loading branch information
elileka committed Aug 12, 2019
1 parent 67c04ae commit 5047bdc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/commons/DBWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ void DBWriter::mergeResults(const char *outFileName, const char *outFileNameInde

DBWriter::sortIndex(indexFileNames[0], outFileNameIndex, lexicographicOrder);
FileUtil::remove(indexFileNames[0]);
Debug(Debug::INFO) << "Time for merging files: " << timer.lap() << "\n";
Debug(Debug::INFO) << "Time for merging into " << outFileName << " by mergeResults: " << timer.lap() << "\n";
}

void DBWriter::mergeIndex(const char** indexFilenames, unsigned int fileCount, const std::vector<size_t> &dataSizes) {
Expand Down Expand Up @@ -721,14 +721,15 @@ void DBWriter::mergeFilePair(const std::vector<std::pair<std::string, std::strin
}
delete[] files;

Debug(Debug::INFO) << "Merge file " << fileNames[0].first << " and " << fileNames[0].second << "\n";
Debug(Debug::INFO) << "Will merge " << fileNames.size() << " files into " << fileNames[0].first << " and into " << fileNames[0].second << "\n";
DBReader<unsigned int> reader1(fileNames[0].first.c_str(), fileNames[0].second.c_str(), 1,
DBReader<unsigned int>::USE_INDEX);
reader1.open(DBReader<unsigned int>::NOSORT);
unsigned int *seqLen1 = reader1.getSeqLens();
DBReader<unsigned int>::Index *index1 = reader1.getIndex();

for (size_t i = 1; i < fileNames.size(); i++) {
Debug(Debug::INFO) << "Adding files " << fileNames[i].first << " and " << fileNames[i].second << " to the merge \n";
DBReader<unsigned int> reader2(fileNames[i].first.c_str(), fileNames[i].second.c_str(), 1,
DBReader<unsigned int>::USE_INDEX);
reader2.open(DBReader<unsigned int>::NOSORT);
Expand Down
2 changes: 1 addition & 1 deletion src/commons/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class Parameters {
bool diagonalScoring; // switch diagonal scoring
int exactKmerMatching; // only exact k-mer matching
int maskMode; // mask low complex areas
int maskLowerCaseMode; // maske lowercase letters in prefilter and kmermatchers
int maskLowerCaseMode; // mask lowercase letters in prefilter and kmermatchers

int minDiagScoreThr; // min diagonal score
int spacedKmer; // Spaced Kmers
Expand Down
12 changes: 6 additions & 6 deletions src/prefiltering/Prefiltering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void Prefiltering::setupSplit(DBReader<unsigned int>& tdbr, const int alphabetSi
}
}

void Prefiltering::mergeOutput(const std::string &outDB, const std::string &outDBIndex,
void Prefiltering::mergeTargetSplits(const std::string &outDB, const std::string &outDBIndex,
const std::vector<std::pair<std::string, std::string>> &filenames) {
Timer timer;
if (filenames.size() < 2) {
Expand Down Expand Up @@ -444,7 +444,7 @@ void Prefiltering::mergeOutput(const std::string &outDB, const std::string &outD

DBReader<unsigned int>::removeDb(tmpDb.first);

Debug(Debug::INFO) << "\nTime for merging results: " << timer.lap() << "\n";
Debug(Debug::INFO) << "\nTime for merging into " << outDB << " by mergeTargetSplits: " << timer.lap() << "\n";
}


Expand Down Expand Up @@ -598,7 +598,7 @@ void Prefiltering::runMpiSplits(const std::string &resultDB, const std::string &

if (splitFiles.size() > 0) {
// merge output databases
mergeFiles(resultDB, resultDBIndex, splitFiles);
mergePrefilterSplits(resultDB, resultDBIndex, splitFiles);
} else {
Debug(Debug::ERROR) << "Aborting. No results were computed!\n";
EXIT(EXIT_FAILURE);
Expand Down Expand Up @@ -642,7 +642,7 @@ int Prefiltering::runSplits(const std::string &resultDB, const std::string &resu
}
}
if (splitFiles.size() > 0) {
mergeFiles(resultDB, resultDBIndex, splitFiles);
mergePrefilterSplits(resultDB, resultDBIndex, splitFiles);
hasResult = true;
}
} else if (splitProcessCount == 1) {
Expand Down Expand Up @@ -921,10 +921,10 @@ BaseMatrix *Prefiltering::getSubstitutionMatrix(const ScoreMatrixFile &scoringMa
return subMat;
}

void Prefiltering::mergeFiles(const std::string &outDB, const std::string &outDBIndex,
void Prefiltering::mergePrefilterSplits(const std::string &outDB, const std::string &outDBIndex,
const std::vector<std::pair<std::string, std::string>> &splitFiles) {
if (splitMode == Parameters::TARGET_DB_SPLIT) {
mergeOutput(outDB, outDBIndex, splitFiles);
mergeTargetSplits(outDB, outDBIndex, splitFiles);
} else if (splitMode == Parameters::QUERY_DB_SPLIT) {
DBWriter::mergeResults(outDB, outDBIndex, splitFiles);
}
Expand Down
4 changes: 2 additions & 2 deletions src/prefiltering/Prefiltering.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Prefiltering {
int runSplits(const std::string &resultDB, const std::string &resultDBIndex, size_t fromSplit, size_t splitProcessCount, bool merge);

// merge file
void mergeFiles(const std::string &outDb, const std::string &outDBIndex,
void mergePrefilterSplits(const std::string &outDb, const std::string &outDBIndex,
const std::vector<std::pair<std::string, std::string>> &splitFiles);

// get substitution matrix
Expand Down Expand Up @@ -125,7 +125,7 @@ class Prefiltering {
void printStatistics(const statistics_t &stats, std::list<int> **reslens,
unsigned int resLensSize, size_t empty, size_t maxResults);

void mergeOutput(const std::string &outDb, const std::string &outDBIndex,
void mergeTargetSplits(const std::string &outDb, const std::string &outDBIndex,
const std::vector<std::pair<std::string, std::string>> &filenames);

bool isSameQTDB();
Expand Down

0 comments on commit 5047bdc

Please sign in to comment.