A debug matrix to wrap alignment matrices and sequences and make them printable together.
More...
|
const_reference | at (matrix_coordinate const &coordinate) const noexcept |
| A reference to the entry of the matrix at the given coordinate.
|
|
size_t | auto_column_width (fmtflags2 const flags) const noexcept |
| Determines the largest width of all entries in the matrix, e.g. -152 has width 4.
|
|
size_t | cols () const noexcept |
| The number of columns in the matrix.
|
|
first_sequence_t const & | first_sequence () const noexcept |
| The first sequence of the sequence alignment.
|
|
debug_matrix & | mask_matrix (row_wise_matrix< bool > masking_matrix) noexcept |
| Masks entries out of the current matrix. This operations changes the way this.at(i, j) will operate. If masking_matrix.at(i,j) returns true this.at(i, j) will operate as usual. But, if false this.at(i, j) will return std::nullopt.
|
|
debug_matrix & | mask_matrix (std::vector< bool > masking_vector) noexcept |
| Creates the masking_matrix out of the given masking_vector and calls mask_matrix(row_wise_matrix<bool>)
|
|
size_t | rows () const noexcept |
| The number of rows in the matrix.
|
|
second_sequence_t const & | second_sequence () const noexcept |
| The second sequence of the sequence alignment.
|
|
template<typename ostream_t > |
void | stream_matrix (ostream_t &cout, fmtflags2 const flags) const noexcept |
| Prints this matrix into the given stream.
|
|
debug_matrix & | sub_matrix (size_t const new_rows, size_t const new_cols) noexcept |
| Limits the view port of the current matrix.
|
|
debug_matrix & | transpose_matrix () noexcept |
| Transposes the current matrix.
|
|
|
| debug_matrix ()=default |
| Defaulted.
|
|
| debug_matrix (debug_matrix const &)=default |
| Defaulted.
|
|
| debug_matrix (debug_matrix &&)=default |
| Defaulted.
|
|
debug_matrix & | operator= (debug_matrix const &)=default |
| Defaulted.
|
|
debug_matrix & | operator= (debug_matrix &&)=default |
| Defaulted.
|
|
| ~debug_matrix ()=default |
| Defaulted.
|
|
| debug_matrix (matrix_t matrix) |
| Construct the matrix out of an existing matrix.
|
|
| debug_matrix (matrix_t matrix, first_sequence_t first_sequence, second_sequence_t second_sequence) |
| Construct the matrix out of an existing matrix and two sequences.
|
|
|
static constexpr format_type | csv {" ", ";", "", "", ""} |
| The format when printing to a ascii stream.
|
|
static constexpr bool | has_first_sequence = !std::is_same_v<std::decay_t<first_sequence_t>, std::nullopt_t> |
| Whether the current debug_matrix was given a first_sequence.
|
|
static constexpr bool | has_second_sequence = !std::is_same_v<std::decay_t<second_sequence_t>, std::nullopt_t> |
| Whether the current debug_matrix was given a second_sequence.
|
|
static constexpr bool | is_optional_score = is_type_specialisation_of_v<entry_t, std::optional> |
| Whether a score matrix already returns std::optional scores. (Where std::nullopt means unset/invalid/infinite score)
|
|
static constexpr bool | is_traceback_matrix = std::is_same_v<std::decay_t<entry_t>, trace_directions> |
| Whether the value_type is trace_directions.
|
|
static constexpr format_type | unicode {"ε", "║", "═", "╬", "∞"} |
| The format when printing to a unicode stream.
|
|
|
(Note that these are not member symbols.)
|
|
template<matrix matrix_t> |
| debug_matrix (matrix_t &&) -> debug_matrix< matrix_t > |
| The type deduction guide for the constructor seqan3::detail::debug_matrix(matrix_t)
|
|
template<matrix matrix_t, typename first_sequence_t , typename second_sequence_t > |
| debug_matrix (matrix_t &&, first_sequence_t &&, second_sequence_t &&) -> debug_matrix< matrix_t, first_sequence_t, second_sequence_t > |
| The type deduction guide for the constructor seqan3::detail::debug_matrix(matrix_t, first_sequence_t, second_sequence_t)
|
|
typedef IMPLEMENTATION_DEFINED | value_type |
| The type of an entry in the matrix.
|
|
typedef IMPLEMENTATION_DEFINED | reference |
| The type of a reference to an entry in the matrix.
|
|
typedef IMPLEMENTATION_DEFINED | size_type |
| The size type of the matrix.
|
|
reference | at (matrix_coordinate coordinate) noexcept |
| A reference to the entry of the matrix at the given coordinate.
|
|
template<matrix matrix1_t, matrix matrix2_t> |
bool | operator== (matrix1_t const &lhs, matrix2_t const &rhs) noexcept |
| Whether two alignment matrices are equal.
|
|
template<matrix matrix1_t, matrix matrix2_t> |
bool | operator!= (matrix1_t const &lhs, matrix2_t const &rhs) noexcept |
| Whether two alignment matrices are equal.
|
|
template<
matrix matrix_t, typename first_sequence_t = std::nullopt_t, typename second_sequence_t = std::nullopt_t>
class seqan3::detail::debug_matrix< matrix_t, first_sequence_t, second_sequence_t >
A debug matrix to wrap alignment matrices and sequences and make them printable together.
- Template Parameters
-
matrix_t | An alignment matrix; Must model seqan3::detail::matrix. |
first_sequence_t | The type of the first sequence; If no sequences are given this is std::nullopt_t. |
second_sequence_t | The type of the second sequence; If no sequences are given this is std::nullopt_t. |
This debug matrix allows you to print an alignment matrix (e.g. score or trace matrix) combined with two sequences.
This type is used internally
Score matrix example
int main()
{
std::vector{-0, -1, -2, -3, -4, -5, -6, -7, -8, -1, -0, -1, -2, -3, -4, -5, -6, -7, -2, -1, -1, -1, -2,
-3, -4, -5, -6, -3, -2, -2, -2, -2, -2, -3, -4, -5, -4, -3, -3, -3, -3, -3, -3, -3, -4}};
seqan3::debug_stream <<
"score_matrix: " << score_matrix.cols() <<
" columns and " << score_matrix.rows()
<< " rows\n";
return 0;
}
A debug matrix to wrap alignment matrices and sequences and make them printable together.
Definition debug_matrix.hpp:59
debug_matrix()=default
Defaulted.
A two dimensional matrix used inside of alignment algorithms.
Definition two_dimensional_matrix.hpp:62
Provides the declaration of seqan3::detail::debug_matrix.
Provides seqan3::debug_stream and related types.
Provides seqan3::dna4, container aliases and string literals.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:37
@ utf8
Enables use of non-ASCII UTF8 characters in formatted output.
Definition debug_stream_type.hpp:30
The SeqAn namespace for literals.
Strong type for setting the column dimension of a matrix.
Definition two_dimensional_matrix.hpp:29
Strong type for setting the row dimension of a matrix.
Definition two_dimensional_matrix.hpp:37
Output
database: AACCGGTT
query: ACGT
score_matrix: 9 columns and 5 rows
; ; ; ; ; ; ; ; ; ;
;0 ;-1;-2;-3;-4;-5;-6;-7;-8;
;-1;0 ;-1;-2;-3;-4;-5;-6;-7;
;-2;-1;-1;-1;-2;-3;-4;-5;-6;
;-3;-2;-2;-2;-2;-2;-3;-4;-5;
;-4;-3;-3;-3;-3;-3;-3;-3;-4;
; ;A ;A ;C ;C ;G ;G ;T ;T ;
;0 ;-1;-2;-3;-4;-5;-6;-7;-8;
A;-1;0 ;-1;-2;-3;-4;-5;-6;-7;
C;-2;-1;-1;-1;-2;-3;-4;-5;-6;
G;-3;-2;-2;-2;-2;-2;-3;-4;-5;
T;-4;-3;-3;-3;-3;-3;-3;-3;-4;
║ε ║A ║A ║C ║C ║G ║G ║T ║T ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
ε║0 ║-1║-2║-3║-4║-5║-6║-7║-8║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
A║-1║0 ║-1║-2║-3║-4║-5║-6║-7║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
C║-2║-1║-1║-1║-2║-3║-4║-5║-6║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
G║-3║-2║-2║-2║-2║-2║-3║-4║-5║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
T║-4║-3║-3║-3║-3║-3║-3║-3║-4║
Trace matrix example
int main()
{
using seqan3::operator|;
std::vector{N, L, L, L, L, L, L, L, L, U, D, D | L, L, L, L,
L, L, L, U, U, D, D, D | L, L, L, L, L, U, U, D | U,
D | U, D, D, D | L, L, L, U, U, D | U, D | U, D | U, D | U, D, D, D | L}};
seqan3::debug_stream <<
"trace_matrix: " << trace_matrix.cols() <<
" columns and " << trace_matrix.rows()
<< " rows\n";
return 0;
}
@ up
Trace comes from the above entry.
@ left
Trace comes from the left entry.
@ diagonal
Trace comes from the diagonal entry.
Provides seqan3::views::to_char.
Output
database: AACCGGTT
query: ACGT
trace_matrix: 9 columns and 5 rows
; ; ; ; ; ; ; ; ; ;
;N ;l ;l ;l ;l ;l ;l ;l ;l ;
;u ;D ;Dl;l ;l ;l ;l ;l ;l ;
;u ;u ;D ;D ;Dl;l ;l ;l ;l ;
;u ;u ;Du;Du;D ;D ;Dl;l ;l ;
;u ;u ;Du;Du;Du;Du;D ;D ;Dl;
; ;A ;A ;C ;C ;G ;G ;T ;T ;
;N ;l ;l ;l ;l ;l ;l ;l ;l ;
A;u ;D ;Dl;l ;l ;l ;l ;l ;l ;
C;u ;u ;D ;D ;Dl;l ;l ;l ;l ;
G;u ;u ;Du;Du;D ;D ;Dl;l ;l ;
T;u ;u ;Du;Du;Du;Du;D ;D ;Dl;
║ε ║A ║A ║C ║C ║G ║G ║T ║T ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
ε║↺ ║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
A║⇡ ║↖ ║↖⇠║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║⇠ ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
C║⇡ ║⇡ ║↖ ║↖ ║↖⇠║⇠ ║⇠ ║⇠ ║⇠ ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
G║⇡ ║⇡ ║↖⇡║↖⇡║↖ ║↖ ║↖⇠║⇠ ║⇠ ║
╬══╬══╬══╬══╬══╬══╬══╬══╬══╬
T║⇡ ║⇡ ║↖⇡║↖⇡║↖⇡║↖⇡║↖ ║↖ ║↖⇠║