53 template <
typename ...>
54 class alignment_trace_matrix;
73 class alignment_trace_matrix<std::vector<trace_directions>>
74 :
public row_wise_matrix<trace_directions>
77 using row_wise_matrix<trace_directions>::row_wise_matrix;
101 template <
typename database_type,
typename query_type,
typename align_config_type,
typename ...score_matrix_params_t>
103 requires matrix_concept<alignment_score_matrix<score_matrix_params_t...>> &&
104 std::Integral<
typename alignment_score_matrix<score_matrix_params_t...>::entry_type>
106 class alignment_trace_matrix<database_type, query_type, align_config_type, alignment_score_matrix<score_matrix_params_t...>>
107 :
public alignment_score_matrix<score_matrix_params_t...>
111 using score_matrix_type = alignment_score_matrix<score_matrix_params_t...>;
114 using score_type =
typename score_matrix_type::entry_type;
117 using entry_type = trace_directions;
124 alignment_trace_matrix() =
default;
125 alignment_trace_matrix(alignment_trace_matrix
const &) =
default;
126 alignment_trace_matrix(alignment_trace_matrix &&) =
default;
127 alignment_trace_matrix & operator=(alignment_trace_matrix
const &) =
default;
128 alignment_trace_matrix & operator=(alignment_trace_matrix &&) =
default;
136 alignment_trace_matrix(database_type database, query_type query, align_config_type config, score_matrix_type score_matrix)
137 : score_matrix_type(
std::move(score_matrix)),
138 _database{std::forward<database_type>(database)},
139 _query{std::forward<query_type>(query)},
140 _config{std::forward<align_config_type>(config)}
145 using score_matrix_type::rows;
147 using score_matrix_type::cols;
150 entry_type at(
size_t const row,
size_t const col)
const noexcept
152 entry_type direction{};
154 if (is_trace_diagonal(row, col))
155 direction |= entry_type::diagonal;
157 if (is_trace_up(row, col))
158 direction |= entry_type::up;
160 if (is_trace_left(row, col))
161 direction |= entry_type::left;
167 score_matrix_type
const & score_matrix() const noexcept
175 bool is_trace_up(
size_t const row,
size_t const col)
const noexcept
180 score_type curr = score_matrix().at(row, col);
181 score_type up = row == 0 ? col : score_matrix().at(row - 1, col);
182 return curr == up + gap;
186 bool is_trace_left(
size_t const row,
size_t const col)
const noexcept
191 score_type curr = score_matrix().at(row, col);
192 score_type left = col == 0 ? row : score_matrix().at(row, col - 1);
193 return curr == left + gap;
197 bool is_trace_diagonal(
size_t const row,
size_t const col)
const noexcept
200 score_type match = 0;
201 score_type mismatch = 1;
203 score_type curr = score_matrix().at(row, col);
204 if (col == 0 || row == 0)
207 score_type diag = score_matrix().at(row - 1, col - 1);
208 bool is_match = _query[row - 1] == _database[col - 1];
210 return (is_match && curr == diag + match) ||
211 (!is_match && curr == diag + mismatch);
215 database_type _database;
219 align_config_type _config;
226 alignment_trace_matrix(std::vector<trace_directions>,
size_t rows,
size_t cols)
227 -> alignment_trace_matrix<std::vector<trace_directions>>;
229 template <
typename database_t,
typename query_t,
typename align_config_t,
typename alignment_t,
typename ...options_t>
230 alignment_trace_matrix(database_t && database, query_t && query, align_config_t && config, alignment_score_matrix<alignment_t, options_t...>)
231 -> alignment_trace_matrix<database_t, query_t, align_config_t, alignment_score_matrix<alignment_t, options_t...>>;
Contains the declaration of seqan3::detail::alignment_score_matrix.
constexpr detail::align_config_gap_adaptor< seqan3::detail::align_config_gap > gap
A configuration adaptor for gaps.
Definition: align_config_gap.hpp:162
SeqAn specific customisations in the standard namespace.
Definition: align_result.hpp:221
The concept Integral is satisfied if and only if T is an integral type.
Contains the declaration of seqan3::detail::trace_directions.
Definition: aligned_sequence_concept.hpp:288
Contains seqan3::detail::matrix_concept.