ARB
MostLikelySeq.hxx
Go to the documentation of this file.
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:
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
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
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);
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 
const char * GB_ERROR
Definition: arb_core.h:25
class DNA_Table dna_table
unsigned char ST_ML_Color
Definition: st_ml.hxx:42
DNA_Base
Definition: st_ml.hxx:49
static ST_base_vector * tmp_out
const int ST_BUCKET_SIZE
GBDATA * get_bound_species_data() const
Definition: AP_sequence.hxx:65
Definition: st_ml.hxx:111
void set_sequence()
Definition: ST_ml.cxx:224
AP_sequence * dup() const OVERRIDE
Definition: ST_ml.cxx:213
GBDATA * get_bound_species_data() const
void print()
Definition: ST_ml.cxx:303
DNA_Base char_to_enum(char i)
void calculate_ancestor(const MostLikelySeq *lefts, double leftl, const MostLikelySeq *rights, double rightl)
Definition: ST_ml.cxx:247
void unbind_from_species()
Definition: AP_sequence.cxx:40
ST_ML_Color * color_out
void calc_out(const MostLikelySeq *sequence_of_brother, double dist)
Definition: ST_ml.cxx:281
bool is_up_to_date() const
int * color_out_valid_till
void sequence_change()
Definition: ST_ml.cxx:209
#define OVERRIDE
Definition: cxxforward.h:112
void forget_sequence()
GB_ERROR bind_to_species(GBDATA *gb_species)
Definition: ST_ml.cxx:186
DNA_Table()
Definition: ST_ml.cxx:26
const int LD_BUCKET_SIZE
const size_t ST_MAX_SEQ_PART