SeqAn3 3.4.0-rc.3
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
bi_fm_index.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
12#include <filesystem>
13#include <ranges>
14#include <utility>
15
19
20namespace seqan3
21{
22
54template <semialphabet alphabet_t,
55 text_layout text_layout_mode_,
56 detail::sdsl_index sdsl_index_type_ = default_sdsl_index_type>
58{
59private:
64 using sdsl_index_type = sdsl_index_type_;
65
67 using rev_sdsl_index_type = sdsl::csa_wt<sdsl_wt_index_type::wavelet_tree_type, // Wavelet tree type
68 10'000'000, // Sampling rate of the suffix array
69 10'000'000, // Sampling rate of the inverse suffix array
70 sdsl::sa_order_sa_sampling<>, // Text or SA based sampling for SA
71 sdsl::isa_sampling<>, // Text or ISA based sampling for ISA
72 sdsl_wt_index_type::alphabet_type>; // How to represent the alphabet
73
77 using sdsl_char_type = typename sdsl_index_type::alphabet_type::char_type;
78
80 using sdsl_sigma_type = typename sdsl_index_type::alphabet_type::sigma_type;
81
84
86 using rev_fm_index_type = detail::reverse_fm_index<alphabet_t, text_layout_mode_, rev_sdsl_index_type>;
88
90 fm_index_type fwd_fm;
91
93 rev_fm_index_type rev_fm;
94
114 template <std::ranges::range text_t>
115 void construct(text_t && text)
116 {
117 detail::fm_index_validator::validate<alphabet_t, text_layout_mode_>(text);
118
119 fwd_fm = fm_index_type{text};
120 rev_fm = rev_fm_index_type{text};
121 }
122
123public:
126
133 using size_type = typename sdsl_index_type::size_type;
135
143
145
146 template <typename bi_fm_index_t>
147 friend class bi_fm_index_cursor;
148
152 bi_fm_index() = default;
153 bi_fm_index(bi_fm_index const &) = default;
154 bi_fm_index & operator=(bi_fm_index const &) = default;
155 bi_fm_index(bi_fm_index &&) = default;
157 ~bi_fm_index() = default;
158
167 template <std::ranges::range text_t>
169 {
170 construct(std::forward<text_t>(text));
171 }
173
186 {
187 return fwd_fm.size();
188 }
189
202 {
203 return size() == 0;
204 }
205
217 bool operator==(bi_fm_index const & rhs) const noexcept
218 {
219 return std::tie(fwd_fm, rev_fm) == std::tie(rhs.fwd_fm, rhs.rev_fm);
220 }
221
233 bool operator!=(bi_fm_index const & rhs) const noexcept
234 {
235 return !(*this == rhs);
236 }
237
253 {
254 return {*this};
255 }
256
270 {
271 return {fwd_fm};
272 }
273
281 template <cereal_archive archive_t>
283 {
284 archive(fwd_fm);
285 archive(rev_fm);
286 }
288};
289
294template <std::ranges::range text_t>
297
298} // namespace seqan3
Provides the seqan3::bi_fm_index_cursor for searching in the bidirectional seqan3::bi_fm_index.
The SeqAn Bidirectional FM Index Cursor.
Definition bi_fm_index_cursor.hpp:52
The SeqAn Bidirectional FM Index.
Definition bi_fm_index.hpp:58
bi_fm_index(text_t &&textxygen.css" rel="stylesheet" type="text/csstarget="_blank" href="https://en.cppreference.com/w/cpp/header/filess"/> Zfpe>)
bi_fm_index("8 }
bi_fm_index("8 }
rhs) rhs) 183 18949557o"> 1833fpan class="lineno"> 288};
202 {
288};
202 {
33
sequence_file_input_optionsThe options type defines various "MSearchResults">
36"> 306 return (dstCapacity - ctx.strm.avail_out) / sizeof(TDestValue);
307}
36"> 306 194
195 194
c ass="line"> 80 // Allows serialized access to thtargeta"l00195" name= id="l00181" name="l00181">c ass="line"><rsor_type <rsor_type 80
80
cor_type<<-8)a63cpp/memory/allocator.html">std::all380e) + sizeof(uint32_t),
Hidpan>݀javascriptv class="line">