91 rel_matches(rel_matches_),
94 hits_truncated(
false),
114 server_id(server_id_),
115 oligo_len(oligo_len_),
116 mismatches(mismatches_),
117 fast_flag(fast_flag_)
132 GB_ERROR PT_FamilyFinder::init_communication() {
133 const char *user =
"PT_FamilyFinder";
139 MAIN_LOCS, PT_LOCS, ci->
locs,
148 GB_ERROR PT_FamilyFinder::open(
const char *servername) {
161 if (!ci->
link) error =
"Cannot contact PT server [1]";
162 else if (init_communication()) error =
"Cannot contact PT server [2]";
172 void PT_FamilyFinder::close() {
179 GB_ERROR PT_FamilyFinder::retrieve_family(
const char *sequence,
FF_complement compl_mode,
int max_results,
double min_score) {
186 else if (!compressed_sequence[0]) error =
"No data in sequence(-region)";
189 bs.
data = compressed_sequence;
201 T_PT_FAMILYFINDER ffinder;
203 LOCS_FFINDER, PT_FAMILYFINDER, ffinder,
204 FAMILYFINDER_PROBE_LEN,
long(oligo_len),
205 FAMILYFINDER_MISMATCH_NUMBER,
long(mismatches),
206 FAMILYFINDER_FIND_TYPE,
long(fast_flag),
209 FAMILYFINDER_SORT_MAX,
long(max_results),
210 FAMILYFINDER_MIN_SCORE,
double(min_score),
211 FAMILYFINDER_COMPLEMENT,
long(compl_mode),
212 FAMILYFINDER_RANGE_STARTPOS,
long(
range.
start()),
214 FAMILYFINDER_FIND_FAMILY, &bs,
217 error =
"Communication error with PT server ('retrieve_family')";
220 char *ff_error =
NULp;
223 T_PT_FAMILYLIST f_list;
225 FAMILYFINDER_FAMILY_LIST, f_list.as_result_param(),
226 FAMILYFINDER_FAMILY_LIST_SIZE, &
real_hits,
227 FAMILYFINDER_ERROR, &ff_error,
235 if (max_results<1) max_results = INT_MAX;
238 while (f_list.exists()) {
239 if (max_results == 0) {
252 FAMILYLIST_NAME, &fl->
name,
253 FAMILYLIST_MATCHES, &fl->
matches,
255 FAMILYLIST_NEXT, f_list.as_result_param(),
262 free(compressed_sequence);
283 if (!error) error = retrieve_family(sequence, compl_mode, max_results, min_score);
292 out.
nprintf(100,
"%s/%li/%3.5f,", fl->name, fl->matches, fl->rel_matches*100);
302 int oligolen = awar_oligolen->
read_int();
303 int mismatches = awar_mismatches->
read_int();
305 if (oligolen<=mismatches) {
306 if (oligolen_changed) {
316 static bool created =
false;
334 aws->
at(
"oligo_len");
337 aws->
at(
"mismatches");
370 bool relativeMatches;
378 ff_tester(
GBDATA *gb_main_)
380 relativeMatches(
false),
388 const char *get_result(
GB_ERROR& error) {
389 int oligoLen = shortOligo ? (partial ? 3 : 6) : (partial ? 10 : 18);
390 PT_FamilyFinder ff(gb_main, TEST_SERVER_ID, oligoLen, 1, fastMode, relativeMatches, scaling);
392 const char *sequence;
394 ff.restrict_2_region(
PosRange(39, 91));
395 sequence =
"UCUAGCUUGCUAGACGGGUGGCGAG" "GGUAACCGUAGGGGA";
399 sequence =
"AGAGUUUGAUCAAGUCGAACGGCAGCACAGUCUAGCUUGCUAGACGGGUGGCGAGUGGCGAACGGACUUGGGGAAACUCAAGCUAAUACCGCAUAAUCAUGACUGGGGUGAAGUCGUAACAAGGUAGCCGUAGGGGAACCUGCGGCUGGAUCACCUCCUN";
402 error = ff.searchFamily(sequence,
FF_FORWARD, 4, min_score);
403 return ff.results2string();
408 #define TEST_RELATIVES_COMMON(tester,expctd) \
410 const char *result = tester.get_result(error); \
411 const char *expected = expctd; \
412 TEST_EXPECT_NO_ERROR(error); \
414 #define TEST_EXPECT_RELATIVES(tester,expctd) do { \
415 TEST_RELATIVES_COMMON(tester,expctd); \
416 TEST_EXPECT_EQUAL(result, expected); \
419 #define TEST_EXPECT_REL__BROK(tester,expctd) do { \
420 TEST_RELATIVES_COMMON(tester,expctd); \
421 TEST_EXPECT_EQUAL__BROKEN(result, expected); \
424 void TEST_SLOW_PT_FamilyFinder() {
436 ff_tester test(gb_main);
438 ff_tester ______RESET = test; TEST_EXPECT_RELATIVES(test,
"LgtLytic/142/97.93103,HllHalod/62/43.05556,AclPleur/59/38.06452,PtVVVulg/51/34.00000");
439 test.partial =
true; TEST_EXPECT_RELATIVES(test,
"LgtLytic/18/11.76471,VblVulni/5/3.24675,VbhChole/4/2.59740,DcdNodos/4/2.59740");
440 test.shortOligo =
true; TEST_EXPECT_RELATIVES(test,
"PtVVVulg/38/23.03030,AclPleur/38/22.35294,VbhChole/38/23.60248,VblVulni/38/23.60248");
441 test.relativeMatches =
true; TEST_EXPECT_RELATIVES(test,
"DsssDesu/38/38.77551,CltBotul/38/34.23423,PsAAAA00/38/32.75862,Bl0LLL00/38/25.67568");
442 test.min_score = 32.6; TEST_EXPECT_RELATIVES(test,
"DsssDesu/38/38.77551,CltBotul/38/34.23423,PsAAAA00/38/32.75862");
444 test.shortOligo =
true; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.08917,VbhChole/133/84.17722,VblVulni/133/84.17722,HllHalod/133/85.25641");
445 test.relativeMatches =
true; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.08917,HllHalod/133/85.25641,VbhChole/133/84.17722,VblVulni/133/84.17722");
446 test.fastMode =
true; TEST_EXPECT_RELATIVES(test,
"LgtLytic/42/26.75159,VblVulni/37/23.41772,HllHalod/36/23.07692,Stsssola/36/23.07692");
447 test.min_score = 26.7; TEST_EXPECT_RELATIVES(test,
"LgtLytic/42/26.75159");
448 test.min_score = 26.8; TEST_EXPECT_RELATIVES(test,
"");
450 test.fastMode =
true; TEST_EXPECT_RELATIVES(test,
"LgtLytic/40/27.58621,HllHalod/18/12.50000,AclPleur/17/10.96774,PtVVVulg/15/10.00000");
451 test.min_score = 17.0; TEST_EXPECT_RELATIVES(test,
"LgtLytic/40/27.58621,HllHalod/18/12.50000,AclPleur/17/10.96774");
452 test.min_score = 17.5; TEST_EXPECT_RELATIVES(test,
"LgtLytic/40/27.58621,HllHalod/18/12.50000");
455 test.shortOligo =
true;
456 test.relativeMatches =
true;
457 test.scaling =
RSS_BOTH_MAX; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.08917,HllHalod/133/85.25641,VbhChole/133/84.17722,VblVulni/133/84.17722");
458 test.scaling =
RSS_BOTH_MIN; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.71795,DsssDesu/84/88.42105,CltBotul/95/87.96296,PsAAAA00/97/85.84071");
459 test.scaling =
RSS_TARGET; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.08917,DsssDesu/84/88.42105,CltBotul/95/87.96296,PsAAAA00/97/85.84071");
460 test.scaling =
RSS_SOURCE; TEST_EXPECT_RELATIVES(test,
"LgtLytic/154/98.71795,VbhChole/133/85.25641,VblVulni/133/85.25641,HllHalod/133/85.25641");
462 test.shortOligo =
false;
463 test.scaling =
RSS_BOTH_MAX; TEST_EXPECT_RELATIVES(test,
"LgtLytic/18/11.76471,VblVulni/5/3.24675,VbhChole/4/2.59740,DcdNodos/4/2.59740");
464 test.scaling =
RSS_BOTH_MIN; TEST_EXPECT_RELATIVES(test,
"LgtLytic/18/56.25000,VblVulni/5/15.62500,VbhChole/4/12.50000,DcdNodos/4/12.50000");
465 test.scaling =
RSS_TARGET; TEST_EXPECT_RELATIVES(test,
"LgtLytic/18/11.76471,VblVulni/5/3.24675,VbhChole/4/2.59740,DcdNodos/4/2.59740");
466 test.scaling =
RSS_SOURCE; TEST_EXPECT_RELATIVES(test,
"LgtLytic/18/56.25000,VblVulni/5/15.62500,VbhChole/4/12.50000,DcdNodos/4/12.50000");
void insert_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
void AWTC_create_common_next_neighbour_fields(AW_window *aws, int scaler_length)
void delete_family_list()
GBDATA * GB_open(const char *path, const char *opent)
void cut_tail(size_t byte_count)
int aisc_close(aisc_com *link, AISC_Object &object)
#define TEST_SETUP_GLOBAL_ENVIRONMENT(modulename)
static void adjustOligolenAndMismatches(AW_root *aw_root, bool oligolen_changed)
GB_ERROR arb_look_and_start_server(long magic_number, const char *arb_tcp_env)
AW_awar * set_minmax(float min, float max)
const char * GBS_global_string(const char *templat,...)
FamilyFinder(bool rel_matches_, RelativeScoreScaling scaling_)
void update_option_menu()
GB_ERROR searchFamily(const char *sequence, FF_complement compl_mode, int max_results, double min_score) OVERRIDE __ATTR__USERESULT
#define AWAR_NN_REL_SCALING
AW_awar * add_callback(const RootCallback &cb)
#define AWAR_NN_FAST_MODE
void create_input_field_with_scaler(const char *awar_name, int textcolumns=4, int scaler_length=250, AW_ScalerType scalerType=AW_SCALER_LINEAR)
#define TEST_EXPECT_CONTAINS(str, part)
GB_ERROR GB_export_error(const char *error)
GB_ERROR GB_await_error()
const char * GBS_read_arb_tcp(const char *env)
static void error(const char *msg)
bool uses_rel_matches() const
#define RETURN_LOCAL_ALLOC(mallocation)
FamilyList * insertSortedBy_rel_matches(FamilyList *other)
const char * results2string()
void AWTC_create_common_next_neighbour_vars(AW_root *aw_root, const RootCallback &awar_changed_cb)
AW_awar * awar(const char *awar)
PT_FamilyFinder(GBDATA *gb_main_, int server_id_, int oligo_len_, int mismatches_, bool fast_flag_, bool rel_matches_, RelativeScoreScaling scaling_)
FamilyList * insertSortedBy_matches(FamilyList *other)
void insert_default_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
#define AISC_MAGIC_NUMBER
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
aisc_com * aisc_open(const char *path, AISC_Object &main_obj, long magic, GB_ERROR *error)
void nprintf(size_t maxlen, const char *templat,...) __ATTR__FORMAT_MEMBER(2)
AW_option_menu_struct * create_option_menu(const char *awar_name)
int aisc_get(aisc_com *link, int o_type, const AISC_Object &object,...)
char * GB_command_interpreter(const char *str, const char *commands, GBDATA *gb_main)
#define AWAR_NN_MISMATCHES
~PT_FamilyFinder() OVERRIDE
const char * GBS_ptserver_tag(int id)
RelativeScoreScaling get_scaling() const
GB_ERROR write_int(long aw_int)
int aisc_create(aisc_com *link, int father_type, const AISC_Object &father, int attribute, int object_type, AISC_Object &object,...)
void GB_close(GBDATA *gbd)
#define AWAR_NN_OLIGO_LEN
#define AWAR_NN_REL_MATCHES