fastq_to_fasta
A template for creation of SeqAn3 apps, with a FASTQ to FASTA example app.
load_index.hpp
Go to the documentation of this file.
1// --------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, 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
8#pragma once
9
10#include <chrono>
11
13#include <raptor/index.hpp>
14
15namespace raptor
16{
17
18template <typename index_t>
19void load_index(index_t & index, search_arguments const & arguments, size_t const part, double & index_io_time)
20{
21 std::filesystem::path index_file{arguments.index_file};
22 index_file += "_" + std::to_string(part);
23
24 load_index(index, index_file, index_io_time);
25}
26
27template <typename index_t>
28void load_index(index_t & index, search_arguments const & arguments, double & index_io_time)
29{
30 load_index(index, arguments.index_file, index_io_time);
31}
32
33template <typename index_t>
34void load_index(index_t & index, std::filesystem::path const & path, double & index_io_time)
35{
36 std::ifstream is{path, std::ios::binary};
37 cereal::BinaryInputArchive iarchive{is};
38
39 auto start = std::chrono::high_resolution_clock::now();
40 iarchive(index);
41 auto end = std::chrono::high_resolution_clock::now();
42
43 index_io_time += std::chrono::duration_cast<std::chrono::duration<double>>(end - start).count();
44}
45
46} // namespace raptor
Definition: adjust_seed.hpp:13
void load_index(index_t &index, search_arguments const &arguments, size_t const part, double &index_io_time)
Definition: load_index.hpp:19
Definition: search_arguments.hpp:27
std::filesystem::path index_file
Definition: search_arguments.hpp:46