13 int ALI_PT::init_communication() {
17 MAIN_LOCS, PT_LOCS, locs,
26 char *ALI_PT::get_family_member(
char *specifiedfamily,
unsigned long number) {
27 char *ptr = specifiedfamily;
31 while (number > 0 && *ptr !=
'\0' && *ptr !=
';') {
32 while (*ptr !=
'\0' && *ptr !=
';' && *ptr !=
',')
39 if (*ptr !=
'\0' && *ptr !=
';') {
41 while (*end !=
'\0' && *end !=
',' && *end !=
';')
44 buffer = dest = (
char *)
CALLOC((
unsigned int) (end - ptr) + 1,
sizeof(
char));
56 char *ALI_PT::get_extension_member(
char *specifiedfamily,
unsigned long number) {
57 char *ptr = specifiedfamily;
61 while (*ptr !=
'\0' && *ptr !=
';')
66 while (number > 0 && *ptr !=
'\0') {
67 while (*ptr !=
'\0' && *ptr !=
',')
76 while (*end !=
'\0' && *end !=
',')
79 buffer = dest = (
char *)
CALLOC((
unsigned int) (end - ptr) + 1,
sizeof(
char));
93 int ALI_PT::open(
char *servername) {
119 if (init_communication()) {
120 ali_message (
"Cannot contact Probe bank server (2)");
127 void ALI_PT::close() {
141 extension_list =
NULp;
149 specified_family =
NULp;
162 if (family_list && !family_list->
is_empty()) {
163 delete family_list->
first();
165 delete family_list->
next();
168 if (extension_list && !extension_list->
is_empty()) {
169 delete extension_list->
first();
171 delete extension_list->
next();
172 delete extension_list;
178 unsigned long number;
179 int matches, max_matches;
181 T_PT_FAMILYLIST f_list;
200 T_PT_FAMILYFINDER ffinder;
202 LOCS_FFINDER, PT_FAMILYFINDER, ffinder,
203 FAMILYFINDER_FIND_TYPE, (
long)find_type,
204 FAMILYFINDER_FIND_FAMILY, &bs,
212 aisc_get(link, PT_FAMILYFINDER, ffinder,
213 FAMILYFINDER_FAMILY_LIST, f_list.as_result_param(),
215 if (!f_list.exists())
216 ali_error(
"Family not found in PT Server");
218 aisc_get(link, PT_FAMILYLIST, f_list,
219 FAMILYLIST_NAME, &seq_name,
220 FAMILYLIST_MATCHES, &matches,
221 FAMILYLIST_NEXT, f_list.as_result_param(),
224 while (strcmp(seq_name, sequence->
name()) == 0) {
226 if (!f_list.exists())
227 ali_error(
"Family too small in PT Server");
228 aisc_get(link, PT_FAMILYLIST, f_list,
229 FAMILYLIST_NAME, &seq_name,
230 FAMILYLIST_MATCHES, &matches,
231 FAMILYLIST_NEXT, f_list.as_result_param(),
237 max_matches = matches;
244 if (!f_list.exists())
245 ali_error(
"Family too small in PT Server");
246 aisc_get(link, PT_FAMILYLIST, f_list,
247 FAMILYLIST_NAME, &seq_name,
248 FAMILYLIST_MATCHES, &matches,
249 FAMILYLIST_NEXT, f_list.as_result_param(),
251 if (strcmp(seq_name, sequence->
name()) == 0)
253 }
while (strcmp(seq_name, sequence->
name()) == 0);
254 }
while (number < fam_list_max &&
255 (
float) matches / (float) max_matches > percent_min);
259 while (number < ext_list_max) {
264 if (!f_list.exists())
265 ali_error(
"Family too small in PT Server");
266 aisc_get(link, PT_FAMILYLIST, f_list,
267 FAMILYLIST_NAME, &seq_name,
268 FAMILYLIST_MATCHES, &matches,
269 FAMILYLIST_NEXT, f_list.as_result_param(),
271 if (strcmp(seq_name, sequence->
name()) == 0)
273 }
while (strcmp(seq_name, sequence->
name()) == 0);
278 while ((species = get_family_member(specified_family, number))) {
289 while ((species = get_extension_member(specified_family, number))) {
290 pt_member =
new ali_pt_member(species, (
int) (matches_min * percent_min) - 1);
315 ret = extension_list;
316 extension_list =
NULp;
void ali_out_of_memory_if(bool cond)
int aisc_close(aisc_com *link, AISC_Object &object)
int find_family(ALI_SEQUENCE *sequence, int find_type=1)
char * ARB_strdup(const char *str)
GB_ERROR arb_look_and_start_server(long magic_number, const char *arb_tcp_env)
char buffer[MESSAGE_BUFFERSIZE]
ALI_PT(ALI_PT_CONTEXT *context)
GB_ERROR GB_await_error()
void * CALLOC(long i, long j)
const char * GBS_read_arb_tcp(const char *env)
void ali_error(const char *message, const char *func)
ALI_TLIST< ali_pt_member * > * get_family_list()
#define AISC_MAGIC_NUMBER
ALI_TLIST< ali_pt_member * > * get_extension_list()
void ali_fatal_error(const char *message, const char *func)
unsigned long ext_list_max
GB_CSTR GB_getenvUSER(void)
aisc_com * aisc_open(const char *path, AISC_Object &main_obj, long magic, GB_ERROR *error)
void ali_message(const char *message)
int aisc_get(aisc_com *link, int o_type, const AISC_Object &object,...)
char * use_specified_family
unsigned long fam_list_max
int aisc_create(aisc_com *link, int father_type, const AISC_Object &father, int attribute, int object_type, AISC_Object &object,...)