42 double mem = bases*length*0.9*(
sizeof(
Node)+16);
48 const char *display =
NULp;
50 if (mem > 1073741824) {
51 mem = mem / 1073741824;
54 else if (mem > 1048576) {
58 else if (mem > 1024) {
69 static bool avoid_recursion =
false;
71 if (!avoid_recursion) {
72 avoid_recursion =
true;
77 if (max_length<1) max_length = 1;
78 if (min_length<1) min_length = 1;
80 if (min_length > max_length) {
81 if (max_changed) min_length = max_length;
82 else max_length = min_length;
90 avoid_recursion =
false;
121 pdrw =
new AW_window_simple;
122 pdrw->init(aww->
get_root(),
"PRD_RESULT",
"Primer Design RESULT");
123 pdrw->load_xfig(
"pd_reslt.fig");
125 pdrw->button_length(6);
126 pdrw->auto_space(10, 10);
130 pdrw->create_button(
"HELP",
"HELP",
"H");
140 pdrw->create_button(
"CLOSE",
"CLOSE",
"C");
143 pdrw->create_button(
"CLEAR",
"CLEAR",
"R");
146 pdrw->create_button(
"LOAD",
"LOAD",
"L");
149 pdrw->create_button(
"SAVE",
"SAVE",
"S");
152 pdrw->create_button(
"PRINT",
"PRINT",
"P");
161 char *sequence =
NULp;
165 if (
aw_question(
NULp,
"ARB may crash due to memory problems.",
"Continue, Abort") == 1) {
176 error =
"you have to select a species!";
186 error =
GBS_global_string(
"Selected species has no sequence data in alignment '%s'", alignment);
222 error =
"Unknown error (maybe out of memory ? )";
236 if (max_position_length < 3) max_position_length = 3;
237 if (max_length_length < 3) max_length_length = 3;
240 max_primer_length,
"Left primer",
241 max_position_length,
"Pos",
242 max_length_length,
"Len",
243 max_primer_length,
"Right primer",
244 max_position_length,
"Pos",
245 max_length_length,
"Len"),
251 const char *primers =
NULp;
252 const char *
result = PD->
get_result(r, primers, max_primer_length, max_position_length, max_length_length);
254 resultList->
insert(result, primers);
257 resultList->
insert_default(r ?
"**** End of list" :
"**** There are no results",
"");
263 if (sequence) free(sequence);
272 if (temp > 100) temp = 100;
273 if (temp < 0) temp = 0;
282 if (gc > 100) gc = 100;
293 char *selected_species =
NULp;
294 char *selected_gene =
NULp;
301 if (is_genom_db && from_gene) {
314 error =
"You have to select a species!";
324 error =
GB_export_errorf(
"Species '%s' has no data in alignment '%s'", selected_species, alignment);
330 if (!error && from_gene) {
335 error =
GB_export_errorf(
"Species '%s' has no gene named '%s'", selected_species, selected_gene);
348 if (!error && gb_seq) {
352 char *sequence =
NULp;
361 length = gene_length;
368 length = strlen(sequence);
379 if (left_len == 0 || left_len<0) left_len = 100;
392 if (right_len == 0 || right_len<0) right_len = 100;
406 if (right_min >= left_max) {
408 long int bases_between = 0;
410 dist_min = bases_between;
413 dist_min = right_min - left_min + 1;
415 dist_max = right_max - left_min;
419 #if defined(DUMP_PRIMER)
420 printf (
"primer_design_event_init : left_min %7li\n", left_min);
421 printf (
"primer_design_event_init : left_max %7li\n", left_max);
422 printf (
"primer_design_event_init : right_min %7li\n", right_min);
423 printf (
"primer_design_event_init : right_max %7li\n", right_max);
424 printf (
"primer_design_event_init : dist_min %7li\n", dist_min);
425 printf (
"primer_design_event_init : dist_max %7li\n\n", dist_max);
438 free(selected_species);
476 AW_window_simple *aws =
new AW_window_simple;
477 aws->init(root,
"PRIMER_DESIGN",
"PRIMER DESIGN");
479 aws->load_xfig(
"prd_main.fig");
483 aws->create_button(
"CLOSE",
"CLOSE",
"C");
487 aws->create_button(
"HELP",
"HELP",
"H");
491 aws->create_button(
"INIT_FROM_SPECIES",
"Species",
"I");
496 aws->create_button(
"INIT_FROM_GENE",
"Gene",
"I");
501 aws->create_button(
"GO",
"GO",
"G");
531 aws->at(
"expand_IUPAC");
534 aws->at(
"GC_factor");
538 aws->at(
"temp_factor");
545 aws->at(
"aprox_mem");
546 aws->button_length(11);
const char * get_result(int num, const char *&primers, int max_primer_length, int max_position_length, int max_length_length) const
#define AWAR_PRIMER_DESIGN_GC_FACTOR
static void create_primer_design_result_window(AW_window *aww)
#define AWAR_PRIMER_DESIGN_ALLOWED_MATCH_MIN_DIST
return string(buffer, length)
void GEN_free_position(GEN_position *pos)
static void primer_design_event_init(AW_window *aww, GBDATA *gb_main, bool from_gene)
const TypedSelectionList & get_typedsellist() const
void insert_default(const char *displayed, const AW_scalar &value)
GBDATA * GEN_find_gene(GBDATA *gb_species, const char *name)
static void primer_design_event_check_primer_length(AW_root *root, bool max_changed)
#define AWAR_ORGANISM_NAME
void awt_clear_selection_list_cb(AW_window *, AW_selection_list *sellist)
static void primer_design_event_check_gc_factor(AW_window *aww)
void create_primer_design_variables(AW_root *aw_root, AW_default aw_def, AW_default global)
void AWT_insert_config_manager(AW_window *aww, AW_default default_file_, const char *id, const StoreConfigCallback &store_cb, const RestoreConfigCallback &load_or_reset_cb, const char *macro_id, const AWT_predefined_config *predef)
#define AWAR_PRIMER_DESIGN_GCRATIO_MIN
#define AWAR_PRIMER_DESIGN_LEFT_POS
const char * GBS_global_string(const char *templat,...)
void AW_POPDOWN(AW_window *window)
static AW_window_simple * pdrw
AW_window * create_primer_design_window(AW_root *root, GBDATA *gb_main)
#define AWAR_PRIMER_DESIGN_MAX_PAIRS
#define AWAR_PRIMER_DESIGN_RIGHT_POS
#define AWAR_PRIMER_DESIGN_EXPAND_IUPAC
AW_awar * add_callback(const RootCallback &cb)
void insert(const char *displayed, const AW_scalar &value)
#define AWAR_PRIMER_DESIGN_LEFT_LENGTH
GB_ERROR GB_await_error()
void restart(PRD_Sequence_Pos start_pos_, PRD_Sequence_Pos stop_pos_, int max_length_, int direction_)
WindowCallback makeHelpCallback(const char *helpfile)
long GB_read_count(GBDATA *gbd)
static AW_selection_list * resultList
#define AWAR_PRIMER_DESIGN_APROX_MEM
#define AWAR_PRIMER_DESIGN_TEMPERATURE_MAX
static void error(const char *msg)
static double get_estimated_memory(AW_root *root)
#define AWAR_PRIMER_TARGET_STRING
void create_print_box_for_selection_lists(AW_window *aw_window, const TypedSelectionList *typedsellist)
static void primer_design_event_go(AW_window *aww, GBDATA *gb_main)
#define AWAR_SPECIES_NAME
char * read_string() const
AW_awar * awar(const char *awar)
GBDATA * GBT_find_sequence(GBDATA *gb_species, const char *aliname)
AW_window * create_load_box_for_selection_lists(AW_root *aw_root, const StorableSelectionList *storabsellist)
int aw_question(const char *unique_id, const char *question, const char *buttons, bool sameSizeButtons, const char *helpfile)
PRD_Sequence_Pos get_max_primer_pos() const
GB_ULONG GB_get_usable_memory(void)
GB_ERROR GB_export_errorf(const char *templat,...)
#define AWAR_PRIMER_DESIGN_TEMPERATURE_MIN
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
GB_ERROR get_error() const
static const int BACKWARD
#define AWAR_PRIMER_DESIGN_LENGTH_MAX
#define AWAR_PRIMER_DESIGN_DIST_MIN
char * GB_read_string(GBDATA *gbd)
AW_window * create_save_box_for_selection_lists(AW_root *aw_root, const StorableSelectionList *storabsellist)
const char * GBS_static_string(const char *str)
void aw_message(const char *msg)
#define AWAR_PRIMER_DESIGN_TEMP_FACTOR
#define AWAR_PRIMER_DESIGN_LENGTH_MIN
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
#define AWAR_PRIMER_DESIGN_RIGHT_LENGTH
GB_ERROR write_string(const char *aw_string)
char * GBT_get_default_alignment(GBDATA *gb_main)
static void primer_design_event_update_memory(AW_root *root)
GB_transaction ta(gb_var)
static void primer_design_event_check_temp_factor(AW_window *aww)
long int PRD_Sequence_Pos
PRD_Sequence_Pos get_max_primer_length() const
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
NOT4PERL char * GBT_read_gene_sequence_and_length(GBDATA *gb_gene, bool use_revComplement, char partSeparator, size_t *gene_length)
bool GEN_is_genome_db(GBDATA *gb_main, int default_value)
GEN_position * GEN_read_position(GBDATA *gb_gene)
static AWT_config_mapping_def primer_design_config_mapping[]
#define AWAR_PRIMER_DESIGN_DIST_MAX
GB_ERROR write_int(long aw_int)
#define AWAR_PRIMER_DESIGN_GCRATIO_MAX
GB_write_int const char s