42 #include <sdsl/suffix_trees.hpp> 44 #include <range/v3/algorithm/copy.hpp> 63 template <
typename index_t>
64 class fm_index_iterator;
66 template <
typename index_t>
67 class bi_fm_index_iterator;
93 sdsl::rank_support_v<>,
94 sdsl::select_support_scan<>,
95 sdsl::select_support_scan<0>
99 sdsl::sa_order_sa_sampling<>,
100 sdsl::isa_sampling<>,
129 template <std::ranges::RandomAccessRange text_t, fm_index_traits_concept fm_index_traits = fm_index_default_traits>
142 using sdsl_index_type =
typename fm_index_traits::sdsl_index_type;
147 using sdsl_char_type =
typename sdsl_index_type::alphabet_type::char_type;
151 sdsl_index_type index;
153 text_t
const * text =
nullptr;
169 template <
typename bi_fm_index_t>
172 template <
typename fm_index_t>
175 template <
typename fm_index_t>
176 friend class detail::fm_index_iterator_node;
228 if (text.begin() == text.end())
229 throw std::invalid_argument(
"The text that is indexed cannot be empty.");
236 sdsl::int_vector<8> tmp_text(text.size());
239 std::vector<value_type_t<text_t>> another_copy = text |
view::reverse;
242 seqan3::begin(tmp_text));
244 sdsl::construct_im(index, tmp_text, 0);
253 void construct(text_t &&) =
delete;
256 void construct(text_t
const &&) =
delete;
333 bool load(filesystem::path
const & path)
336 if (sdsl::load_from_file(tmp, path))
338 std::swap(this->index, tmp);
356 bool store(filesystem::path
const & path)
const 358 return sdsl::store_to_file(index, path);
Provides seqan3::view::reverse.
Provides the internal representation of a node of the seqan3::fm_index_iterator.
constexpr auto transform
A range adaptor that takes a invocable and returns a view of the elements with the invocable applied...
Definition: transform.hpp:95
innermost_value_type_t< text_t > char_type
The type of the underlying character of text_type.
Definition: fm_index.hpp:162
bool load(filesystem::path const &path)
Loads the index from disk. Temporary function until cereal is supported.
Definition: fm_index.hpp:333
typename sdsl_index_type::size_type size_type
Type for representing positions in the indexed text.
Definition: fm_index.hpp:164
iterator_type begin() const noexcept
Returns a seqan3::fm_index_iterator on the index that can be used for searching.
Definition: fm_index.hpp:316
Provides the concepts for seqan3::fm_index and seqan3::bi_fm_index and its traits and iterators...
void construct(text_t const &text)
Constructs the index given a range. The range cannot be an rvalue (i.e. a temporary object) and has t...
Definition: fm_index.hpp:225
Contains various shortcuts for common std::ranges functions.
Provides an alphabet mapping that implements an identity map (i.e. each character is mapped to its ra...
::ranges::copy copy
Alias for ranges::copy. Copies a range of elements to a new location.
Definition: ranges:200
::ranges::size size
Alias for ranges::size. Obtains the size of a range whose size can be calculated in constant time...
Definition: ranges:195
The generic alphabet concept that covers most data types used in ranges.This is the core alphabet con...
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
bool store(filesystem::path const &path) const
Stores the index to disk. Temporary function until cereal is supported.
Definition: fm_index.hpp:356
The SeqAn FM Index Iterator.
Definition: fm_index_iterator.hpp:91
fm_index(text_t const &text)
Constructor that immediately constructs the index given a range. The range cannot be an rvalue (i...
Definition: fm_index.hpp:197
Provides seqan3::view::to_rank.
The default FM Index Configuration.
Definition: fm_index.hpp:87
Adaptations of concepts from the Ranges TS.
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
size_type size() const noexcept
Returns the length of the indexed text including sentinel characters.
Definition: fm_index.hpp:269
Provides the seqan3::fm_index_iterator for searching in the unidirectional seqan3::fm_index.
sdsl::csa_wt< sdsl::wt_blcd< sdsl::bit_vector, sdsl::rank_support_v<>, sdsl::select_support_scan<>, sdsl::select_support_scan< 0 > >, 16, 10000000, sdsl::sa_order_sa_sampling<>, sdsl::isa_sampling<>, sdsl::plain_byte_alphabet > sdsl_index_type
Type of the underlying SDSL index.
Definition: fm_index.hpp:102
This header includes C++17 filesystem support and imports it into namespace seqan3::filesystem (indep...
Byte alphabet that does no mapping of char_type to comp_char_type and vice versa. ...
Definition: csa_alphabet_strategy.hpp:62
bool empty() const noexcept
Checks whether the index is empty.
Definition: fm_index.hpp:285
The SeqAn Bidirectional FM Index Iterator.
Definition: bi_fm_index_iterator.hpp:83
Provides various metafunctions used by the range module.
constexpr auto reverse
A range adaptor that presents the underlying range in reverse order.
Definition: reverse.hpp:93
text_t text_type
The type of the indexed text.
Definition: fm_index.hpp:160
auto const to_rank
A view that calls seqan3::to_rank() on each element in the input range.
Definition: to_rank.hpp:90
The SeqAn FM Index.
Definition: fm_index.hpp:134