| 68 | | char *servername, *match_name, *match_mismatches, *match_wmismatches; |
| 69 | | char toksep[2]; |
| 70 | | T_PT_PDC pdc; |
| 71 | | T_PT_MATCHLIST match_list; |
| 72 | | char *probe = NULL; |
| 73 | | char *locs_error; |
| 74 | | long match_list_cnt; |
| 75 | | bytestring bs; |
| 76 | | MO_Mismatch** ret_list=NULL; |
| 77 | | int i = 0; |
| 78 | | |
| 79 | | if( !(servername=(char *)MP_probe_pt_look_for_server()) ){ |
| 80 | | return NULL; |
| 81 | | } |
| 82 | | |
| 83 | | mp_pd_gl.link = (aisc_com *)aisc_open(servername, &mp_pd_gl.com,AISC_MAGIC_NUMBER); |
| 84 | | freeset(servername, 0); |
| 85 | | |
| 86 | | if (!mp_pd_gl.link) { |
| 87 | | aw_message ("Cannot contact Probe bank server "); |
| 88 | | return NULL; |
| 89 | | } |
| 90 | | if (MP_init_local_com_struct() ) { |
| 91 | | aw_message ("Cannot contact Probe bank server (2)"); |
| 92 | | return NULL; |
| 93 | | } |
| 94 | | |
| 95 | | aisc_create(mp_pd_gl.link,PT_LOCS, mp_pd_gl.locs,LOCS_PROBE_DESIGN_CONFIG, PT_PDC, &pdc, NULL); |
| 96 | | |
| 97 | | if (MP_probe_design_send_data(pdc)) { |
| 98 | | aw_message ("Connection to PT_SERVER lost (3)"); |
| 99 | | return NULL; |
| 100 | | } |
| 101 | | |
| 102 | | //aw_message("Running DB-query"); |
| 103 | | |
| 104 | | if (aisc_put(mp_pd_gl.link,PT_LOCS, mp_pd_gl.locs, |
| 105 | | LOCS_MATCH_REVERSED, match_kompl, // Komplement |
| 106 | | LOCS_MATCH_SORT_BY, match_weight, // Weighted |
| 107 | | LOCS_MATCH_COMPLEMENT, 0, // ??? |
| 108 | | LOCS_MATCH_MAX_MISMATCHES, match_mis, // Mismatches |
| 109 | | LOCS_MATCH_MAX_SPECIES, 100000, // ??? |
| 110 | | LOCS_SEARCHMATCH, match_seq, // Sequence |
| 111 | | NULL)){ |
| 112 | | free(probe); |
| 113 | | aw_message ("Connection to PT_SERVER lost (4)"); |
| 114 | | return NULL; |
| 115 | | } |
| 116 | | |
| 117 | | bs.data = 0; |
| 118 | | aisc_get( mp_pd_gl.link, PT_LOCS, mp_pd_gl.locs, |
| 119 | | LOCS_MATCH_LIST, &match_list, |
| 120 | | LOCS_MATCH_LIST_CNT, &match_list_cnt, |
| 121 | | LOCS_MP_MATCH_STRING, &bs, |
| 122 | | LOCS_ERROR, &locs_error, |
| 123 | | NULL); |
| 124 | | if (*locs_error) { |
| 125 | | aw_message(locs_error); |
| 126 | | } |
| 127 | | free(locs_error); |
| 128 | | |
| 129 | | toksep[0] = 1; |
| 130 | | toksep[1] = 0; |
| 131 | | if (bs.data) |
| 132 | | { |
| 133 | | ret_list = new MO_Mismatch*[match_list_cnt]; |
| 134 | | |
| 135 | | match_name = strtok(bs.data, toksep); |
| 136 | | match_mismatches = strtok(0, toksep); |
| 137 | | match_wmismatches = strtok(0, toksep); |
| 138 | | |
| 139 | | while (match_name && match_mismatches && match_wmismatches) |
| | 68 | MO_Mismatch **ret_list = NULL; |
| | 69 | const char *servername = MP_probe_pt_look_for_server(); |
| | 70 | |
| | 71 | if (servername) { |
| | 72 | char *match_name, *match_mismatches, *match_wmismatches; |
| | 73 | char toksep[2]; |
| | 74 | T_PT_PDC pdc; |
| | 75 | T_PT_MATCHLIST match_list; |
| | 76 | char *probe = NULL; |
| | 77 | char *locs_error; |
| | 78 | long match_list_cnt; |
| | 79 | bytestring bs; |
| | 80 | int i = 0; |
| | 81 | |
| | 82 | mp_pd_gl.link = (aisc_com *)aisc_open(servername, &mp_pd_gl.com,AISC_MAGIC_NUMBER); |
| | 83 | |
| | 84 | if (!mp_pd_gl.link) { |
| | 85 | aw_message("Cannot contact Probe bank server "); |
| | 86 | return NULL; |
| | 87 | } |
| | 88 | if (MP_init_local_com_struct() ) { |
| | 89 | aw_message ("Cannot contact Probe bank server (2)"); |
| | 90 | return NULL; |
| | 91 | } |
| | 92 | |
| | 93 | aisc_create(mp_pd_gl.link,PT_LOCS, mp_pd_gl.locs,LOCS_PROBE_DESIGN_CONFIG, PT_PDC, &pdc, NULL); |
| | 94 | |
| | 95 | if (MP_probe_design_send_data(pdc)) { |
| | 96 | aw_message ("Connection to PT_SERVER lost (3)"); |
| | 97 | return NULL; |
| | 98 | } |
| | 99 | |
| | 100 | //aw_message("Running DB-query"); |
| | 101 | |
| | 102 | if (aisc_put(mp_pd_gl.link,PT_LOCS, mp_pd_gl.locs, |
| | 103 | LOCS_MATCH_REVERSED, match_kompl, // Komplement |
| | 104 | LOCS_MATCH_SORT_BY, match_weight, // Weighted |
| | 105 | LOCS_MATCH_COMPLEMENT, 0, // ??? |
| | 106 | LOCS_MATCH_MAX_MISMATCHES, match_mis, // Mismatches |
| | 107 | LOCS_MATCH_MAX_SPECIES, 100000, // ??? |
| | 108 | LOCS_SEARCHMATCH, match_seq, // Sequence |
| | 109 | NULL)){ |
| | 110 | free(probe); |
| | 111 | aw_message ("Connection to PT_SERVER lost (4)"); |
| | 112 | return NULL; |
| | 113 | } |
| | 114 | |
| | 115 | bs.data = 0; |
| | 116 | aisc_get( mp_pd_gl.link, PT_LOCS, mp_pd_gl.locs, |
| | 117 | LOCS_MATCH_LIST, &match_list, |
| | 118 | LOCS_MATCH_LIST_CNT, &match_list_cnt, |
| | 119 | LOCS_MP_MATCH_STRING, &bs, |
| | 120 | LOCS_ERROR, &locs_error, |
| | 121 | NULL); |
| | 122 | if (*locs_error) { |
| | 123 | aw_message(locs_error); |
| | 124 | } |
| | 125 | free(locs_error); |
| | 126 | |
| | 127 | toksep[0] = 1; |
| | 128 | toksep[1] = 0; |
| | 129 | if (bs.data) |
| 153 | | i++; |
| 154 | | } |
| 155 | | } |
| 156 | | else |
| 157 | | aw_message("No matching species found."); |
| 158 | | |
| 159 | | *number_of_species = match_list_cnt; |
| 160 | | |
| 161 | | aisc_close(mp_pd_gl.link); |
| 162 | | free(bs.data); |
| 163 | | |
| 164 | | |
| 165 | | |
| | 137 | while (match_name && match_mismatches && match_wmismatches) |
| | 138 | { |
| | 139 | ret_list[i] = new MO_Mismatch; |
| | 140 | ret_list[i]->nummer = convert->get_index_by_entry(match_name); |
| | 141 | if (match_weight == NON_WEIGHTED) |
| | 142 | ret_list[i]->mismatch = atof(match_mismatches); |
| | 143 | else // WEIGHTED und WEIGHTED_PLUS_POS |
| | 144 | ret_list[i]->mismatch = atof(match_wmismatches); |
| | 145 | |
| | 146 | |
| | 147 | match_name = strtok(0, toksep); |
| | 148 | match_mismatches = strtok(0, toksep); |
| | 149 | match_wmismatches = strtok(0, toksep); |
| | 150 | |
| | 151 | i++; |
| | 152 | } |
| | 153 | } |
| | 154 | else |
| | 155 | aw_message("No matching species found."); |
| | 156 | |
| | 157 | *number_of_species = match_list_cnt; |
| | 158 | |
| | 159 | aisc_close(mp_pd_gl.link); |
| | 160 | free(bs.data); |
| | 161 | |
| | 162 | } |