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

Score matrix for the pairwise alignment using only a single column. More...

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

+ Inheritance diagram for seqan3::detail::score_matrix_single_column< score_t >:

Classes

class  matrix_iterator
 Score matrix iterator for the pairwise alignment using only a single column. More...
 

Public Member Functions

template<std::integral column_index_t, std::integral row_index_t>
void resize (column_index_type< column_index_t > const number_of_columns, row_index_type< row_index_t > const number_of_rows, score_t const initial_value=score_t{})
 Resizes the matrix.
 
Constructors, destructor and assignment
 score_matrix_single_column ()=default
 Defaulted.
 
 score_matrix_single_column (score_matrix_single_column const &)=default
 Defaulted.
 
 score_matrix_single_column (score_matrix_single_column &&)=default
 Defaulted.
 
score_matrix_single_columnoperator= (score_matrix_single_column const &)=default
 Defaulted.
 
score_matrix_single_columnoperator= (score_matrix_single_column &&)=default
 Defaulted.
 
 ~score_matrix_single_column ()=default
 Defaulted.
 
Iterators
matrix_iterator begin ()
 Returns the iterator pointing to the first column.
 
matrix_iterator begin () const =delete
 This score matrix is not const-iterable.
 
matrix_iterator end ()
 Returns the iterator pointing behind the last column.
 
matrix_iterator end () const =delete
 This score matrix is not const-iterable.
 

Private Types

using physical_column_t = std::vector< score_t, aligned_allocator< score_t, alignof(score_t)> >
 The type of the score column which allocates memory for the entire column.
 
using virtual_column_t = decltype(views::repeat_n(score_t{}, 1))
 The type of the virtual score column which only stores one value.
 

Private Attributes

physical_column_t horizontal_column {}
 The column over the horizontal gap scores.
 
size_t number_of_columns {}
 The number of columns for this matrix.
 
physical_column_t optimal_column {}
 The column over the optimal scores.
 
virtual_column_t vertical_column {}
 The virtual column over the vertical gap scores.
 

Detailed Description

template<typename score_t>
requires (arithmetic<score_t> || simd_concept<score_t>)
class seqan3::detail::score_matrix_single_column< score_t >

Score matrix for the pairwise alignment using only a single column.

Template Parameters
score_tThe type of the score; must model seqan3::arithmetic or seqan3::simd::simd_concept.

In many cases it is sufficient to store only a single score column to compute the alignment between two sequences. Since the alignment is computed iteratively column by column, the same memory can be reused for the next score. This score matrix stores the complete column for both the optimal and horizontal score, but only stores a single value for the vertical column. Hence, this matrix can only be used for a column based computation layout.

Range interface

The matrix offers a input range interface over the columns of the matrix. Dereferencing the iterator will return another range which represents the actual score column in memory. The returned range is a transformed seqan3::views::zip view over the optimal, horizontal and vertical column. The reference type of this view is the seqan3::detail::affine_cell_proxy, which offers a practical interface to access the value of the optimal, horizontal and vertical value of the underlying matrices.

Member Function Documentation

◆ resize()

template<typename score_t >
template<std::integral column_index_t, std::integral row_index_t>
void seqan3::detail::score_matrix_single_column< score_t >::resize ( column_index_type< column_index_t > const  number_of_columns,
row_index_type< row_index_t > const  number_of_rows,
score_t const  initial_value = score_t{} 
)
inline

Resizes the matrix.

Template Parameters
column_index_tThe column index type; must model std::integral.
row_index_tThe row index type; must model std::integral.
Parameters
[in]number_of_columnsThe number of columns for this matrix.
[in]number_of_rowsThe number of rows for this matrix.
[in]initial_valueOptional initial score value to use when resizing the underlying container.

Resizes the optimal and the horizontal score column to the given number of rows and stores the number of columns to created a counted iterator over the matrix columns. Note the alignment matrix requires the number of columns and rows to be one bigger than the size of sequence1, respectively sequence2. Reallocation happens only if the new column size exceeds the current capacity of the optimal and horizontal score column. The underlying vectors are initialised with the given initial_value or the default value of the class's score type.

Complexity

Linear in the number of rows.

Exception

Basic exception guarantee. Might throw std::bad_alloc on resizing the internal columns.


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