42 "NONPAIRING HELIX$#D52B69",
45 "ECOLI POSITION$#FFE223",
46 "HELIX NUMBERS$#D4D4D4",
49 "+-RANGE 0$#FFFFFF",
"+-RANGE 1$#E0E0E0",
"-RANGE 2$#C0C0C0",
50 "+-RANGE 3$#A0A0A0",
"+-RANGE 4$#909090",
"-RANGE 5$#808080",
51 "+-RANGE 6$#808080",
"+-RANGE 7$#505050",
"-RANGE 8$#404040",
52 "+-RANGE 9$#303030",
"+-CURSOR$#BF1515",
"-MISMATCHES$#FF9AFF",
56 "+-User1$#B8E2F8",
"+-User2$#B8E2F8",
"-Probe$#B8E2F8",
57 "+-Primer(l)$#A9FE54",
"+-Primer(r)$#A9FE54",
"-Primer(g)$#A9FE54",
58 "+-Sig(l)$#DBB0FF",
"+-Sig(r)$#DBB0FF",
"-Sig(g)$#DBB0FF",
61 "+-SKELETON HELIX${HELIX}",
"+-SKELETON LOOP${LOOP}",
"-SKELETON NONHELIX${NONPAIRING HELIX}",
74 constraint_type =
"length";
75 element_type =
"helix";
78 constraint_type =
"radius";
79 element_type =
"loop";
83 error =
"Illegal element type";
93 double low = strtod(answer, &end);
96 error =
"Wrong format! Wanted format is 'lower-upper'";
99 double high = strtod(end+1,
NULp);
101 if (low<0 || high<0 || (low && high && low>high)) {
102 error =
"Illegal values";
116 char *retry =
aw_input(question, answer);
133 int curpos = sec_root->get_cursor();
134 int maxIndex = sec_root->max_index();
135 bool setCurpos =
false;
136 bool handled =
false;
150 if (sec_root->shallDisplayPosition(curpos)) {
160 if (curpos > maxIndex) {
165 if (sec_root->shallDisplayPosition(curpos)) {
173 const char *toggle_awar =
NULp;
196 error = sec_root->get_db()->structure()->next();
202 AW_awar *awar = aw_root->awar(toggle_awar);
205 if (val>val_max) val = 0;
226 memset((
char*)&faked_event, 0,
sizeof(faked_event));
228 faked_event.
type = event;
230 faked_event.
keycode = key_code;
233 sec_root->host().forward_event(&faked_event);
252 SEC_loop *loop =
NULp;
253 SEC_helix *helix =
NULp;
256 helix =
static_cast<SEC_helix*
>(elem);
260 loop =
static_cast<SEC_loop*
>(elem);
267 static double start_size;
273 sec_root->set_show_constraints(elem->
getType());
274 exports.request_refresh();
279 exports.request_save();
285 double dfix1 =
Distance(fixpoint, start);
286 double dfix2 =
Distance(fixpoint, world);
288 if (dfix1>0 && dfix2>0) {
289 double factor = dfix2/dfix1;
290 double new_size = start_size*factor;
295 exports.request_refresh();
302 exports.request_save();
314 exports.request_save();
321 exports.request_save();
324 static Angle startClick;
325 static bool rotateSubStructure;
326 static vector<Angle> old;
328 if (loop && loop->is_root_loop()) fixpoint = loop->get_center();
330 Angle fix2world(fixpoint, world);
333 startClick = fix2world;
338 old.push_back(loop->get_abs_angle());
339 if (!rotateSubStructure) {
341 if (strand->isRootsideFixpoint()) {
342 old.push_back(strand->get_helix()->get_abs_angle());
348 old.push_back(helix->get_abs_angle());
349 old.push_back(helix->outsideLoop()->get_abs_angle());
357 loop->set_abs_angle(old[0]+diff);
358 if (!rotateSubStructure) {
361 if (strand->isRootsideFixpoint()) {
362 strand->get_helix()->set_abs_angle(old[idx++]);
368 helix->set_abs_angle(old[0]+diff);
369 if (!rotateSubStructure) helix->outsideLoop()->set_abs_angle(old[1]);
372 exports.request_refresh();
383 sec_root->set_root(loop);
384 exports.request_save();
386 else error =
"Please click on a loop to change the root";
392 exports.request_save();
400 const char *helix_nr = sec_root->helixNrAt(abspos);
402 const size_t *p = sec_root->getHelixPositions(helix_nr);
403 error = sec_root->split_loop(p[0], p[1]+1, p[2], p[3]+1);
406 sec_root->nail_position(abspos);
407 exports.request_save();
415 error =
"Click on a loop region to fold a helix";
422 error = sec_root->unsplit_loop(helix->strandToRoot());
424 sec_root->nail_position(abspos);
425 exports.request_save();
429 error =
"Right click on a helix to remove it";
436 drag_target_detection(
true);
437 if (abspos >= 0 &&
size_t(abspos) < sec_root->max_index()) {
446 if (abspos >= 0 &&
size_t(abspos) < sec_root->max_index()) {
447 sec_root->paintSearchPatternStrings(device, abspos, world.
xpos()+1, world.
ypos());
453 exports.request_refresh();
469 error = handleKey(event.
type(),
event.key_modifier(),
event.key_code(),
event.key_char());
474 static int abspos = -1;
476 bool updateClicked =
false;
480 updateClicked =
true;
487 elem =
reinterpret_cast<SEC_base*
>(clicked->
cd1());
488 abspos = clicked->
cd2();
497 error = handleMouse(device, event.
type(),
event.button(),
event.cmd(), world, elem, abspos);
507 SEC_graphic::SEC_graphic(
AW_root *aw_rooti,
GBDATA *gb_maini)
518 exports.set_standard_default_padding();
521 SEC_graphic::~SEC_graphic() {
530 gfx->gb_struct =
NULp;
531 gfx->gb_struct_ref =
NULp;
544 sec_root->nail_cursor();
586 else if (ali_len < 10) {
592 err =
GBS_global_string(
"Your helix structure template '%s' has no valid sequence for alignment '%s'", name, ali_name);
613 err = sec_root->read_data(strct, ref);
617 #if defined(CHECK_INTEGRITY)
619 sec_root->check_integrity(CHECK_STRUCTURE);
621 #endif // CHECK_INTEGRITY
628 sec_root->get_db()->init_toggler();
632 err =
"no secondary structure was found in your database";
639 GBDATA *gb_add = gb_struct;
648 while (gb_add && !err);
656 freenull(load_error);
657 exports.request_zoom_reset();
662 exports.request_zoom_reset();
675 if (!gb_struct)
return NULp;
676 if (!sec_root)
return NULp;
678 char *data = sec_root->buildStructureString();
682 const XString& xstr = sec_root->get_xString();
688 aw_message(
"Your helix needs one gap at end. Please format your alignment!");
699 GB_ERROR SEC_graphic::read_data_from_db(
char **data,
char **x_string)
const {
712 GB_ERROR SEC_graphic::write_data_to_db(
const char *data,
const char *x_string)
const {
713 if (!gb_struct)
return NULp;
714 if (!sec_root)
return NULp;
725 void SEC_graphic::check_for_DB_update(
GBDATA *) {
728 void SEC_graphic::update_structure() {
745 sec_root->update_shown_positions();
751 sec_root->invalidate_base_positions();
752 sec_root->relayout();
755 exports.request_refresh();
758 sec_root->perform_autoscroll();
762 void SEC_graphic::notify_synchronized(
GBDATA *) {
766 void SEC_graphic::show(
AW_device *device) {
767 const char *textToDisplay =
NULp;
770 sec_root->clear_last_drawed_cursor_position();
772 if (sec_root->canDisplay()) {
773 if (sec_root->get_root_loop()) {
774 GB_ERROR paint_error = sec_root->paint(device);
779 else textToDisplay =
"No structure loaded (yet)";
785 if (!db) textToDisplay =
"Not connected to database";
786 else if (!db->
helix()) textToDisplay =
"No helix info";
787 else textToDisplay =
"No species selected";
#define AWAR_SECEDIT_SHOW_CURPOS
const AW_bitset AW_SCREEN
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
GB_ERROR GB_add_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
#define AWAR_SECEDIT_DISPLAY_SEARCH
GBDATA * GB_nextEntry(GBDATA *entry)
virtual void reset_angles()=0
char * ARB_strdup(const char *str)
const char * GBS_global_string(const char *templat,...)
long GBT_get_alignment_len(GBDATA *gb_main, const char *aliname)
virtual SEC_BASE_TYPE getType() const =0
AW_MouseButton button() const
AW_gc_manager * AW_manage_GC(AW_window *aww, const char *gc_base_name, AW_device *device, int base_drag, AW_GCM_AREA area, const GcChangedCallback &changecb, const char *default_background_color,...)
static void SEC_structure_changed_cb(GBDATA *gb_seq, SEC_graphic *gfx, GB_CB_TYPE type)
GB_ERROR GB_delete(GBDATA *&source)
static HelixNrInfo * start
const AW::Position & position() const
GBDATA * GBT_find_SAI(GBDATA *gb_main, const char *name)
GB_ERROR GB_await_error()
static int diff(int v1, int v2, int v3, int v4, int st, int en)
const double & ypos() const
const char * get_gc_base_name() const
ValueCounter< double > Distance
const char * get_x_string() const
#define AWAR_SECEDIT_SHOW_STR_SKELETON
AW::Vector rtransform(const AW::Vector &vec) const
static void error(const char *msg)
#define AWAR_SECEDIT_HIDE_BASES
char * GBT_readOrCreate_string(GBDATA *gb_container, const char *fieldpath, const char *default_value)
#define AWAR_SECEDIT_SHOW_DEBUG
#define AWAR_SECEDIT_SHOW_ECOLI_POS
#define AWAR_SET_CURSOR_POSITION
#define AWAR_SECEDIT_SHOW_BONDS
#define AWAR_SECEDIT_SHOW_HELIX_NRS
bool GB_has_key(GBDATA *gbd, const char *key)
static GB_ERROR change_constraints(SEC_base *elem)
bool alignment_too_short() const
virtual void orientationChanged()=0
GB_ERROR close(GB_ERROR error)
virtual const Position & get_fixpoint() const =0
AWT_COMMAND_MODE cmd() const
void setConstraints(double low, double high)
char * GB_read_string(GBDATA *gbd)
#define AWAR_SECEDIT_DISPLAY_SAI
void GB_remove_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
#define AWAR_SECEDIT_DISPPOS_ECOLI
#define NAME_OF_STRUCT_SEQ
void aw_message(const char *msg)
AW_event_type type() const
long GB_read_clock(GBDATA *gbd)
const double & xpos() const
char * GBT_get_default_helix(GBDATA *)
char * GBT_get_default_alignment(GBDATA *gb_main)
GB_transaction ta(gb_var)
virtual void sizeChanged()=0
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
void setDrawnSize(double size)
char * aw_input(const char *title, const char *prompt, const char *default_input)
GB_ERROR write_int(long aw_int)
bool text(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment=0.0, AW_bitset filteri=AW_ALL_DEVICES_UNSCALED)
char * GBS_global_string_copy(const char *templat,...)
#define AWAR_SECEDIT_DISPPOS_BINDING
void AWT_GC_changed_cb(GcChange whatChanged, AWT_canvas *scr)