Skip to content

Commit

Permalink
Issue informative warning if index is too old
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-p committed Mar 16, 2016
1 parent a11e30e commit 1375132
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ enable_testing()

project (RapMap)

set(CPACK_PACKAGE_VERSION "0.1.1")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_VERSION "0.2.0")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "2")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_PACKAGE_VENDOR "Stony Brook University")
Expand Down
12 changes: 11 additions & 1 deletion include/IndexHeader.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef __INDEX_HEADER_HPP__
#define __INDEX_HEADER_HPP__

#include "spdlog/spdlog.h"
#include <cereal/types/string.hpp>

// The different types of indices supported
Expand Down Expand Up @@ -31,14 +32,23 @@ class IndexHeader {
}

template <typename Archive>
void load(Archive& ar) {
void load(Archive& ar) {
try {
ar( cereal::make_nvp("IndexType", type_) );
ar( cereal::make_nvp("IndexVersion", versionString_) );
ar( cereal::make_nvp("UsesKmers", usesKmers_) );
ar( cereal::make_nvp("KmerLen", kmerLen_) );
ar( cereal::make_nvp("BigSA", bigSA_) );
ar( cereal::make_nvp("PerfectHash", perfectHash_) );
} catch (const cereal::Exception& e) {
auto cerrLog = spdlog::get("stderrLog");
cerrLog->error("Encountered exception [{}] when loading index.", e.what());
cerrLog->error("The index was likely build with an older (and incompatible) "
"version of RapMap. Please re-build the index with a compatible version.");
cerrLog->flush();
std::exit(1);
}
}

IndexType indexType() const { return type_; }
std::string version() const { return versionString_; }
Expand Down
6 changes: 3 additions & 3 deletions include/RapMapConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

namespace rapmap {
constexpr char majorVersion[] = "0";
constexpr char minorVersion[] = "1";
constexpr char minorVersion[] = "2";
constexpr char patchVersion[] = "0";
constexpr char version [] = "0.1.0";
constexpr uint32_t indexVersion = 1;
constexpr char version [] = "0.2.0";
constexpr uint32_t indexVersion = 2;
}

#endif //__RAPMAP_CONFIG_HPP__
2 changes: 1 addition & 1 deletion src/RapMapIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool RapMapIndex::load(std::string& indexPrefix) {

std::ifstream revJumpStream(revJumpFile, std::ios::binary);
{
logger->info("loading forward jumps");
logger->info("loading reverse jumps");
ScopedTimer timer;
cereal::BinaryInputArchive revJumpArchive(revJumpStream);
revJumpArchive(revJumpTable);
Expand Down
2 changes: 1 addition & 1 deletion src/RapMapSAIndexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ void indexTranscriptsSA(ParserT* parser,
}
}

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

0 comments on commit 1375132

Please sign in to comment.