|
vg
tools for working with variation graphs
|
#include <gaf_sorter.hpp>
Public Types | |
| enum | key_type { key_node_interval, key_gbwt_pos, key_hash } |
| Types of keys that can be derived from the value. More... | |
Public Member Functions | |
| GAFSorterRecord () | |
| Default constructor. More... | |
| GAFSorterRecord (std::string &&value, key_type type) | |
| Constructor that consumes the given value and sets the key. More... | |
| bool | operator< (const GAFSorterRecord &another) const |
| Records are sorted by key in ascending order. More... | |
| void | flip_key () |
| void | set_key (key_type type) |
| Sets a key of the given type, or MISSING_KEY if the key cannot be derived. More... | |
| bool | serialize (std::ostream &out) const |
| Serializes the record to a stream. Returns true on success. More... | |
| bool | write_line (std::ostream &out) const |
| Writes the underlying GAF line to a stream. Returns true on success. More... | |
| bool | deserialize (std::istream &in) |
| Deserializes the record from a stream. Returns true on success. More... | |
| bool | read_line (std::istream &in, key_type type) |
| Reads a GAF line from a stream and sets the key. Returns true on success. More... | |
| str_view | get_field (size_t field) const |
| Returns a view of the given 0-based field, or an empty string if the field is missing. More... | |
| void | for_each_field (const std::function< bool(size_t, str_view)> &lambda) const |
| gbwt::vector_type | as_gbwt_path (bool *ok=nullptr) const |
Public Attributes | |
| std::uint64_t | key |
| Integer key. More... | |
| std::string | value |
| GAF line. More... | |
Static Public Attributes | |
| static std::hash< std::string > | hasher |
| Hasher used for random shuffling. More... | |
| constexpr static std::uint64_t | MISSING_KEY = std::numeric_limits<std::uint64_t>::max() |
| Missing key. Records without a key are sorted to the end. More... | |
| const static std::string | GBWT_OFFSET_TAG = "GB:i:" |
| constexpr static size_t | STRAND_FIELD = 4 |
| 0-based field number for the strand/orientation in a GAF line. More... | |
| constexpr static size_t | PATH_FIELD = 5 |
| 0-based field number for the path in a GAF line. More... | |
| constexpr static size_t | MANDATORY_FIELDS = 12 |
| Number of mandatory fields in a GAF line. More... | |
A record corresponding to a single line (alignment) in a GAF file. The record contains an integer key and the original line. Various types of keys can be derived from the value, but the line is not parsed beyond that.
|
inline |
Default constructor.
|
inline |
Constructor that consumes the given value and sets the key.
| gbwt::vector_type vg::GAFSorterRecord::as_gbwt_path | ( | bool * | ok = nullptr | ) | const |
Returns the path as a GBWT path in forward orientation. If an ok flag is given, sets it to false and prints an error message if the path could not be parsed.
| bool vg::GAFSorterRecord::deserialize | ( | std::istream & | in | ) |
Deserializes the record from a stream. Returns true on success.
|
inline |
Flips they key to reverse the order. Sorting is based on ascending order, while priority queues return the largest element first.
| void vg::GAFSorterRecord::for_each_field | ( | const std::function< bool(size_t, str_view)> & | lambda | ) | const |
Calls the given function with a 0-based field index and the field value. Stops if the function returns false.
| str_view vg::GAFSorterRecord::get_field | ( | size_t | field | ) | const |
Returns a view of the given 0-based field, or an empty string if the field is missing.
|
inline |
Records are sorted by key in ascending order.
| bool vg::GAFSorterRecord::read_line | ( | std::istream & | in, |
| key_type | type | ||
| ) |
Reads a GAF line from a stream and sets the key. Returns true on success.
| bool vg::GAFSorterRecord::serialize | ( | std::ostream & | out | ) | const |
Serializes the record to a stream. Returns true on success.
| void vg::GAFSorterRecord::set_key | ( | key_type | type | ) |
Sets a key of the given type, or MISSING_KEY if the key cannot be derived.
| bool vg::GAFSorterRecord::write_line | ( | std::ostream & | out | ) | const |
Writes the underlying GAF line to a stream. Returns true on success.
|
static |
Node offset for the GBWT starting position of the forward orientation may be stored in this tag.
|
static |
Hasher used for random shuffling.
| std::uint64_t vg::GAFSorterRecord::key |
Integer key.
|
staticconstexpr |
Number of mandatory fields in a GAF line.
|
staticconstexpr |
Missing key. Records without a key are sorted to the end.
|
staticconstexpr |
0-based field number for the path in a GAF line.
|
staticconstexpr |
0-based field number for the strand/orientation in a GAF line.
| std::string vg::GAFSorterRecord::value |
GAF line.
1.8.17