| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : ali_pt.hxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #ifndef ALI_PT_HXX |
|---|
| 12 | #define ALI_PT_HXX |
|---|
| 13 | |
|---|
| 14 | #ifndef ALI_OTHER_STUFF_HXX |
|---|
| 15 | #include "ali_other_stuff.hxx" |
|---|
| 16 | #endif |
|---|
| 17 | #ifndef ALI_TLIST_HXX |
|---|
| 18 | #include "ali_tlist.hxx" |
|---|
| 19 | #endif |
|---|
| 20 | #ifndef ALI_SEQUENCE_HXX |
|---|
| 21 | #include "ali_sequence.hxx" |
|---|
| 22 | #endif |
|---|
| 23 | #ifndef CLIENT_H |
|---|
| 24 | #include <client.h> |
|---|
| 25 | #endif |
|---|
| 26 | |
|---|
| 27 | enum ALI_PT_MODE { ServerMode, SpecifiedMode }; |
|---|
| 28 | |
|---|
| 29 | struct ALI_PT_CONTEXT { |
|---|
| 30 | char *servername; |
|---|
| 31 | GBDATA *gb_main; |
|---|
| 32 | |
|---|
| 33 | int matches_min; |
|---|
| 34 | float percent_min; |
|---|
| 35 | unsigned long fam_list_max; |
|---|
| 36 | unsigned long ext_list_max; |
|---|
| 37 | |
|---|
| 38 | char *use_specified_family; |
|---|
| 39 | }; |
|---|
| 40 | |
|---|
| 41 | // class of family members |
|---|
| 42 | struct ali_pt_member : virtual Noncopyable { |
|---|
| 43 | char *name; |
|---|
| 44 | int matches; |
|---|
| 45 | |
|---|
| 46 | ali_pt_member(char *speciesname, int number_of_matches) { |
|---|
| 47 | name = speciesname; |
|---|
| 48 | matches = number_of_matches; |
|---|
| 49 | } |
|---|
| 50 | ~ali_pt_member() { |
|---|
| 51 | if (name) |
|---|
| 52 | free((char *) name); |
|---|
| 53 | } |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | // Class for accessing the PT server |
|---|
| 58 | class ALI_PT : virtual Noncopyable { |
|---|
| 59 | private: |
|---|
| 60 | ALI_PT_MODE mode; |
|---|
| 61 | |
|---|
| 62 | char *specified_family; |
|---|
| 63 | unsigned long fam_list_max; |
|---|
| 64 | unsigned long ext_list_max; |
|---|
| 65 | float percent_min; |
|---|
| 66 | int matches_min; |
|---|
| 67 | |
|---|
| 68 | aisc_com *link; |
|---|
| 69 | T_PT_LOCS locs; |
|---|
| 70 | T_PT_MAIN com; |
|---|
| 71 | |
|---|
| 72 | ALI_TLIST<ali_pt_member *> *family_list; |
|---|
| 73 | ALI_TLIST<ali_pt_member *> *extension_list; |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | int init_communication(); |
|---|
| 77 | char *get_family_member(char *specified_family, unsigned long number); |
|---|
| 78 | char *get_extension_member(char *specified_family, unsigned long number); |
|---|
| 79 | int open(char *servername); |
|---|
| 80 | void close(); |
|---|
| 81 | |
|---|
| 82 | public: |
|---|
| 83 | ALI_PT(ALI_PT_CONTEXT *context); |
|---|
| 84 | ~ALI_PT(); |
|---|
| 85 | |
|---|
| 86 | int find_family(ALI_SEQUENCE *sequence, int find_type = 1); |
|---|
| 87 | |
|---|
| 88 | ALI_TLIST<ali_pt_member *> *get_family_list(); |
|---|
| 89 | ALI_TLIST<ali_pt_member *> *get_extension_list(); |
|---|
| 90 | |
|---|
| 91 | int first_family_(char **seq_name, int *matches); |
|---|
| 92 | int next_family_(char **seq_name, int *matches); |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | #else |
|---|
| 96 | #error ali_pt.hxx included twice |
|---|
| 97 | #endif // ALI_PT_HXX |
|---|