| Line | |
|---|
| 1 | #ifndef ALI_H |
|---|
| 2 | #define ALI_H |
|---|
| 3 | |
|---|
| 4 | #ifndef SEQ_H |
|---|
| 5 | #include "seq.h" |
|---|
| 6 | #endif |
|---|
| 7 | #ifndef _GLIBCXX_VECTOR |
|---|
| 8 | #include <vector> |
|---|
| 9 | #endif |
|---|
| 10 | |
|---|
| 11 | class Alignment { |
|---|
| 12 | std::vector<SeqPtr> seq; |
|---|
| 13 | |
|---|
| 14 | public: |
|---|
| 15 | int get_count() const { return seq.size(); } |
|---|
| 16 | bool valid(int idx) const { return idx >= 0 && idx<get_count(); } |
|---|
| 17 | |
|---|
| 18 | int get_len(int idx) const { ca_assert(valid(idx)); return seq[idx]->get_len(); } |
|---|
| 19 | const Seq& get(int idx) const { ca_assert(valid(idx)); return *(seq[idx]); } |
|---|
| 20 | SeqPtr getSeqPtr(int idx) { ca_assert(valid(idx)); return seq[idx]; } |
|---|
| 21 | |
|---|
| 22 | int get_max_len() const { |
|---|
| 23 | int maxlen = -1; |
|---|
| 24 | for (int i = 0; i<get_count(); ++i) maxlen = max(maxlen, get_len(i)); |
|---|
| 25 | return maxlen; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | void add(SeqPtr sequence) { seq.push_back(sequence); } |
|---|
| 29 | void add(const char *name, const char *sequence, size_t seq_len) { add(new Seq(name, sequence, seq_len)); } |
|---|
| 30 | void add(const char *name, const char *sequence) { add(name, sequence, strlen(sequence)); } |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | #else |
|---|
| 34 | #error ali.h included twice |
|---|
| 35 | #endif // ALI_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.