Raptor 3.0.0-rc.1
A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences
 
load_index.hpp
Go to the documentation of this file.
1// --------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md
6// --------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <chrono>
16
18#include <raptor/index.hpp>
19
20namespace raptor
21{
22
23namespace detail
24{
25
26template <typename index_t>
27void load_index(index_t & index, std::filesystem::path const & path)
28{
29 std::ifstream is{path, std::ios::binary};
30 cereal::BinaryInputArchive iarchive{is};
31
32 iarchive(index);
33}
34
35} // namespace detail
36
37template <typename index_t>
38void load_index(index_t & index, search_arguments const & arguments, size_t const part)
39{
40 std::filesystem::path index_file{arguments.index_file};
41 index_file += "_" + std::to_string(part);
42 arguments.load_index_timer.start();
43 detail::load_index(index, index_file);
44 arguments.load_index_timer.stop();
45}
46
47template <typename index_t>
48void load_index(index_t & index, search_arguments const & arguments)
49{
50 arguments.load_index_timer.start();
51 detail::load_index(index, arguments.index_file);
52 arguments.load_index_timer.stop();
53}
54
55} // namespace raptor
Provides raptor::raptor_index.
Provides raptor::search_arguments.
T to_string(T... args)