Raptor
A fast and space-efficient pre-filter
All Classes Namespaces Files Functions Variables Macros Pages Concepts
index_upgrader.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
13#include <raptor/index.hpp>
14
15namespace raptor
16{
17
18// class index_upgrader
19// {
20// public:
21// std::string index_file{};
22// std::string output_file{};
23// double fpr{};
24// size_t max_count{};
25
26// index_upgrader() = default;
27// index_upgrader(index_upgrader const &) = default;
28// index_upgrader(index_upgrader &&) = default; // GCOVR_EXCL_LINE
29// index_upgrader & operator=(index_upgrader const &) = default;
30// index_upgrader & operator=(index_upgrader &&) = default;
31// ~index_upgrader() = default;
32
33// explicit index_upgrader(upgrade_arguments const & arguments, size_t const max_count) :
34// index_file{arguments.index_file},
35// output_file{arguments.output_file},
36// fpr{arguments.fpr},
37// max_count{max_count}
38// {}
39
40// void upgrade()
41// {
42// raptor_index<index_structure::ibf> index{};
43// {
44// std::ifstream is{index_file, std::ios::binary};
45// cereal::BinaryInputArchive iarchive{is};
46// index.load_old_index(iarchive);
47// }
48// if (std::isnan(fpr))
49// fpr = compute_fpr(index.ibf().hash_function_count(), max_count, index.ibf().bin_size());
50// index.fpr_ = fpr;
51// std::cout << "FPR for " << index_file << ": " << fpr << '\n';
52// index.is_hibf_ = false;
53// std::ofstream os{output_file, std::ios::binary};
54// cereal::BinaryOutputArchive oarchive{os};
55// oarchive(index);
56// }
57
58// static double compute_fpr(size_t const hash_fun, size_t const count, size_t const bin_size)
59// {
60// double const exp_arg = (hash_fun * count) / static_cast<double>(bin_size);
61// double const log_arg = 1.0 - std::exp(-exp_arg);
62// return std::exp(hash_fun * std::log(log_arg));
63// }
64// };
65
66} // namespace raptor
Provides raptor::raptor_index.
Provides raptor::upgrade_arguments.
Hide me