SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only > Class Template Reference

An alignment traceback matrix storing the entire traceback matrix. More...

#include <seqan3/alignment/matrix/detail/alignment_trace_matrix_full.hpp>

+ Inheritance diagram for seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >:

Public Types

Associated types
using value_type = alignment_trace_matrix_proxy< coordinate_type, std::conditional_t< coordinate_only, detail::ignore_t const, trace_t > >
 The proxy type of an alignment matrix.
 
using reference = value_type
 Same as value type.
 
using iterator = typename range_base_t::iterator
 The type of the iterator.
 
using sentinel = typename range_base_t::sentinel
 The type of sentinel.
 
using size_type = size_t
 The size type.
 

Public Member Functions

auto trace_path (matrix_coordinate const &trace_begin)
 Returns a trace path starting from the given coordinate and ending in the cell with seqan3::detail::trace_directions::none.
 
Constructors, destructor and assignment
constexpr alignment_trace_matrix_full ()=default
 Defaulted.
 
constexpr alignment_trace_matrix_full (alignment_trace_matrix_full const &)=default
 Defaulted.
 
constexpr alignment_trace_matrix_full (alignment_trace_matrix_full &&)=default
 Defaulted.
 
constexpr alignment_trace_matrix_fulloperator= (alignment_trace_matrix_full const &)=default
 Defaulted.
 
constexpr alignment_trace_matrix_fulloperator= (alignment_trace_matrix_full &&)=default
 Defaulted.
 
 ~alignment_trace_matrix_full ()=default
 Defaulted.
 
template<std::ranges::forward_range first_sequence_t, std::ranges::forward_range second_sequence_t>
constexpr alignment_trace_matrix_full (first_sequence_t &&first, second_sequence_t &&second, trace_t const initial_value=trace_t{})
 Construction from two ranges.
 
- Public Member Functions inherited from seqan3::detail::alignment_matrix_column_major_range_base< derived_t >
constexpr iterator begin () noexcept
 Returns an iterator to the first column of the matrix.
 
constexpr iterator begin () const noexcept=delete
 Deleted begin for const-qualified alignment matrix.
 
constexpr sentinel end () noexcept
 Returns a sentinel marking the end of the matrix.
 
constexpr sentinel end () const noexcept=delete
 Deleted end for const-qualified alignment matrix.
 

Protected Types

using column_data_view_type = std::conditional_t< coordinate_only, decltype(std::views::iota(coordinate_type{}, coordinate_type{})), decltype(views::zip(std::declval< std::span< element_type > >(), std::declval< std::span< element_type > >(), std::views::iota(coordinate_type{}, coordinate_type{})))>
 The view over the current alignment-column; must model std::ranges::view and std::ranges::input_range.
 
using coordinate_type = advanceable_alignment_coordinate< advanceable_alignment_coordinate_state::row >
 The coordinate type.
 
using element_type = trace_t
 The actual element type.
 
- Protected Types inherited from seqan3::detail::alignment_trace_matrix_base< trace_t >
using allocator_type = std::conditional_t< detail::simd_concept< trace_t >, aligned_allocator< element_type, sizeof(element_type)>, std::allocator< element_type > >
 The allocator type. Uses seqan3::aligned_allocator if storing seqan3::detail::simd_concepttypes.
 
using coordinate_type = advanceable_alignment_coordinate< advanceable_alignment_coordinate_state::row >
 The coordinate type.
 
using element_type = trace_t
 The actual element type.
 
using pool_type = two_dimensional_matrix< element_type, allocator_type, matrix_major_order::column >
 The type of the underlying memory pool.
 
using size_type = size_t
 The size type.
 

Private Types

using matrix_base_t = alignment_trace_matrix_base< trace_t >
 The base class for data storage.
 
using range_base_t = alignment_matrix_column_major_range_base< alignment_trace_matrix_full< trace_t, coordinate_only > >
 The base class for iterating over the matrix.
 

Private Member Functions

constexpr alignment_column_type initialise_column (size_type const column_index) noexcept
 Returns the current alignment-column at the given column_index.
 
template<std::random_access_iterator iter_t>
constexpr value_type make_proxy (iter_t host_iter) noexcept
 Creates the proxy value returned when dereferencing the alignment-column-iterator.
 

Private Attributes

friend range_base_t
 Befriend the range base class.
 

Additional Inherited Members

- Protected Member Functions inherited from seqan3::detail::alignment_matrix_column_major_range_base< derived_t >
constexpr iterator begin () noexcept
 Returns an iterator to the first column of the matrix.
 
constexpr iterator begin () const noexcept=delete
 Deleted begin for const-qualified alignment matrix.
 
constexpr sentinel end () noexcept
 Returns a sentinel marking the end of the matrix.
 
