source: branches/stable/CONVERTALN/ali.h

Last change on this file was 7049, checked in by westram, 13 years ago
  • completes [7044] (possible lost by merging)
File size: 1019 bytes
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
11class Alignment {
12    std::vector<SeqPtr> seq;
13
14public:
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.