SeqAn3 3.4.0-rc.3
The Modern C++ library for sequence analysis.
|
The SAM tag dictionary class that stores all optional SAM fields. More...
#include <seqan3/io/sam_file/sam_tag_dictionary.hpp>
Public Types | |
using | variant_type = detail::sam_tag_variant |
The variant type defining all valid SAM tag field types. | |
Public Member Functions | |||
Getter function for the seqan3::sam_tag_dictionary. | |||
Gets the value of known SAM tags by its correct type instead of the std::variant.
See the seqan3::sam_tag_dictionary detailed documentation below for an example.
| |||
template<uint16_t tag> requires (!std::same_as<sam_tag_type_t<tag>, variant_type>) | |||
auto & | get () & | ||
Uses std::map::operator[] for access and default initializes new keys. | |||
template<uint16_t tag> requires (!std::same_as<sam_tag_type_t<tag>, variant_type>) | |||
auto && | get () && | ||
Uses std::map::operator[] for access and default initializes new keys. | |||
template<uint16_t tag> requires (!std::same_as<sam_tag_type_t<tag>, variant_type>) | |||
auto const & | get () const & | ||
Uses std::map::at() for access and throws when the key is unknown. | |||
template<uint16_t tag> requires (!std::same_as<sam_tag_type_t<tag>, variant_type>) | |||
auto const && | get () const && | ||
Uses std::map::at() for access and throws when the key is unknown. | |||
Public Member Functions inherited from std::map< uint16_t, detail::sam_tag_variant > | |||
T | at (T... args) | ||
T | begin (T... args) | ||
T | cbegin (T... args) | ||
T | cend (T... args) | ||
T | clear (T... args) | ||
T | contains (T... args) | ||
T | count (T... args) | ||
T | crbegin (T... args) | ||
T | crend (T... args) | ||
T | emplace (T... args) | ||
T | emplace_hint (T... args) | ||
T | empty (T... args) | ||
T | end (T... args) | ||
T | equal_range (T... args) | ||
T | erase (T... args) | ||
T | extract (T... args) | ||
T | find (T... args) | ||
T | get_allocator (T... args) | ||
T | insert (T... args) | ||
T | insert_or_assign (T... args) | ||
T | key_comp (T... args) | ||
T | lower_bound (T... args) | ||
T | map (T... args) | ||
T | max_size (T... args) | ||
T | merge (T... args) | ||
T | operator= (T... args) | ||
T | operator[] (T... args) | ||
T | rbegin (T... args) | ||
T | rend (T... args) | ||
T | size (T... args) | ||
T | swap (T... args) | ||
T | try_emplace (T... args) | ||
T | upper_bound (T... args) | ||
T | value_comp (T... args) | ||
T | ~map (T... args) | ||
Related Symbols | |
(Note that these are not member symbols.) | |
Other literals | |
template<small_string< 2 > str> | |
constexpr uint16_t | operator""_tag () |
The SAM tag literal, such that tags can be used in constant expressions. | |
The SAM tag dictionary class that stores all optional SAM fields.
A SAM tag consists of two letters, initialized via the string literal ""_tag, which delegates to its unique id (type uint16_t). Example:
The purpose of those tags is to fill or query the seqan3::sam_tag_dictionary for a specific key (tag_id) and retrieve the corresponding value.
Note that a SAM tag is always associated with a specific type. In the SAM format, the type is indicated in the second argument of the TAG:TYPE:VALUE field. For example "NM:i:3" specifies the NM tag of an integer type with value 3. In seqan3, the types for known SAM tags are pre-defined by a type trait called seqan3::sam_tag_type. You can access the type via:
which is the short cut for:
The following types are allowed by the SAM specifications:
Type | Regexp matching VALUE | Description | SeqAn Type |
---|---|---|---|
A | [!-~] | Printable character | char |
i | [-+]?[0-9]+ | Signed integer | int32_t |
f | [-+]?[0-9]*.?[0-9]+([eE][-+]?[0-9]+)? | Single-precision floating number | float |
Z | [ !-~]* | Printable string, including space | std::string |
H | ([0-9A-F][0-9A-F])* | Byte array in the Hex format | std::vector<uint8_t> |
B | [cCsSiIf](,[-+]?[0-9]*.?[0-9]+([eE][-+]?[0-9]+)?)+ | Integer or numeric array | std::vector<T> |
For an integer or numeric array (type ‘B’), the second letter can be one of ‘cCsSiIf’, corresponding to type T = int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t and float, respectively.
The dictionary can be accessed via the functions seqan3::sam_tag_dictionary::get() and seqan3::sam_tag_dictionary::set(). Every time the SAM tag you wish to query for must be given as a template argument to the functions.
Example:
Unknown Tag Example:
As mentioned before you can either overload the type trait seqan3::sam_tag_type for the tag "XZ" or learn more about a std::variant at https://en.cppreference.com/w/cpp/utility/variant.
Uses std::map::at() for access and throws when the key is unknown.
std::out_of_range | if map has no key tag . |
Uses std::map::at() for access and throws when the key is unknown.
std::out_of_range | if map has no key tag . |