Skip to content

Commit 1375132

Browse files
committed
Issue informative warning if index is too old
1 parent a11e30e commit 1375132

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ enable_testing()
44

55
project (RapMap)
66

7-
set(CPACK_PACKAGE_VERSION "0.1.1")
8-
set(CPACK_PACKAGE_VERSION_MAJOR "0")
9-
set(CPACK_PACKAGE_VERSION_MINOR "1")
10-
set(CPACK_PACKAGE_VERSION_PATCH "1")
7+
set(CPACK_PACKAGE_VERSION "0.2.0")
8+
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
9+
set(CPACK_PACKAGE_VERSION_MINOR "2")
10+
set(CPACK_PACKAGE_VERSION_PATCH "0")
1111
set(CPACK_GENERATOR "TGZ")
1212
set(CPACK_SOURCE_GENERATOR "TGZ")
1313
set(CPACK_PACKAGE_VENDOR "Stony Brook University")

include/IndexHeader.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __INDEX_HEADER_HPP__
22
#define __INDEX_HEADER_HPP__
33

4+
#include "spdlog/spdlog.h"
45
#include <cereal/types/string.hpp>
56

67
// The different types of indices supported
@@ -31,14 +32,23 @@ class IndexHeader {
3132
}
3233

3334
template <typename Archive>
34-
void load(Archive& ar) {
35+
void load(Archive& ar) {
36+
try {
3537
ar( cereal::make_nvp("IndexType", type_) );
3638
ar( cereal::make_nvp("IndexVersion", versionString_) );
3739
ar( cereal::make_nvp("UsesKmers", usesKmers_) );
3840
ar( cereal::make_nvp("KmerLen", kmerLen_) );
3941
ar( cereal::make_nvp("BigSA", bigSA_) );
4042
ar( cereal::make_nvp("PerfectHash", perfectHash_) );
43+
} catch (const cereal::Exception& e) {
44+
auto cerrLog = spdlog::get("stderrLog");
45+
cerrLog->error("Encountered exception [{}] when loading index.", e.what());
46+
cerrLog->error("The index was likely build with an older (and incompatible) "
47+
"version of RapMap. Please re-build the index with a compatible version.");
48+
cerrLog->flush();
49+
std::exit(1);
4150
}
51+
}
4252

4353
IndexType indexType() const { return type_; }
4454
std::string version() const { return versionString_; }

include/RapMapConfig.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
namespace rapmap {
77
constexpr char majorVersion[] = "0";
8-
constexpr char minorVersion[] = "1";
8+
constexpr char minorVersion[] = "2";
99
constexpr char patchVersion[] = "0";
10-
constexpr char version [] = "0.1.0";
11-
constexpr uint32_t indexVersion = 1;
10+
constexpr char version [] = "0.2.0";
11+
constexpr uint32_t indexVersion = 2;
1212
}
1313

1414
#endif //__RAPMAP_CONFIG_HPP__

src/RapMapIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool RapMapIndex::load(std::string& indexPrefix) {
126126

127127
std::ifstream revJumpStream(revJumpFile, std::ios::binary);
128128
{
129-
logger->info("loading forward jumps");
129+
logger->info("loading reverse jumps");
130130
ScopedTimer timer;
131131
cereal::BinaryInputArchive revJumpArchive(revJumpStream);
132132
revJumpArchive(revJumpTable);

src/RapMapSAIndexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ void indexTranscriptsSA(ParserT* parser,
716716
}
717717
}
718718

719-
std::string indexVersion = "q1";
719+
std::string indexVersion = "q2";
720720
IndexHeader header(IndexType::QUASI, indexVersion, true, k, largeIndex, usePerfectHash);
721721
// Finally (since everything presumably succeeded) write the header
722722
std::ofstream headerStream(outputDir + "header.json");

0 commit comments

Comments
 (0)