17#include <seqan3/contrib/sdsl-lite.hpp>
44 template <semialphabet alphabet_t, text_layout text_layout_mode_, std::ranges::range text_t>
49 static_assert(std::ranges::bidirectional_range<text_t>,
"The text must model bidirectional_range.");
50 static_assert(std::convertible_to<range_innermost_value_t<text_t>, alphabet_t>,
51 "The alphabet of the text collection must be convertible to the alphabet of the index.");
54 if (std::ranges::empty(
text))
59 static_assert(std::ranges::bidirectional_range<text_t>,
60 "The text collection must model bidirectional_range.");
61 static_assert(std::ranges::bidirectional_range<std::ranges::range_reference_t<text_t>>,
62 "The elements of the text collection must model bidirectional_range.");
63 static_assert(std::convertible_to<range_innermost_value_t<text_t>, alphabet_t>,
64 "The alphabet of the text collection must be convertible to the alphabet of the index.");
67 if (std::ranges::empty(
text))
80template <
typename index_t>
83template <
typename index_t>
84class bi_fm_index_cursor;
88template <semialphabet alphabet_t, text_layout text_layout_mode_, detail::sdsl_index sdsl_index_type_>
89class reverse_fm_index;
126 seqan3::contrib::sdsl::wt_blcd<seqan3::contrib::sdsl::bit_vector,
127 seqan3::contrib::sdsl::rank_support_v<>,
128 seqan3::contrib::sdsl::select_support_scan<>,
129 seqan3::contrib::sdsl::select_support_scan<0>>,
132 seqan3::contrib::sdsl::sa_order_sa_sampling<>,
133 seqan3::contrib::sdsl::isa_sampling<>,
134 seqan3::contrib::sdsl::plain_byte_alphabet>;
213 template <
typename output_it_t,
typename sequence_t>
223 "character alphabets the last one/two values are reserved"
224 "(single sequence/collection).");
260 template <std::ranges::range text_t>
264 detail::fm_index_validator::validate<alphabet_t, text_layout_mode_>(
text);
271 seqan3::contrib::sdsl::int_vector<8>
tmp_text(std::ranges::distance(
text));
285 template <std::ranges::range text_t>
289 detail::fm_index_validator::validate<alphabet_t, text_layout_mode_>(
text);
293 for (
auto && t :
text)
325 constexpr uint8_t
delimiter = sigma >= 255 ? 255 : sigma + 1;
391 template <
typename bi_fm_index_t>
394 template <
typename fm_index_t>
397 template <
typename fm_index_t>
451 template <std::ranges::b
idirectional_range text_t>
520 return !(*
this ==
rhs);
549 template <cereal_archive archive_t>
564 +
" but it is being read into an fm_index with an alphabet of size "
573 + (
tmp ?
"text collection" :
"single text")
574 +
" but it is being read into an fm_index expecting a "
585template <std::ranges::range text_t>
613 template <std::ranges::range text_t>
632 template <std::ranges::b
idirectional_range text_t>
The SeqAn Bidirectional FM Index Cursor.
Definition bi_fm_index_cursor.hpp:51
An FM Index specialisation that handles reversing the given text.
Definition fm_index.hpp:610
void construct_(text_t &&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:614
reverse_fm_index(text_t &&text)
Constructor that immediately constructs the index given a range. The range cannot be empty.
Definition fm_index.hpp:633
The SeqAn FM Index Cursor.
Definition fm_index_cursor.hpp:83
The SeqAn FM Index.
Definition fm_index.hpp:185
sdsl_index_type_ sdsl_index_type
The type of the underlying SDSL index.
Definition fm_index.hpp:191
fm_index & operator=(fm_index rhs)
When copy/move assigning, also update internal data structures.
Definition fm_index.hpp:428
seqan3::contrib::sdsl::rank_support_sd< 1 > text_begin_rs
Rank support for text_begin.
Definition fm_index.hpp:210
fm_index()=default
Defaulted.
static constexpr text_layout text_layout_mode
Indicates whether index is built over a collection.
Definition fm_index.hpp:378
seqan3::contrib::sdsl::sd_vector text_begin
Bitvector storing begin positions for collections.
Definition fm_index.hpp:206
void construct(text_t &&text, bool reverse=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition fm_index.hpp:287
cursor_type cursor() const noexcept
Returns a seqan3::fm_index_cursor on the index that can be used for searching. Cursor is pointing to...
Definition fm_index.hpp:537
size_type size() const noexcept
Returns the length of the indexed text including sentinel characters.
Definition fm_index.hpp:469
sdsl_index_type index
Underlying index from the SDSL.
Definition fm_index.hpp:203
bool operator!=(fm_index const &rhs) const noexcept
Compares two indices.
Definition fm_index.hpp:518
typename sdsl_index_type::alphabet_type::sigma_type sdsl_sigma_type
The type of the alphabet size of the underlying SDSL index.
Definition fm_index.hpp:197
seqan3::contrib::sdsl::select_support_sd< 1 > text_begin_ss
Select support for text_begin.
Definition fm_index.hpp:208
bool empty() const noexcept
Checks whether the index is empty.
Definition fm_index.hpp:485
bool operator==(fm_index const &rhs) const noexcept
Compares two indices.
Definition fm_index.hpp:501
typename sdsl_index_type::alphabet_type::char_type sdsl_char_type
The type of the reduced alphabet type. (The reduced alphabet might be smaller than the original alpha...
Definition fm_index.hpp:195
~fm_index()=default
Defaulted.
void construct(text_t &&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:262
alphabet_t alphabet_type
The type of the underlying character of the indexed text.
Definition fm_index.hpp:384
fm_index(fm_index &&rhs)
When move constructing, also update internal data structures.
Definition fm_index.hpp:417
typename sdsl_index_type::size_type size_type
Type for representing positions in the indexed text.
Definition fm_index.hpp:386
static output_it_t copy_sequence_ranks_shifted_by_one(output_it_t output_it, sequence_t &&sequence)
Eagerly convert sequence into ranks, shift by one and copy them into output_it.
Definition fm_index.hpp:214
fm_index(text_t &&text)
Constructor that immediately constructs the index given a range. The range cannot be empty.
Definition fm_index.hpp:452
fm_index(fm_index const &rhs)
When copy constructing, also update internal data structures.
Definition fm_index.hpp:406
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view.
Definition deep.hpp:101
Provides various transformation traits used by the range module.
Provides the internal representation of a node of the seqan3::fm_index_cursor.
Provides the seqan3::fm_index_cursor for searching in the unidirectional seqan3::fm_index.
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition alphabet/concept.hpp:152
text_layout
The possible text layouts (single, collection) the seqan3::fm_index and seqan3::bi_fm_index can suppo...
Definition search/fm_index/concept.hpp:69
sdsl_wt_index_type default_sdsl_index_type
The default FM Index Configuration.
Definition fm_index.hpp:141
seqan3::contrib::sdsl::csa_wt< seqan3::contrib::sdsl::wt_blcd< seqan3::contrib::sdsl::bit_vector, seqan3::contrib::sdsl::rank_support_v<>, seqan3::contrib::sdsl::select_support_scan<>, seqan3::contrib::sdsl::select_support_scan< 0 > >, 16, 10 '000 '000, seqan3::contrib::sdsl::sa_order_sa_sampling<>, seqan3::contrib::sdsl::isa_sampling<>, seqan3::contrib::sdsl::plain_byte_alphabet > sdsl_wt_index_type
The FM Index Configuration using a Wavelet Tree.
Definition fm_index.hpp:134
@ single
The text is a single range.
Definition search/fm_index/concept.hpp:71
@ collection
The text is a range of ranges.
Definition search/fm_index/concept.hpp:73
The basis for seqan3::alphabet, but requires only rank interface (not char).
The generic concept for a (biological) sequence.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
SeqAn specific customisations in the standard namespace.
Provides the concept for seqan3::detail::sdsl_index.
Internal representation of the node of an FM index cursor.
Definition detail/fm_index_cursor.hpp:27
Class used to validate the requirements on the input text of the fm_index.
Definition fm_index.hpp:29
static void validate(text_t &&text)
Validates the fm_index template parameters and text.
Definition fm_index.hpp:45
Provides seqan3::views::to_rank.