1 | |
---|
2 | #include <PT_com.h> |
---|
3 | #include <arbdb.h> |
---|
4 | |
---|
5 | #ifndef NDEBUG |
---|
6 | # define pt_assert(bed) do { if (!(bed)) *(int *)0=0; } while (0) |
---|
7 | # ifndef DEBUG |
---|
8 | # error DEBUG is NOT defined - but it has to! |
---|
9 | # endif |
---|
10 | #else |
---|
11 | # ifdef DEBUG |
---|
12 | # error DEBUG is defined - but it should not! |
---|
13 | # endif |
---|
14 | # define pt_assert(bed) |
---|
15 | #endif |
---|
16 | |
---|
17 | #define PTM_DEBUG |
---|
18 | typedef unsigned long ulong; |
---|
19 | typedef unsigned int uint; |
---|
20 | typedef unsigned char uchar; |
---|
21 | |
---|
22 | #define min(a, b) ((a) < (b)) ? (a) : (b) |
---|
23 | #define max(a, b) ((a) > (b)) ? (a) : (b) |
---|
24 | #define PT_CORE *(int *)0=0; |
---|
25 | #define PT_MAX_MATCHES 10000 |
---|
26 | #define PT_MAX_IDENTS 10000 |
---|
27 | #define PT_POS_TREE_HEIGHT 20 |
---|
28 | #define PT_POS_SECURITY 10 |
---|
29 | #define MIN_PROBE_LENGTH 8 |
---|
30 | #define PT_NAME_HASH_SIZE 10000 |
---|
31 | |
---|
32 | enum PT_MATCH_TYPE { |
---|
33 | PT_MATCH_TYPE_INTEGER = 0, |
---|
34 | PT_MATCH_TYPE_WEIGHTED_PLUS_POS = 1, |
---|
35 | PT_MATCH_TYPE_WEIGHTED = -1 |
---|
36 | }; |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | #define MATCHANSWER 50 /* private msg type: match result answer */ |
---|
41 | #define CREATEANSWER 51 /* private msg type: create result answer */ |
---|
42 | #define FINDANSWER 52 /* private msg type: find result answer */ |
---|
43 | |
---|
44 | extern ulong physical_memory; |
---|
45 | struct Hs_struct; |
---|
46 | extern char *pt_error_buffer; |
---|
47 | |
---|
48 | typedef enum type_types_type { |
---|
49 | t_int = 1, |
---|
50 | t_string=0, |
---|
51 | t_float=2 |
---|
52 | } type_types; |
---|
53 | |
---|
54 | typedef enum PT_bases_enum { |
---|
55 | PT_QU = 0, |
---|
56 | PT_N = 1, |
---|
57 | PT_A, PT_C, PT_G, PT_T, PT_B_MAX } PT_BASES; |
---|
58 | |
---|
59 | /* POS TREE */ |
---|
60 | typedef enum enum_PT_NODE_TYPE { |
---|
61 | PT_NT_LEAF = 0, |
---|
62 | PT_NT_CHAIN = 1, |
---|
63 | PT_NT_NODE = 2, |
---|
64 | PT_NT_SINGLE_NODE = 3, /* stage 3 */ |
---|
65 | PT_NT_SAVED = 3, /* stage 1+2 */ |
---|
66 | PT_NT_UNDEF = 4 |
---|
67 | } PT_NODE_TYPE; |
---|
68 | |
---|
69 | typedef struct POS_TREE_struct { |
---|
70 | uchar flags; |
---|
71 | char data; |
---|
72 | } POS_TREE; |
---|
73 | |
---|
74 | typedef struct PTMM_struct { |
---|
75 | char *base; |
---|
76 | int stage1; |
---|
77 | int stage2; |
---|
78 | int stage3; |
---|
79 | int mode; |
---|
80 | } PTM2; |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | /* Probe search */ |
---|
85 | |
---|
86 | |
---|
87 | struct probe_statistic { |
---|
88 | int match_count; /* Counter for matches */ |
---|
89 | double rel_match_count; /* match_count / (seq_len - probe_len + 1) */ |
---|
90 | }; |
---|
91 | |
---|
92 | struct probe_input_data { /* every taxas own data */ |
---|
93 | /******* name and sequence *********/ |
---|
94 | char *data; |
---|
95 | long checksum; |
---|
96 | int size; |
---|
97 | char *name; |
---|
98 | char *fullname; |
---|
99 | GBDATA *gbd; |
---|
100 | |
---|
101 | /********* probe design ************/ |
---|
102 | int is_group; /* -1: nevermind |
---|
103 | 0: no group |
---|
104 | 1: group */ |
---|
105 | /* probe design (match) */ |
---|
106 | PT_probematch *match; /* best hit for PT_new_design */ |
---|
107 | |
---|
108 | /********* find family ************/ |
---|
109 | struct probe_statistic stat; |
---|
110 | |
---|
111 | /********* free pointer ************/ |
---|
112 | int next; |
---|
113 | }; |
---|
114 | |
---|
115 | struct probe_statistic_struct { |
---|
116 | int cut_offs; /* statistic of chains */ |
---|
117 | int single_node; |
---|
118 | int short_node; |
---|
119 | int long_node; |
---|
120 | int longs; |
---|
121 | int shorts; |
---|
122 | int shorts2; |
---|
123 | int chars; |
---|
124 | |
---|
125 | }; |
---|
126 | |
---|
127 | extern struct probe_struct_global { |
---|
128 | GBDATA *gb_main; /* ARBDB interface */ |
---|
129 | GBDATA *gb_species_data; |
---|
130 | GBDATA *gb_extended_data; |
---|
131 | char *alignment_name; |
---|
132 | GB_HASH *namehash; /* name to int */ |
---|
133 | |
---|
134 | struct probe_input_data *data; /* the internal database */ |
---|
135 | char *ecoli; /* the ecoli sequenz */ |
---|
136 | void *bi_ecoli; |
---|
137 | |
---|
138 | int data_count; |
---|
139 | int max_size; /* maximum sequence len */ |
---|
140 | long char_count; /* number of all 'acgtuACGTU' */ |
---|
141 | |
---|
142 | int mismatches; /* chain handle in match */ |
---|
143 | double wmismatches; |
---|
144 | int N_mismatches; |
---|
145 | int w_N_mismatches[PT_POS_TREE_HEIGHT+PT_POS_SECURITY+1]; |
---|
146 | |
---|
147 | int reversed; /* tell the matcher whether probe is |
---|
148 | reversed */ |
---|
149 | |
---|
150 | double *pos_to_weight; /* position to weight */ |
---|
151 | char complement[256]; /* complement */ |
---|
152 | |
---|
153 | int deep; /* for probe matching */ |
---|
154 | int height; |
---|
155 | int length; |
---|
156 | int apos; |
---|
157 | |
---|
158 | int sort_by; |
---|
159 | |
---|
160 | char *probe; /* probe design + chains */ |
---|
161 | char *main_probe; |
---|
162 | |
---|
163 | char *server_name; /* name of this server */ |
---|
164 | aisc_com *link; |
---|
165 | T_PT_MAIN main; |
---|
166 | struct Hs_struct *com_so; /* the communication socket */ |
---|
167 | POS_TREE *pt; |
---|
168 | PTM2 *ptmain; |
---|
169 | probe_statistic_struct stat; |
---|
170 | } psg; |
---|
171 | |
---|
172 | |
---|
173 | #define PT_base_string_counter_eof(str) (*(unsigned char *)(str) == 255) |
---|