constexpr sentinel end () const noexcept=delete
 Deleted end for const-qualified alignment matrix.
 
- Protected Attributes inherited from seqan3::detail::alignment_trace_matrix_base< trace_t >
std::vector< element_type, allocator_typecache_left {}
 Internal cache for the trace values to the left.
 
element_type cache_up {}
 Internal cache for the last trace value above.
 
pool_type data {}
 The linearised matrix storing the trace data in column-major-order.
 
size_type num_cols {}
 The number of columns.
 
size_type num_rows {}
 The number of num_rows.
 

Detailed Description

template<typename trace_t, bool coordinate_only = false>
class seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >

An alignment traceback matrix storing the entire traceback matrix.

Template Parameters
trace_tThe type of the trace directions.
coordinate_onlyA boolean flag indicating if only a seqan3::detail::advanceable_alignment_coordinate should be generated.

This implementation allocates the full traceback matrix using quadratic memory. The matrix allows access to the underlying values through a range based interface. An iterator over the traceback matrix iterates in column-major-order over the traceback matrix. Dereferencing an iterator returns a view over the current matrix column. The value type is a pair over a seqan3::detail::advanceable_alignment_coordinate and the seqan3::detail::alignment_trace_matrix_proxy, which gives a unified access to the respective matrix cells as needed by the standard alignment algorithm. The matrix is modelled as std::ranges::input_range since the alignment algorithm iterates only once over the complete matrix to calculate the values.

Only computing the coordinates

Sometimes it is desired to only get access to the alignment coordinates. This can be achieved by setting coordinate_only = true. In this case no memory will be allocated and only an internal state is maintained to generate the alignment coordinates.

Member Typedef Documentation

◆ column_data_view_type

The view over the current alignment-column; must model std::ranges::view and std::ranges::input_range.

Note
This type must be defined by the derived type.

◆ iterator

The type of the iterator.

◆ sentinel

The type of sentinel.

◆ value_type

The proxy type of an alignment matrix.

Note
This type must be defined by the derived type.

Constructor & Destructor Documentation

◆ alignment_trace_matrix_full()

template<typename trace_t , bool coordinate_only = false>
template<std::ranges::forward_range first_sequence_t, std::ranges::forward_range second_sequence_t>
constexpr seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >::alignment_trace_matrix_full ( first_sequence_t &&  first,
second_sequence_t &&  second,
trace_t const  initial_value = trace_t{} 
)
inlineconstexpr

Construction from two ranges.

Template Parameters
first_sequence_tThe first range type; must model std::ranges::forward_range.
second_sequence_tThe second range type; must model std::ranges::forward_range.
Parameters
[in]firstThe first range.
[in]secondThe second range.
[in]initial_valueThe value to initialise the matrix with. Default initialised if not specified.

Obtains the sizes of the passed ranges in order to allocate the traceback matrix. If coordinate_only is set to true, nothing will be allocated.

Member Function Documentation

◆ initialise_column()

template<typename trace_t , bool coordinate_only = false>
constexpr alignment_column_type seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >::initialise_column ( size_type const  column_index)
inlineconstexprprivatenoexcept

Returns the current alignment-column at the given column_index.

Parameters
[in]column_indexThe current column position of the outer matrix iterator.
Returns
A view representing the current alignment-column (seqan3::detail::alignment_matrix_column_major_range_base::alignment_column_type)

Creates a new seqan3::detail::alignment_matrix_column_major_range_base::alignment_column_type initialised with the current column of the alignment matrix depending on the given column_index. The alignment_column_type stores a column view as defined by the derived class using the seqan3::detail::alignment_matrix_column_major_range_base::column_data_view_type type definition.

◆ make_proxy()

template<typename trace_t , bool coordinate_only = false>
template<std::random_access_iterator iter_t>
constexpr value_type seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >::make_proxy ( iter_t  host_iter)
inlineconstexprprivatenoexcept

Creates the proxy value returned when dereferencing the alignment-column-iterator.

Parameters
[in]host_iterThe wrapped iterator to the actual memory storage.
Returns
A proxy for the current matrix position, which must be of type seqan3::detail::alignment_matrix_column_major_range_base::value_type.

◆ trace_path()

template<typename trace_t , bool coordinate_only = false>
auto seqan3::detail::alignment_trace_matrix_full< trace_t, coordinate_only >::trace_path ( matrix_coordinate const trace_begin)
inline

Returns a trace path starting from the given coordinate and ending in the cell with seqan3::detail::trace_directions::none.

Parameters
[in]trace_beginA seqan3::matrix_coordinate pointing to the begin of the trace to follow.
Returns
A std::ranges::subrange over the corresponding trace path.
Exceptions
std::invalid_argumentif the specified coordinate is out of range.

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