source: tags/ms_r16q3/STAT/MostLikelySeq.hxx

Last change on this file was 13625, checked in by westram, 9 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
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
21extern class DNA_Table {
22    char char_to_enum_table[256];
23public:
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
30const 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
34const int ST_BUCKET_SIZE = 16;                      // at minimum ST_BUCKET_SIZE characters are calculated per call
35const int LD_BUCKET_SIZE = 4;                       // log dualis of ST_BUCKET_SIZE
36
37class ST_ML;
38
39class MostLikelySeq : public AP_sequence { // derived from a Noncopyable
40    /*! contains existing sequence or ancestor sequence
41     * as max. likelihood vectors
42     */
43public:
44    static ST_base_vector *tmp_out;                 // len = alignment length (@@@ could be member of ST_ML ? )
45
46private:
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;
50public:
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
55private:
56    AP_FLOAT count_weighted_bases() const OVERRIDE;
57
58    void set(const char *sequence) OVERRIDE;
59    void unset() OVERRIDE;
60
61public:
62
63    MostLikelySeq(const AliView *aliview, ST_ML *st_ml_);
64    ~MostLikelySeq() OVERRIDE;
65
66    bool is_up_to_date() const { return up_to_date; }
67
68    AP_sequence *dup() const OVERRIDE;
69    AP_FLOAT     combine(const AP_sequence* lefts, const AP_sequence *rights, char *mutation_per_site = 0) OVERRIDE;
70    void partial_match(const AP_sequence* part, long *overlap, long *penalty) const OVERRIDE;
71    uint32_t checksum() const OVERRIDE;
72
73    bool equals(const MostLikelySeq */*other*/) const { arb_assert(0); return false; } // unused
74    bool equals(const AP_sequence *other) const OVERRIDE { return equals(DOWNCAST(const MostLikelySeq*, other)); }
75
76    GB_ERROR bind_to_species(GBDATA *gb_species);
77    void     unbind_from_species(bool remove_callbacks);
78    GBDATA *get_bound_species_data() const { return AP_sequence::get_bound_species_data(); }
79
80    void sequence_change();                         // sequence has changed in db
81    void set_sequence();                            // start at st_ml->base
82
83    void calculate_ancestor(const MostLikelySeq *lefts, double leftl, const MostLikelySeq *rights, double rightl);
84    void forget_sequence() { up_to_date = false; }
85
86    void calc_out(const MostLikelySeq *sequence_of_brother, double dist);
87    void print();
88};
89
90
91#else
92#error MostLikelySeq.hxx included twice
93#endif // MOSTLIKELYSEQ_HXX
94
Note: See TracBrowser for help on using the repository browser.