28 #define AWAR_HELIX_REFRESH "tmp/Helix/refresh" // used to trigger client refreshes
29 #define AWAR_HELIX_ENABLE "Helix/enable"
30 #define HELIX_AWAR_SYMBOL_TEMPLATE "Helix/symbols/%s"
31 #define HELIX_AWAR_PAIR_TEMPLATE "Helix/pairs/%s"
57 size_t size2 = strlen(sequence);
59 char *helix = ARB_calloc<char>(
size()+1);
60 for (
size_t i=0; i<size2; i++) {
63 char sym =
get_symbol(sequence[i], sequence[j]);
64 helix[i] = sym ==
' ' ? undefsymbol : sym;
67 helix[i] = undefsymbol;
86 for (
int j=0; helix_awars[j].
awar; j++) {
97 static bool recursion =
false;
107 while (pairdef_in[i] ==
' ') ++i;
108 char left = toupper(pairdef_in[i++]);
if (!left)
break;
110 if (!pairdef_out.
empty()) {
111 pairdef_out.
put(
' ');
113 pairdef_out.
put(left);
115 while (pairdef_in[i] ==
' ') ++i;
116 char right = toupper(pairdef_in[i++]);
if (!right)
break;
118 pairdef_out.
put(right);
126 for (
int pass = 1; pass<=2; ++pass) {
127 const char *data = pairdef_out.
get_data();
130 const char *found = strstr(data, pair);
134 if (found == data+pos-2)
break;
137 size_t found_pos = found-data;
138 pairdef_out.
cut(found_pos, 3);
145 for (
int j = 0; helix_awars[j].
awar; j++) {
146 if (j != changed_idx) {
150 bool modified =
false;
152 for (
int k = 0; ; k += 3) {
153 char l = toupper(pd2[k]);
if (!l)
break;
156 char r = toupper(pd2[k+1]);
164 if ((left == l && right == r) || (left == r && right == l)) {
171 if (!pd2[k+2])
break;
175 int endS = dst>0 ? dst-1 : dst;
200 for (
int j=0; helix_awars[j].
awar; j++) {
216 for (
int j=0; helix_awars[j].
awar; j++) {
219 const char *name = helix_awars[j].
awar;
229 "Traditional helix settings used up to arb 7.0\n(GG is defined as \"No pair\" here)\n",
230 "Default_symbol='';No_Pair='AA AC CC CT CU GG TU';No_Pair_symbol='#';Normal_Pair='GT GU';Normal_Pair_symbol='-';Strong_Pair='CG AT AU';Strong_Pair_symbol='~';"
231 "User_Pair='.A .C .G .T .U';User_Pair2='-A -C -G -T -U';User_Pair2_symbol='#';User_Pair3='UU TT';User_Pair3_symbol='+';"
232 "User_Pair4='';User_Pair4_symbol='';User_Pair5='';User_Pair5_symbol='';User_Pair6='';User_Pair6_symbol='';User_Pair_symbol='*';Weak_Pair='GA';Weak_Pair_symbol='=';enable='1'" },
233 {
"*IUPAC_ambiguity_best",
234 "Base pairings using ambiguity codes.\nUses best case, i.e. strongest of possible bonds.\nNote: most combinations form a strong bond \nfollowing that approach. They are NOT explicitely \nlisted, instead they use the default symbol.",
235 "Default_symbol='~';No_Pair='AA AC CC CT CU TT UU';No_Pair_symbol='#';Normal_Pair='GT GU';Normal_Pair_symbol='-';Strong_Pair='CG AT AU';Strong_Pair_symbol='~';"
236 "User_Pair='.A .C .G .T .U .M .R .W .S .Y .K .V .H .D .B .N';User_Pair2='-A -C -G -T -U -M -R -W -S -Y -K -V -H -D -B -N';User_Pair2_symbol='#';User_Pair3='-- .. -.';User_Pair3_symbol='';"
237 "User_Pair4='AM CH CM CW CY MM TY UY YY';User_Pair4_symbol='#';User_Pair5='AR AS AV GR RR';User_Pair5_symbol='=';User_Pair6='BT BU DG GK GW KK KT KU ST SU SW';User_Pair6_symbol='-';User_Pair_symbol='*';Weak_Pair='GA GG';Weak_Pair_symbol='=';enable='1'" },
238 {
"*IUPAC_ambiguity_mean",
239 "Base pairings using ambiguity codes.\nUses mean of possible bonds.\nNote: most combinations form a normal bond \nfollowing that approach. They are NOT explicitely \nlisted, instead they use the default symbol.",
240 "Default_symbol='=';No_Pair='AA AC CC CT CU TT UU';No_Pair_symbol='#';Normal_Pair='GT GU';Normal_Pair_symbol='-';Strong_Pair='CG AT AU';Strong_Pair_symbol='~';"
241 "User_Pair='.A .C .G .T .U .M .R .W .S .Y .K .V .H .D .B .N';User_Pair2='-A -C -G -T -U -M -R -W -S -Y -K -V -H -D -B -N';User_Pair2_symbol='#';User_Pair3='-- .. -.';User_Pair3_symbol='';"
242 "User_Pair4='AM AV CH CM CW CY HM HY MM TY UY YY';User_Pair4_symbol='#';User_Pair5='AK BG BR BS CK CR CS GH GM GN GS GV KM KR KV RT RU RY SS';User_Pair5_symbol='-';User_Pair6='GY';User_Pair6_symbol='~';User_Pair_symbol='*';Weak_Pair='GA GG';Weak_Pair_symbol='=';enable='1'" },
247 AW_window_simple *aws =
new AW_window_simple;
250 aws->init(awr,
"HELIX_PROPS",
"HELIX_PROPERTIES");
253 aws->auto_space(3, 3);
256 aws->create_button(
"CLOSE",
"CLOSE",
"C");
259 aws->create_button(
"HELP",
"HELP",
"H");
265 const size_t max_awar_len = 11;
266 aws->label_length(max_awar_len);
268 aws->label(
"Show helix?");
275 aws->get_at_position(&x, &y);
280 const int IF_YSIZE = 32;
281 for (
int j = 0; helix_awars[j].
awar; j++) {
284 arb_assert(strlen(helix_awars[j].awar) <= max_awar_len);
285 aws->label(helix_awars[j].awar);
290 aws->at_attach_to(
true,
false, -10, IF_YSIZE);
bool is_pairpos(size_t pos) const
static AWT_predefined_config predefined_helix_configs[]
#define HELIX_AWAR_SYMBOL_TEMPLATE
void add(const char *awar_name, const char *config_name)
void cut(const size_t at, const size_t byte_count)
#define AWAR_HELIX_REFRESH
void set_pairs_def(int i, const char *new_pairs_def)
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)
void add_callback(const RootCallback &cb) const
const char * GBS_global_string(const char *templat,...)
size_t opposite_position(size_t pos) const
void AW_POPDOWN(AW_window *window)
void reset_layout(const char *YYYYMMDD)
const char * get_pairs_def(int i) const
void set_char_bind(int i, const char *new_char_bind)
AW_awar * add_callback(const RootCallback &cb)
const char * read_char_pntr() const
WindowCallback makeHelpCallback(const char *helpfile)
const char * helix_symbol_awar(int idx)
static void helix_pairs_changed_cb(AW_root *aw_root, int changed_idx)
CONSTEXPR_INLINE_Cxx14 void swap(unsigned char &c1, unsigned char &c2)
#define HELIX_AWAR_PAIR_TEMPLATE
static helix_pair_def helix_awars[]
char * read_string() const
AW_awar * awar(const char *awar)
AW_awar * remove_callback(const RootCallback &cb)
AW_helix(AW_root *aw_root)
char get_symbol(char left, char right) const
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
static void setup_helix_config(AWT_config_definition &cdef)
#define AWAR_HELIX_ENABLE
AW_window * create_helix_props_window(AW_root *awr)
void remove_callback(const RootCallback &cb) const
GB_ERROR write_string(const char *aw_string)
static void helix_setup_changed_cb(AW_root *aw_root, AW_helix *helix)
const char * get_data() const
char * seq_2_helix(char *sequence, char undefsymbol= ' ') const
const char * get_char_bind(int i) const
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
void setup_changed_cb(AW_root *aw_root)
const char * helix_pair_awar(int idx)
size_t get_position() const