24 #ifndef _ALIGNMENT_VECTOR_BASE_H_ 25 #define _ALIGNMENT_VECTOR_BASE_H_ 31 #include "alignment.h" 44 typedef std::vector<bool> events_storage_t;
47 static const size_t default_start_reserve_size = 20;
49 static const size_t default_events_reserve_size = 600;
53 _events.reserve(default_events_reserve_size);
54 _starts.reserve(default_start_reserve_size);
67 return _data == other._data
69 && _starts == other._starts;
73 return _data != other._data
75 || _starts != other._starts;
81 _data.reserve(_data.size() + other._data.size() + 1);
82 _data.insert(_data.end(), other._data.begin(), other._data.end());
84 _starts.reserve(_starts.size() + other._starts.size() + 1);
85 size_t events_size =
_events.size();
86 for (
size_t i = 0; i < other._starts.size(); ++i) {
87 _starts.push_back(events_size + other._starts[i]);
97 return _data.size() / 4;
102 _data.reserve(_data.size() + 1);
114 seq_len_t pattern_start(seq_len_t i)
const {
115 check_and_throw(i*4 >= _data.size(),
"Alignment vector: pattern index " + std::to_string(i*4) +
" is out of bounds (" + std::to_string(_data.size()) +
")");
120 seq_len_t text_start(seq_len_t i)
const {
121 check_and_throw(i*4 + 1 >= _data.size(),
"Alignment vector: text index " + std::to_string(i*4 + 1) +
" is out of bounds (" + std::to_string(_data.size()) +
")");
122 return _data[i*4 + 1];
126 seq_len_t len(seq_len_t i)
const {
127 check_and_throw(i*4 + 2 >= _data.size(),
"Alignment vector: length index " + std::to_string(i*4 + 2) +
" is out of bounds (" + std::to_string(_data.size()) +
")");
128 return _data[i*4 + 2];
132 seq_len_t id(seq_len_t i)
const {
133 check_and_throw(i*4 + 3 >= _data.size(),
"Alignment vector: ID index " + std::to_string(i*4 + 3) +
" is out of bounds (" + std::to_string(_data.size()) +
")");
134 return _data[i*4 + 3];
140 std::vector<seq_len_t> _data;
142 std::vector<size_t> _starts;
events_storage_t _events
Vector of 4-tpuples - pattern start, text start, alignment length and a text ID.
Definition: alignment_vector_base.h:141
Definition: alignment_vector_base.h:41