1 | // ================================================================ // |
---|
2 | // // |
---|
3 | // File : MostLikelySeq.hxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // ================================================================ // |
---|
10 | |
---|
11 | #ifndef MOSTLIKELYSEQ_HXX |
---|
12 | #define MOSTLIKELYSEQ_HXX |
---|
13 | |
---|
14 | #ifndef AP_SEQUENCE_HXX |
---|
15 | #include <AP_sequence.hxx> |
---|
16 | #endif |
---|
17 | #ifndef DOWNCAST_H |
---|
18 | #include <downcast.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | extern class DNA_Table { |
---|
22 | char char_to_enum_table[256]; |
---|
23 | public: |
---|
24 | DNA_Base char_to_enum(char i) { |
---|
25 | return (DNA_Base)char_to_enum_table[(unsigned char)i]; |
---|
26 | } |
---|
27 | DNA_Table(); |
---|
28 | } dna_table; |
---|
29 | |
---|
30 | const size_t ST_MAX_SEQ_PART = 256; /* should be greater than the editor width (otherwise extrem performance penalties) |
---|
31 | * (Please note: this value has as well a small influence on the calculated results) |
---|
32 | */ |
---|
33 | |
---|
34 | const int ST_BUCKET_SIZE = 16; // at minimum ST_BUCKET_SIZE characters are calculated per call |
---|
35 | const int LD_BUCKET_SIZE = 4; // log dualis of ST_BUCKET_SIZE |
---|
36 | |
---|
37 | class ST_ML; |
---|
38 | |
---|
39 | class MostLikelySeq : public AP_sequence { // derived from a Noncopyable |
---|
40 | /*! contains existing sequence or ancestor sequence |
---|
41 | * as max. likelihood vectors |
---|
42 | */ |
---|
43 | public: |
---|
44 | static ST_base_vector *tmp_out; // len = alignment length (@@@ could be member of ST_ML ? ) |
---|
45 | |
---|
46 | private: |
---|
47 | ST_ML *st_ml; // link to a global ST object (@@@ could be static) |
---|
48 | ST_base_vector *sequence; // A part of the sequence |
---|
49 | bool up_to_date; |
---|
50 | public: |
---|
51 | // @@@ move the 2 following members into one new class and put one pointer here |
---|
52 | ST_ML_Color *color_out; |
---|
53 | int *color_out_valid_till; // color_out is valid up to |
---|
54 | |
---|
55 | private: |
---|
56 | void set(const char *sequence) OVERRIDE; |
---|
57 | void unset() OVERRIDE; |
---|
58 | |
---|
59 | public: |
---|
60 | |
---|
61 | MostLikelySeq(const AliView *aliview, ST_ML *st_ml_); |
---|
62 | ~MostLikelySeq() OVERRIDE; |
---|
63 | |
---|
64 | bool is_up_to_date() const { return up_to_date; } |
---|
65 | |
---|
66 | AP_sequence *dup() const OVERRIDE; |
---|
67 | |
---|
68 | GB_ERROR bind_to_species(GBDATA *gb_species); |
---|
69 | void unbind_from_species(bool remove_callbacks); |
---|
70 | GBDATA *get_bound_species_data() const { return AP_sequence::get_bound_species_data(); } |
---|
71 | |
---|
72 | void sequence_change(); // sequence has changed in db |
---|
73 | void set_sequence(); // start at st_ml->base |
---|
74 | |
---|
75 | void calculate_ancestor(const MostLikelySeq *lefts, double leftl, const MostLikelySeq *rights, double rightl); |
---|
76 | void forget_sequence() { up_to_date = false; } |
---|
77 | |
---|
78 | void calc_out(const MostLikelySeq *sequence_of_brother, double dist); |
---|
79 | void print(); |
---|
80 | }; |
---|
81 | |
---|
82 | |
---|
83 | #else |
---|
84 | #error MostLikelySeq.hxx included twice |
---|
85 | #endif // MOSTLIKELYSEQ_HXX |
---|
86 | |
---|