SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
FM Index

Provides seqan3:fm_index and seqan3:bi_fm_index as well as respective cursors. More...

+ Collaboration diagram for FM Index:

Classes

class  seqan3::bi_fm_index< alphabet_t, text_layout_mode_, sdsl_index_type_ >
 The SeqAn Bidirectional FM Index. More...
 
class  seqan3::bi_fm_index_cursor< index_t >
 The SeqAn Bidirectional FM Index Cursor. More...
 
interface  seqan3::bi_fm_index_cursor_specialisation
 Concept for bidirectional FM index cursors. More...
 
interface  seqan3::bi_fm_index_specialisation
 Concept for bidirectional FM indices. More...
 
class  seqan3::fm_index< alphabet_t, text_layout_mode_, sdsl_index_type_ >
 The SeqAn FM Index. More...
 
class  seqan3::fm_index_cursor< index_t >
 The SeqAn FM Index Cursor. More...
 
interface  seqan3::fm_index_cursor_specialisation
 Concept for unidirectional FM index cursors. More...
 
interface  seqan3::fm_index_specialisation
 Concept for unidirectional FM indices. More...
 

Typedefs

using seqan3::default_sdsl_index_type = sdsl_wt_index_type
 The default FM Index Configuration. More...
 
using seqan3::sdsl_wt_index_type = 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 >
 The FM Index Configuration using a Wavelet Tree. More...
 

Enumerations

enum  seqan3::text_layout : bool { seqan3::single, seqan3::collection }
 The possible text layouts (single, collection) the seqan3::fm_index and seqan3::bi_fm_index can support. More...
 

Template argument type deduction guides

template<std::ranges::range text_t>
 seqan3::bi_fm_index (text_t &&) -> bi_fm_index< innermost_value_type_t< text_t >, text_layout
 Deduces the dimensions of the text.
 
template<std::ranges::range text_t>
 seqan3::fm_index (text_t &&) -> fm_index< innermost_value_type_t< text_t >, text_layout
 Deduces the alphabet and dimensions of the text.
 

Requirements for seqan3::fm_index_specialisation

You can expect these member types and member functions on all types that satisfy seqan3::fm_index_specialisation.

typename t::text_type text_type
 Type of the indexed text.
 
typename t::alphabet_type alphabet_type
 Type of the underlying character of text_type.
 
typename t::size_type size_type
 Type for representing the size of the indexed text.
 
typename t::cursor_type cursor_type
 Type of the unidirectional FM index cursor.
 

Requirements for seqan3::fm_index_cursor_specialisation

You can expect these member types and member functions on all types that satisfy seqan3::fm_index_cursor_specialisation.

typename t::index_type index_type
 Type of the underlying SeqAn FM index (not the underlying SDSL index).
 
typename t::size_type size_type
 Type for representing the size of the indexed text.
 

Requirements for seqan3::bi_fm_index_specialisation

You can expect these member types and member functions on all types that satisfy seqan3::bi_fm_index_specialisation.

typename t::cursor_type cursor_type
 Type of the bidirectional FM index cursor.
 
typename t::fwd_cursor_type fwd_cursor_type
 Type of the unidirectional FM index cursor based on the unidirectional FM index on the original text.
 
typename t::rev_cursor_type rev_cursor_type
 Type of the unidirectional FM index cursor based on the unidirectional FM index on the reversed text.
 

Requirements for seqan3::bi_fm_index_cursor_specialisation

You can expect these member types and member functions on all types that satisfy seqan3::fm_index_cursor_specialisation.

typename t::index_type index_type
 Type of the underlying SeqAn FM index (not the underlying SDSL index).
 
typename t::size_type size_type
 Type for representing the size of the indexed text.
 

Detailed Description

Provides seqan3:fm_index and seqan3:bi_fm_index as well as respective cursors.

FM Indices

FM indices are text indices similar to suffix trees or suffix arrays which are based on the Burrow Wheeler transform and a sampled suffix array. FM indices are significantly smaller in space without sacrificing speed. They also allow for adjusting the speed respectively space by choosing the underlying data structures accordingly or modyfing the sampling rate of the sampled suffix array.

The FM indices are based on the SDSL 3 (succinct data structure library). You are able to specify the underlying implementation of the SDSL to adjust it to your needs as well as choose one of the preconfigured indices that are suitable for common applications in sequence analysis.

For technical reasons you can currently only build indices over a seqan3::alphabet if its seqan3::alphabet_size is smaller or equal 256.

You can choose between unidirectional and bidirectional FM indices (which can be thought of suffix trees and affix trees, i.e. a combination of suffix and prefix trees being able to search a pattern from left to right, right to left and character by character in any arbitrary order). Roughly speaking bidirectional FM indices are more powerful for approximate string matching at the cost of a higher space consumption (between a factor of 5 and 9 of the input size depending on the configuration).

FM Index Cursors

Index Cursors are lightweight objects, i.e. they are cheap to copy.

Note that although the SeqAn index cursor, although having similar behaviour, don't model any of the standard library iterator concepts, not even std::input_or_output_iterator.

Typedef Documentation

◆ default_sdsl_index_type

The default FM Index Configuration.

Attention
The default might be changed in a future release. If you rely on a stable API and on-disk-format, please hard-code your sdsl_index_type to a concrete type.

◆ sdsl_wt_index_type

using seqan3::sdsl_wt_index_type = typedef 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>

The FM Index Configuration using a Wavelet Tree.

Running time / Space consumption

$SAMPLING\_RATE = 16$ $\Sigma$: alphabet_size<alphabet_type> where alphabet_type is the seqan3 alphabet type (e.g. seqan3::dna4 has an alphabet size of 4).

For an index over a text collection a delimiter is added in between the texts. This causes sigma to increase by 1.

Attention
For any alphabet, the symbol with rank 255 is not allowed to occur in the text. Additionally, rank 254 cannot occur when indexing text collections.

$T_{BACKWARD\_SEARCH}: O(\log \Sigma)$

Enumeration Type Documentation

◆ text_layout

enum seqan3::text_layout : bool

The possible text layouts (single, collection) the seqan3::fm_index and seqan3::bi_fm_index can support.

Enumerator
single 

The text is a single range.

collection 

The text is a range of ranges.