Raptor 3.0.0-rc.1
A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences
 
search_arguments.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 <filesystem>
16#include <vector>
17
18#include <seqan3/search/kmer_index/shape.hpp>
19
23
24namespace raptor
25{
26
28{
29 // Related to k-mers
30 uint32_t window_size{20u};
31 seqan3::shape shape{seqan3::ungapped{20u}};
32 uint8_t shape_size{shape.size()};
33 uint8_t shape_weight{shape.count()};
34 uint8_t threads{1u};
35 uint8_t parts{1u};
36
37 // Related to thresholding
38 double tau{0.9999};
40 double p_max{0.15};
41 double fpr{0.05};
42 uint64_t query_length{};
43 uint8_t errors{0};
44
45 // Related to IBF
46 std::filesystem::path index_file{};
47 bool compressed{false};
48
49 // General arguments
51 std::filesystem::path query_file{};
52 std::filesystem::path out_file{"search.out"};
53 bool write_time{false};
54 bool is_hibf{false};
55 bool cache_thresholds{false};
56 bool verbose{false};
57
58 // Timers do not copy the stored duration upon copy construction/assignment
59 mutable timer<concurrent::yes> wall_clock_timer{};
60 mutable timer<concurrent::yes> query_length_timer{};
61 mutable timer<concurrent::yes> query_file_io_timer{};
62 mutable timer<concurrent::yes> load_index_timer{};
63 mutable timer<concurrent::yes> compute_minimiser_timer{};
64 mutable timer<concurrent::yes> query_ibf_timer{};
65 mutable timer<concurrent::yes> generate_results_timer{};
66
67 void print_timings() const
68 {
69 if (!verbose)
70 return;
71 std::cerr << std::fixed << std::setprecision(2) << "============= Timings =============\n";
72 std::cerr << "Wall clock time [s]: " << wall_clock_timer.in_seconds() << '\n';
73 std::cerr << "Peak memory usage " << formatted_peak_ram() << '\n';
74 std::cerr << "Determine query length [s]: " << query_length_timer.in_seconds() << '\n';
75 std::cerr << "Query file I/O [s]: " << query_file_io_timer.in_seconds() << '\n';
76 std::cerr << "Load index [s]: " << load_index_timer.in_seconds() << '\n';
77 std::cerr << "Compute minimiser [s]: " << compute_minimiser_timer.in_seconds() / threads << '\n';
78 std::cerr << "Query IBF [s]: " << query_ibf_timer.in_seconds() / threads << '\n';
79 std::cerr << "Generate results [s]: " << generate_results_timer.in_seconds() / threads << '\n';
80 }
81
82 raptor::threshold::threshold_parameters make_threshold_parameters() const noexcept
83 {
84 return {.window_size{window_size},
85 .shape{shape},
86 .query_length{query_length},
87 .errors{errors},
88 .percentage{threshold},
89 .p_max{p_max},
90 .tau{tau},
91 .cache_thresholds{cache_thresholds},
92 .output_directory{index_file.parent_path()}};
93 }
94};
95
96} // namespace raptor
Definition: timer.hpp:30
T fixed(T... args)
Provides raptor::formatted_peak_ram.
T parent_path(T... args)
T quiet_NaN(T... args)
T setprecision(T... args)
Definition: search_arguments.hpp:28
Definition: threshold_parameters.hpp:23
Provides raptor::threshold::threshold_parameters.
Provides raptor::timer.