24 #ifndef _GAPPED_ALIGNMENT_VECTOR_H_ 25 #define _GAPPED_ALIGNMENT_VECTOR_H_ 28 #include "alignment_vector_base.h" 38 inline void add_match(AlignmentVectorBase::events_storage_t *vec) { vec->push_back(
false); vec->push_back(
false); }
41 inline void add_mismatch(AlignmentVectorBase::events_storage_t *vec) { vec->push_back(
false); vec->push_back(
true); }
43 inline void add_ins(AlignmentVectorBase::events_storage_t *vec) { vec->push_back(
true); vec->push_back(
false); }
45 inline void add_del(AlignmentVectorBase::events_storage_t *vec) { vec->push_back(
true); vec->push_back(
true); }
60 void addAlignment(seg_index_t
id, seq_len_t p_start, seq_len_t t_start,
const events_storage_t &vec) {
61 _data.push_back(p_start);
62 _data.push_back(t_start);
63 _data.push_back(vec.size() / 2);
65 _starts.push_back(
_events.size());
73 bool isMatch(seq_len_t i, seq_len_t j)
const {
77 if (_starts[i] + j*2 + 1 >=
_events.size()) {
78 throw(std::runtime_error(
"Alignment vector: index is out of bounds."));
81 return !(
_events[_starts[i] + j*2] &&
_events[_starts[i] + j*2 + 1]);
84 bool isMismatch(seq_len_t i, seq_len_t j)
const {
87 if (_starts[i] + j*2 + 1 >=
_events.size()) {
88 throw(std::runtime_error(
"Alignment vector: index is out of bounds."));
91 return !
_events[_starts[i] + j*2] &&
_events[_starts[i] + j*2 + 1];
94 bool isIns(seq_len_t i, seq_len_t j)
const {
97 if (_starts[i] + j*2 + 1 >=
_events.size()) {
98 throw(std::runtime_error(
"Alignment vector: index is out of bounds."));
101 return _events[_starts[i] + j*2] && !
_events[_starts[i] + j*2 + 1];
104 bool isDel(seq_len_t i, seq_len_t j)
const {
107 if (_starts[i] + j*2 + 1 >=
_events.size()) {
108 throw(std::runtime_error(
"Alignment vector: index is out of bounds."));
111 return _events[_starts[i] + j*2] &&
_events[_starts[i] + j*2 + 1];
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
Definition: gapped_alignment_vector.h:52
bool isMatch(seq_len_t i, seq_len_t j) const
Check if a some alignment has a specific events at a specific position.
Definition: gapped_alignment_vector.h:74