SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
trace_directions.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
14
15namespace seqan3::detail
16{
17
25enum struct trace_directions : uint8_t
26{
28 none = 0b00000,
30 diagonal = 0b00001,
32 up_open = 0b00110,
34 up = 0b00100,
36 left_open = 0b11000,
38 left = 0b10000,
40 carry_up_open = 0b00010,
42 carry_left_open = 0b01000
43};
44
45} // namespace seqan3::detail
46
47namespace seqan3
48{
53template <>
54inline constexpr bool add_enum_bitwise_operators<seqan3::detail::trace_directions> = true;
56
75template <typename char_t>
77{
78 static char const * unicode[32]{"↺", "↖", "↑", "↖↑", "⇡", "↖⇡", "↑⇡", "↖↑⇡", "←", "↖←", "↑←",
79 "↖↑←", "⇡←", "↖⇡←", "↑⇡←", "↖↑⇡←", "⇠", "↖⇠", "↑⇠", "↖↑⇠", "⇡⇠", "↖⇡⇠",
80 "↑⇡⇠", "↖↑⇡⇠", "←⇠", "↖←⇠", "↑←⇠", "↖↑←⇠", "⇡←⇠", "↖⇡←⇠", "↑⇡←⇠", "↖↑⇡←⇠"};
81
82 static char const * csv[32]{"N", "D", "U", "DU", "u", "Du", "Uu", "DUu", "L", "DL", "UL",
83 "DUL", "uL", "DuL", "UuL", "DUuL", "l", "Dl", "Ul", "DUl", "ul", "Dul",
84 "Uul", "DUul", "Ll", "DLl", "ULl", "DULl", "uLl", "DuLl", "UuLl", "DUuLl"};
85
86 bool is_unicode = (s.flags2() & fmtflags2::utf8) == fmtflags2::utf8;
87 auto const & trace_dir = is_unicode ? unicode : csv;
88
89 s << trace_dir[static_cast<size_t>(trace)];
90 return s;
91}
92
93} // namespace seqan3
Provides seqan3::add_enum_bitwise_operators.
A "pretty printer" for most SeqAn data structures and related types.
Definition debug_stream_type.hpp:75
fmtflags2 flags2() const
Retrieve the format flags from the stream.
Definition debug_stream_type.hpp:203
Provides seqan3::debug_stream and related types.
debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &stream, alignment_t &&alignment)
Stream operator for alignments, which are represented as tuples of aligned sequences.
Definition debug_stream_alignment.hpp:107
trace_directions
The possible directions a trace can have. The values can be combined by the logical |-operator.
Definition trace_directions.hpp:26
@ none
The corresponding alignment coordinate will not be incrementable/decrementable.
@ carry_left_open
Carry bit for the last left open even if it is not the maximum value.
@ up
Trace comes from the above entry.
@ left
Trace comes from the left entry.
@ diagonal
Trace comes from the diagonal entry.
@ carry_up_open
Carry bit for the last up open even if it is not the maximum value.
@ left_open
Trace comes from the left entry, while opening the gap.
@ up_open
Trace comes from the above entry, while opening the gap.
@ utf8
Enables use of non-ASCII UTF8 characters in formatted output.
Definition debug_stream_type.hpp:30
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Hide me