bpp-seq3  3.0.0
SequenceWalker.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_SEQUENCEWALKER_H
6 #define BPP_SEQ_SEQUENCEWALKER_H
7 
8 
9 #include "Sequence.h"
10 
11 namespace bpp
12 {
20 {
21 private:
23  size_t seqPos_, alnPos_;
24  int gap_;
25 
26 public:
28  seq_(&seq), seqPos_(0), alnPos_(0), gap_(seq.getAlphabet()->getGapCharacterCode())
29  {
30  if (seq_->size() > 0)
31  {
32  while ((*seq_)[alnPos_] == gap_)
33  ++alnPos_;
34  }
35  }
36  SequenceWalker(const SequenceWalker& walker) :
37  seq_(walker.seq_), seqPos_(walker.seqPos_), alnPos_(walker.alnPos_), gap_(walker.gap_) {}
39  {
40  seq_ = walker.seq_;
41  seqPos_ = walker.seqPos_;
42  alnPos_ = walker.alnPos_;
43  gap_ = walker.gap_;
44  return *this;
45  }
46  virtual ~SequenceWalker() {}
47 
48 public:
49  size_t getAlignmentPosition(size_t seqPos);
50  size_t getSequencePosition(size_t alnPos);
51 };
52 } // end of namespace bpp.
53 #endif // BPP_SEQ_SEQUENCEWALKER_H
virtual size_t size() const =0
Get the number of elements in the list.
The sequence interface.
Definition: Sequence.h:34
A helper class to easily convert coordinates between sequence and alignments.
size_t getSequencePosition(size_t alnPos)
virtual ~SequenceWalker()
SequenceWalker(const SequenceWalker &walker)
const SequenceInterface * seq_
SequenceWalker & operator=(const SequenceWalker &walker)
SequenceWalker(const SequenceInterface &seq)
size_t getAlignmentPosition(size_t seqPos)
This alphabet is used to deal NumericAlphabet.