| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : PH_matr.cxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #include "phylo.hxx" |
|---|
| 12 | |
|---|
| 13 | #include <aw_file.hxx> |
|---|
| 14 | #include <aw_window.hxx> |
|---|
| 15 | #include <aw_awar.hxx> |
|---|
| 16 | #include <aw_msg.hxx> |
|---|
| 17 | #include <aw_root.hxx> |
|---|
| 18 | |
|---|
| 19 | #include <AP_pro_a_nucs.hxx> |
|---|
| 20 | |
|---|
| 21 | #if defined(WARN_TODO) |
|---|
| 22 | #warning module completely unused |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | extern void ph_view_matrix_cb(AW_window *); |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | #define CHECK_NAN(x) if ((!(x>=0.0)) && (!(x<0.0))) *(int *)0=0; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | static AP_smatrix *global_ratematrix = 0; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | static void set_globel_r_m_value(AW_root *aw_root, long i, long j) { |
|---|
| 35 | char buffer[256]; |
|---|
| 36 | sprintf(buffer, "phyl/ratematrix/val_%li_%li", i, j); |
|---|
| 37 | global_ratematrix->set(i, j, aw_root->awar(buffer)->read_float()); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | void PH_create_matrix_variables(AW_root *aw_root, AW_default def) |
|---|
| 41 | { |
|---|
| 42 | aw_root->awar_string("tmp/dummy_string", "0", def); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | aw_root->awar_string("phyl/which_species", "marked", def); |
|---|
| 46 | aw_root->awar_string("phyl/alignment", "", def); |
|---|
| 47 | |
|---|
| 48 | aw_root->awar_string("phyl/filter/alignment", "none", def); |
|---|
| 49 | aw_root->awar_string("phyl/filter/name", "none", def); |
|---|
| 50 | aw_root->awar_string("phyl/filter/filter", "", def); |
|---|
| 51 | |
|---|
| 52 | aw_root->awar_string("phyl/weights/name", "none", def); |
|---|
| 53 | aw_root->awar_string("phyl/weights/alignment", "none", def); |
|---|
| 54 | |
|---|
| 55 | aw_root->awar_string("phyl/rates/name", "none", def); |
|---|
| 56 | aw_root->awar_string("phyl/cancel/chars", ".", def); |
|---|
| 57 | aw_root->awar_string("phyl/correction/transformation", "none", def); |
|---|
| 58 | |
|---|
| 59 | aw_root->awar("phyl/filter/alignment")->map("phyl/alignment"); |
|---|
| 60 | aw_root->awar("phyl/weights/alignment")->map("phyl/alignment"); |
|---|
| 61 | |
|---|
| 62 | AW_create_fileselection_awars(aw_root, "tmp/phyl/save_matrix", ".", "", "infile", def); |
|---|
| 63 | |
|---|
| 64 | aw_root->awar_string("phyl/tree/tree_name", "tree_temp", def); |
|---|
| 65 | |
|---|
| 66 | aw_root->awar_float("phyl/alpha", 1.0, def); |
|---|
| 67 | |
|---|
| 68 | global_ratematrix = new AP_smatrix(AP_MAX); |
|---|
| 69 | |
|---|
| 70 | long i, j; |
|---|
| 71 | for (i=0; i <AP_MAX; i++) { |
|---|
| 72 | for (j=0; j <AP_MAX; j++) { |
|---|
| 73 | if (i!=j) global_ratematrix->set(i, j, 1.0); |
|---|
| 74 | } |
|---|
| 75 | } |
|---|
| 76 | for (i=AP_A; i <AP_MAX; i*=2) { |
|---|
| 77 | for (j = AP_A; j < i; j*=2) { |
|---|
| 78 | char buffer[256]; |
|---|
| 79 | sprintf(buffer, "phyl/ratematrix/val_%li_%li", i, j); |
|---|
| 80 | aw_root->awar_float(buffer, 1.0, def); |
|---|
| 81 | aw_root->awar(buffer)->add_callback((AW_RCB)set_globel_r_m_value, (AW_CL)i, (AW_CL)j); |
|---|
| 82 | } |
|---|
| 83 | } |
|---|
| 84 | } |
|---|
| 85 | |
|---|