From 92d8cc375ea4cc4784e17150d10e0f9dc8004491 Mon Sep 17 00:00:00 2001 From: Milot Mirdita Date: Mon, 24 Apr 2023 15:17:21 +0900 Subject: [PATCH] Make unpackdb work correctly if no .lookup file is present --- src/util/unpackdb.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/unpackdb.cpp b/src/util/unpackdb.cpp index 4608b2865..0bd8ab40d 100644 --- a/src/util/unpackdb.cpp +++ b/src/util/unpackdb.cpp @@ -16,6 +16,12 @@ int unpackdb(int argc, const char **argv, const Command& command) { Parameters& par = Parameters::getInstance(); par.parseParameters(argc, argv, command, true, 0, 0); + std::string lookupFile = par.db1 + ".lookup"; + if (par.unpackNameMode == Parameters::UNPACK_NAME_ACCESSION && FileUtil::fileExists(lookupFile.c_str()) == false) { + Debug(Debug::INFO) << "No lookup file for " << FileUtil::baseName(par.db1) << " found, using key-based file naming\n"; + par.unpackNameMode = Parameters::UNPACK_NAME_KEY; + } + int mode = DBReader::USE_INDEX|DBReader::USE_DATA; if (par.unpackNameMode == Parameters::UNPACK_NAME_ACCESSION) { mode |= DBReader::USE_LOOKUP;