16 size_t SequenceWalker::getAlignmentPosition(
size_t seqPos)
18 if (seqPos == seqPos_)
23 while (alnPos_ < seq_->size() && seqPos_ < seqPos)
25 if (alnPos_ == seq_->size() - 1)
26 throw Exception(
"SequenceWalker::getAlignmentPosition(). Forward1. Position out of bound.");
29 if ((*seq_)[alnPos_] != gap_)
34 if (seqPos_ != seqPos)
35 throw Exception(
"SequenceWalker::getAlignmentPosition(). Forward2. Position out of bound (" + TextTools::toString(alnPos_) +
")");
41 throw Exception(
"SequenceWalker::getAlignmentPosition(). Backward. Position out of bound.");
42 while (alnPos_ > 0 && seqPos_ > seqPos)
45 if ((*seq_)[alnPos_] != gap_)
50 if (seqPos_ != seqPos)
51 throw Exception(
"SequenceWalker::getAlignmentPosition(). Position out of bound.");
56 size_t SequenceWalker::getSequencePosition(
size_t alnPos)
58 if (alnPos == alnPos_)
60 if (alnPos >= seq_->size())
61 throw Exception(
"SequenceWalker::getSequencePosition(). Position out of bound.");
65 while (alnPos_ < alnPos)
68 if ((*seq_)[alnPos_] != gap_)
77 while (alnPos_ > alnPos)
82 if ((*seq_)[alnPos_ + 1] != gap_)
This alphabet is used to deal NumericAlphabet.