1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : ColumnStat.hxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #ifndef COLUMNSTAT_HXX |
---|
12 | #define COLUMNSTAT_HXX |
---|
13 | |
---|
14 | #ifndef ARBDB_BASE_H |
---|
15 | #include <arbdb_base.h> |
---|
16 | #endif |
---|
17 | #ifndef ARBTOOLS_H |
---|
18 | #include <arbtools.h> |
---|
19 | #endif |
---|
20 | #ifndef ARB_ASSERT_H |
---|
21 | #include <arb_assert.h> |
---|
22 | #endif |
---|
23 | |
---|
24 | /* Create a window, that allows you to select a column statistic and |
---|
25 | * get the weights from the selected SAI |
---|
26 | * |
---|
27 | * 1. create ColumnStat |
---|
28 | * 2. build button with callback COLSTAT_create_selection_window |
---|
29 | * 3. call ColumnStat::go(second_filter) |
---|
30 | * 4. use ColumnStat::get_weights() |
---|
31 | */ |
---|
32 | |
---|
33 | class AW_root; |
---|
34 | class AW_window; |
---|
35 | class AP_filter; |
---|
36 | class AW_awar; |
---|
37 | |
---|
38 | #define DIST_MIN_SEQ(seq_anz) (seq_anz / 10) |
---|
39 | |
---|
40 | class ColumnStat : virtual Noncopyable { |
---|
41 | GBDATA *gb_main; |
---|
42 | AW_root *awr; |
---|
43 | |
---|
44 | char *awar_name; |
---|
45 | char *awar_alignment; |
---|
46 | char *awar_smooth; |
---|
47 | char *awar_enable_helix; |
---|
48 | |
---|
49 | char *alignment_name; |
---|
50 | char *type_path; |
---|
51 | |
---|
52 | class AW_DB_selection *saisel; |
---|
53 | |
---|
54 | // all members below are valid after calling calculate() only! |
---|
55 | // |
---|
56 | // @@@ they should be stored in a separate class and referenced by pointer here |
---|
57 | // (e.g. rename this class into ColumnStatSelector and name the new class ColumnStat) |
---|
58 | |
---|
59 | size_t seq_len; // real length == 0 -> not valid |
---|
60 | GB_UINT4 *weights; // helix = 1, non helix == 2 |
---|
61 | float *rates; |
---|
62 | float *ttratio; |
---|
63 | bool *is_helix; |
---|
64 | GB_UINT4 *mut_sum; |
---|
65 | GB_UINT4 *freq_sum; |
---|
66 | char *desc; |
---|
67 | float *frequency[256]; |
---|
68 | |
---|
69 | public: |
---|
70 | ColumnStat(GBDATA *gb_main_, AW_root *awr_, const char *awar_template, AW_awar *awar_used_alignment); |
---|
71 | ~ColumnStat(); |
---|
72 | |
---|
73 | __ATTR__USERESULT GB_ERROR calculate(AP_filter *filter); |
---|
74 | void forget(); |
---|
75 | |
---|
76 | GBDATA *get_gb_main() const { return gb_main; } |
---|
77 | |
---|
78 | bool has_valid_alignment() const { return !strchr(alignment_name, '?'); } |
---|
79 | |
---|
80 | const char *get_awar_smooth() const { return awar_smooth; } |
---|
81 | const char *get_awar_enable_helix() const { return awar_enable_helix; } |
---|
82 | const char *get_type_path() const { arb_assert(has_valid_alignment()); return type_path; } |
---|
83 | |
---|
84 | bool has_rates() const { return rates; } |
---|
85 | void weight_by_inverseRates() const; |
---|
86 | |
---|
87 | size_t get_length() const { return seq_len; } |
---|
88 | |
---|
89 | const GB_UINT4 *get_weights() const { return weights; } |
---|
90 | const float *get_rates() const { return rates; } |
---|
91 | const float *get_ttratio() const { return ttratio; } |
---|
92 | const bool *get_is_helix() const { return is_helix; } |
---|
93 | const float *get_frequencies(unsigned char c) const { return frequency[c]; } |
---|
94 | |
---|
95 | void create_sai_selection_list(AW_window *aww); |
---|
96 | void refresh_sai_selection_list(); |
---|
97 | |
---|
98 | void print(); |
---|
99 | }; |
---|
100 | |
---|
101 | AW_window *COLSTAT_create_selection_window(AW_root *root, ColumnStat *column_stat); |
---|
102 | void COLSTAT_create_selection_list(AW_window *aww, ColumnStat *column_stat); |
---|
103 | |
---|
104 | #else |
---|
105 | #error ColumnStat.hxx included twice |
---|
106 | #endif // COLUMNSTAT_HXX |
---|