SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t > Class Template Reference

The algorithm that performs a unidirectional search on an FM index using trivial backtracking. More...

#include <seqan3/search/detail/unidirectional_search_algorithm.hpp>

+ Inheritance diagram for seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t >:

Public Member Functions

template<typename indexed_query_t , typename callback_t >
requires (std::tuple_size_v<indexed_query_t> == 2) && std::ranges::forward_range<std::tuple_element_t<1, indexed_query_t>> && std::invocable<callback_t, search_result_type>
void operator() (indexed_query_t &&indexed_query, callback_t &&callback)
 Searches a query sequence in an FM index using trivial backtracking.
 
Constructors, destructor and assignment
 unidirectional_search_algorithm ()=default
 Defaulted.
 
 unidirectional_search_algorithm (unidirectional_search_algorithm const &)=default
 Defaulted.
 
 unidirectional_search_algorithm (unidirectional_search_algorithm &&)=default
 Defaulted.
 
unidirectional_search_algorithmoperator= (unidirectional_search_algorithm const &)=default
 Defaulted.
 
unidirectional_search_algorithmoperator= (unidirectional_search_algorithm &&)=default
 Defaulted.
 
 ~unidirectional_search_algorithm ()=default
 Defaulted.
 
 unidirectional_search_algorithm (configuration_t const &cfg, index_t const &index)
 Constructs from a configuration object and an index.
 

Private Types

using search_result_type = typename traits_t::search_result_type
 The search result type.
 
using traits_t = search_traits< configuration_t >
 The search configuration traits.
 

Private Member Functions

template<typename query_t >
void perform_search_by_hit_strategy (std::vector< typename index_t::cursor_type > &internal_hits, query_t &query, search_param error_state)
 Calls search_trivial depending on the search strategy (hit configuration) given in the configuration.
 
template<bool abort_on_hit, typename query_t >
bool search_trivial (typename index_t::cursor_type cur, query_t &query, typename index_t::cursor_type::size_type const query_pos, search_param const error_left, error_type const prev_error)
 Searches a query sequence in an index using trivial backtracking.
 

Private Attributes

std::function< void(typename index_t::cursor_type const &)> delegate
 A function object that stores the on-hit-delegate to be executed whenever a hit in the index is found.
 
index_t const * index_ptr {nullptr}
 A pointer to the fm index which is used to perform the unidirectional search.
 
uint8_t stratum {}
 The stratum value if set.
 

Detailed Description

template<typename configuration_t, typename index_t, typename... policies_t>
class seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t >

The algorithm that performs a unidirectional search on an FM index using trivial backtracking.

Template Parameters
configuration_tThe search configuration type.
index_tThe type of index.

Constructor & Destructor Documentation

◆ unidirectional_search_algorithm()

template<typename configuration_t , typename index_t , typename... policies_t>
seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t >::unidirectional_search_algorithm ( configuration_t const &  cfg,
index_t const &  index 
)
inline

Constructs from a configuration object and an index.

Template Parameters
configuration_tThe search configuration type.
index_tThe type of index.
Parameters
[in]cfgThe configuration object that guides the search algorithm.
[in]indexThe index used in the algorithm.

Initialises the stratum value from the configuration if it was set by the user.

Member Function Documentation

◆ operator()()

template<typename configuration_t , typename index_t , typename... policies_t>
template<typename indexed_query_t , typename callback_t >
requires (std::tuple_size_v<indexed_query_t> == 2) && std::ranges::forward_range<std::tuple_element_t<1, indexed_query_t>> && std::invocable<callback_t, search_result_type>
void seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t >::operator() ( indexed_query_t &&  indexed_query,
callback_t &&  callback 
)
inline

Searches a query sequence in an FM index using trivial backtracking.

Template Parameters
indexed_query_tThe type of the indexed query sequence; must model seqan3::tuple_like with exactly two elements and the second tuple element must model std::ranges::forward_range over the index's alphabet.
callback_tThe callback type to be invoked on a search result; must model std::invocable with the search result.
Parameters
[in]indexed_queryThe indexed query sequence to be searched in the index.
[in]callbackThe callback to call on a search result.

The indexed_query parameter is a pair of an index and a query which shall be searched in the index. The search result can then be identified by the index that was associated with the given query.

Complexity

\(O(|query|^e)\) where \(e\) is the maximum number of errors.

◆ perform_search_by_hit_strategy()

template<typename configuration_t , typename index_t , typename... policies_t>
template<typename query_t >
void seqan3::detail::unidirectional_search_algorithm< configuration_t, index_t, policies_t >::perform_search_by_hit_strategy ( std::vector< typename index_t::cursor_type > &  internal_hits,
query_t &  query,
search_param  error_state 
)
inlineprivate

Calls search_trivial depending on the search strategy (hit configuration) given in the configuration.

Template Parameters
query_tMust model std::ranges::input_range over the index's alphabet.
Parameters
[in,out]internal_hitsThe result vector to be filled.
[in]queryQuery sequence to be searched with the cursor.
[in]error_stateNumber of errors for matching the query sequence.

The documentation for this class was generated from the following file:
Hide me