23 #define AWAR_TRANSPRO_PREFIX "transpro/"
24 #define AWAR_TRANSPRO_SOURCE AWAR_TRANSPRO_PREFIX "source"
25 #define AWAR_TRANSPRO_DEST AWAR_TRANSPRO_PREFIX "dest"
28 #define AWAR_TRANSPRO_POS AWAR_TRANSPRO_PREFIX "pos" // [0..3]: 0-2 = reading frame; 3 = autodetect
29 #define AWAR_TRANSPRO_MODE AWAR_TRANSPRO_PREFIX "mode"
30 #define AWAR_TRANSPRO_XSTART AWAR_TRANSPRO_PREFIX "xstart"
31 #define AWAR_TRANSPRO_WRITE AWAR_TRANSPRO_PREFIX "write"
34 #define AWAR_REALIGN_INCALI AWAR_TRANSPRO_PREFIX "incali"
35 #define AWAR_REALIGN_UNMARK AWAR_TRANSPRO_PREFIX "unmark"
36 #define AWAR_REALIGN_CUTOFF "tmp/" AWAR_TRANSPRO_PREFIX "cutoff" // dangerous -> do not save
41 #if defined(DEBUG) && 0
42 test_AWT_get_codons();
75 AW_window_simple *aws =
new AW_window_simple;
76 aws->init(root,
"TRANSLATE_DNA_TO_PRO",
"TRANSLATE DNA TO PRO");
78 aws->load_xfig(
"transpro.fig");
82 aws->create_button(
"CLOSE",
"CLOSE",
"C");
86 aws->create_button(
"HELP",
"HELP",
"H");
100 aws->update_option_menu();
104 aws->insert_toggle(
"from fields 'codon_start' and 'transl_table'",
"",
"fields");
105 aws->insert_default_toggle(
"use settings below (same for all species):",
"",
"settings");
106 aws->update_toggle_field();
110 for (
int p = 1; p <= 3; ++p) {
112 aws->insert_option(label, label,
bio2info(p));
116 aws->update_option_menu();
120 aws->label(
"Save settings (to 'codon_start'+'transl_table')");
124 aws->label(
"Translate all data");
127 aws->at(
"translate");
130 aws->create_button(
"TRANSLATE",
"TRANSLATE",
"T");
143 size_t neededLength = 0;
147 if (!error && neededLength) {
149 if (auto_inc_alisize) {
156 "running re-aligner again!",
157 ali_dest, neededLength));
159 error =
ALI_realign_marked(gb_main, ali_source, ali_dest, neededLength, unmark_succeeded, cutoff_dna);
161 error =
GBS_global_string(
"internal error: neededLength=%zu (after autoinc)", neededLength);
168 nt_assert(destLen>0 &&
size_t(destLen)<neededLength);
169 error =
GBS_global_string(
"Missing %zu columns in alignment '%s' (got=%li, need=%zu)\n"
170 "(check toggle to permit auto-increment)",
171 size_t(neededLength-destLen), ali_dest, destLen, neededLength);
181 AW_window_simple *aws =
new AW_window_simple;
182 aws->init(root,
"REALIGN_DNA",
"Realign DNA");
188 aws->create_button(
"CLOSE",
"CLOSE",
"C");
192 aws->create_button(
"HELP",
"HELP",
"H");
195 #if defined(DEVEL_RALF)
197 #else // !defined(DEVEL_RALF)
209 aws->create_autosize_button(
"REALIGN",
"Realign marked species",
"R");
GB_ERROR GB_begin_transaction(GBDATA *gbd)
#define AWAR_REALIGN_UNMARK
#define AWAR_TRANSPRO_POS
#define AWAR_TRANSPRO_DEST
void load_xfig(const char *file, bool resize=true)
#define AWAR_REALIGN_INCALI
void NT_create_transpro_variables(AW_root *root, AW_default props)
#define AWAR_CURSOR_POSITION
GB_ERROR ALI_translate_marked(GBDATA *gb_main, bool use_entries, bool save_entries, int selected_startpos, bool translate_all, const char *ali_source, const char *ali_dest)
#define AWAR_TRANSPRO_SOURCE
void GB_end_transaction_show_error(GBDATA *gbd, GB_ERROR error, void(*error_handler)(GB_ERROR))
void awt_create_ALI_selection_button(GBDATA *gb_main, AW_window *aws, const char *varname, const char *ali_type_match)
const char * GBS_global_string(const char *templat,...)
long GBT_get_alignment_len(GBDATA *gb_main, const char *aliname)
void AW_POPDOWN(AW_window *window)
static void transpro_event(AW_window *aww)
WindowCallback makeHelpCallback(const char *helpfile)
#define AWAR_TRANSPRO_MODE
AW_window * NT_create_dna_2_pro_window(AW_root *root)
#define AWAR_TRANSPRO_WRITE
GB_ERROR GBT_set_alignment_len(GBDATA *gb_main, const char *aliname, long new_len)
static void error(const char *msg)
AW_window * NT_create_realign_dna_window(AW_root *root)
char * read_string() const
AW_awar * awar(const char *awar)
#define AWAR_TRANSPRO_XSTART
const char * AWT_get_codon_code_name(int code)
AW_DB_selection * awt_create_ALI_selection_list(GBDATA *gb_main, AW_window *aws, const char *varname, const char *ali_type_match)
GB_ERROR ALI_realign_marked(GBDATA *gb_main, const char *ali_source, const char *ali_dest, size_t &neededLength, bool unmark_succeeded, bool cutoff_dna)
ASSERTING_CONSTEXPR_INLINE int bio2info(int biopos)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
static void realign_event(AW_window *aww)
GB_ERROR close(GB_ERROR error)
const int AWAR_PROTEIN_TYPE_bacterial_code_index
#define AWAR_PROTEIN_TYPE
#define AWAR_REALIGN_CUTOFF
void aw_message(const char *msg)
#define AUTODETECT_STARTPOS
GB_transaction ta(gb_var)
static void nt_trans_cursorpos_changed(AW_root *awr)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
GB_ERROR GBT_check_data(GBDATA *Main, const char *alignment_name)
GB_ERROR write_int(long aw_int)