source: tags/ms_r18q1/EDIT4/graph_aligner_gui.cxx

Last change on this file was 16763, checked in by westram, 6 years ago
File size: 24.2 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : graph_aligner_gui.cxx                             //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Coded by Elmar Pruesse in October 2008                        //
7//   Institute of Microbiology (Technical University Munich)       //
8//   http://www.arb-home.de/                                       //
9//                                                                 //
10// =============================================================== //
11
12#include "graph_aligner_gui.hxx"
13
14#include "ed4_defs.hxx"
15
16// need to use AlignDataAccess defined here to get selected species
17#include <fast_aligner.hxx>
18
19#include <aw_awars.hxx>
20#include <aw_msg.hxx>
21#include <aw_root.hxx>
22#include <awt_sel_boxes.hxx>
23#include <awt_config_manager.hxx>
24#include <servercntrl.h>
25#include <PT_com.h>
26#include <client.h>
27#include <arbdbt.h>
28#include <arb_strbuf.h>
29#include <arb_misc.h>
30
31#include <sys/types.h>
32#include <sys/wait.h>
33
34#include <unistd.h>
35
36#include <string>
37#include <sstream>
38#include <iostream>
39#include <vector>
40
41using std::cerr;
42using std::cout;
43using std::endl;
44
45#define GA_AWAR_ROOT "sina/"
46
47#define GA_AWAR_CMD            GA_AWAR_ROOT "command"
48#define GA_AWAR_TGT            GA_AWAR_ROOT "target"
49#define GA_AWAR_SAI            GA_AWAR_ROOT "sai"
50#define GA_AWAR_ALIGNMENT      GA_AWAR_ROOT "alignment"
51#define GA_AWAR_PROTECTION     GA_AWAR_ROOT "protection"
52#define GA_AWAR_TURN_CHECK     GA_AWAR_ROOT "turncheck"
53#define GA_AWAR_REALIGN        GA_AWAR_ROOT "realign"
54#define GA_AWAR_COPYMARKREF    GA_AWAR_ROOT "copymarkref"
55#define GA_AWAR_MATCH_SCORE    GA_AWAR_ROOT "match_score"
56#define GA_AWAR_MISMATCH_SCORE GA_AWAR_ROOT "mismatch_score"
57#define GA_AWAR_GAP_PEN        GA_AWAR_ROOT "gap_pen"
58#define GA_AWAR_GAP_EXT        GA_AWAR_ROOT "gap_ext"
59#define GA_AWAR_ADVANCED       GA_AWAR_ROOT "advanced"
60#define GA_AWAR_FS_MIN         GA_AWAR_ROOT "fs_min"
61#define GA_AWAR_FS_MAX         GA_AWAR_ROOT "fs_max"
62#define GA_AWAR_FS_MSC         GA_AWAR_ROOT "fs_msc"
63#define GA_AWAR_MIN_FULL       GA_AWAR_ROOT "min_full"
64#define GA_AWAR_FULL_MINLEN    GA_AWAR_ROOT "full_minlen"
65#define GA_AWAR_OVERHANG       GA_AWAR_ROOT "overhang"
66#define GA_AWAR_THREADS        GA_AWAR_ROOT "threads"
67#define GA_AWAR_QSIZE          GA_AWAR_ROOT "qsize"
68#define GA_AWAR_KMER_LEN       GA_AWAR_ROOT "kmer_len"
69#define GA_AWAR_KMER_MM        GA_AWAR_ROOT "kmer_mm"
70#define GA_AWAR_MIN_LEN        GA_AWAR_ROOT "min_len"
71#define GA_AWAR_WEIGHT         GA_AWAR_ROOT "weight"
72#define GA_AWAR_INSERT         GA_AWAR_ROOT "insert"
73#define GA_AWAR_LOWERCASE      GA_AWAR_ROOT "lowercase"
74#define GA_AWAR_AUTOFILTER     GA_AWAR_ROOT "autofilter"
75#define GA_AWAR_KMER_NOREL     GA_AWAR_ROOT "kmer_norel"
76#define GA_AWAR_KMER_NOFAST    GA_AWAR_ROOT "kmer_nofast"
77#define GA_AWAR_SHOW_DIST      GA_AWAR_ROOT "show_dist"
78#define GA_AWAR_SHOW_DIFF      GA_AWAR_ROOT "show_diff"
79#define GA_AWAR_COLOR          GA_AWAR_ROOT "color"
80#define GA_AWAR_GENE_START     GA_AWAR_ROOT "gene_start"
81#define GA_AWAR_GENE_END       GA_AWAR_ROOT "gene_end"
82#define GA_AWAR_FS_COVER_GENE  GA_AWAR_ROOT "fs_cover_gene"
83
84void create_sina_variables(AW_root *root, AW_default db1) {
85    root->awar_string(GA_AWAR_CMD,            "sina",   db1);
86    root->awar_int   (GA_AWAR_TGT,            2,        db1);
87    root->awar_int   (AWAR_PT_SERVER,         0,        db1);
88    root->awar_string(GA_AWAR_SAI,            "",       db1);
89    root->awar_int   (GA_AWAR_PROTECTION,     0,        db1);
90    root->awar_int   (GA_AWAR_TURN_CHECK,     1,        db1);
91    root->awar_int   (GA_AWAR_REALIGN,        1,        db1);
92    root->awar_int   (GA_AWAR_COPYMARKREF,    0,        db1);
93    root->awar_float (GA_AWAR_GAP_PEN,        5.0,      db1);
94    root->awar_float (GA_AWAR_GAP_EXT,        2.0,      db1);
95    root->awar_float (GA_AWAR_MATCH_SCORE,    2.0,      db1);
96    root->awar_float (GA_AWAR_MISMATCH_SCORE, -1.0,     db1);
97    root->awar_int   (GA_AWAR_ADVANCED,       0,        db1);
98    root->awar_int   (GA_AWAR_FS_MIN,         40,       db1);
99    root->awar_int   (GA_AWAR_FS_MAX,         40,       db1);
100    root->awar_float (GA_AWAR_FS_MSC,         .7,       db1);
101    root->awar_int   (GA_AWAR_MIN_FULL,       1,        db1);
102    root->awar_int   (GA_AWAR_FULL_MINLEN,    1400,     db1);
103    root->awar_string(GA_AWAR_OVERHANG,       "attach", db1);
104    root->awar_int   (GA_AWAR_THREADS,        1,        db1);
105    root->awar_int   (GA_AWAR_QSIZE,          1,        db1);
106    root->awar_int   (GA_AWAR_KMER_LEN,       10,       db1);
107    root->awar_int   (GA_AWAR_KMER_MM,        0,        db1);
108    root->awar_int   (GA_AWAR_MIN_LEN,        150,      db1);
109    root->awar_float (GA_AWAR_WEIGHT,         1,        db1);
110    root->awar_string(GA_AWAR_INSERT,         "shift",  db1);
111    root->awar_string(GA_AWAR_LOWERCASE,      "none",   db1);
112    root->awar_string(GA_AWAR_AUTOFILTER,     "none",   db1);
113    root->awar_int   (GA_AWAR_KMER_NOREL,     0,        db1);
114    root->awar_int   (GA_AWAR_KMER_NOFAST,    0,        db1);
115    root->awar_int   (GA_AWAR_SHOW_DIST,      0,        db1);
116    root->awar_int   (GA_AWAR_SHOW_DIFF,      0,        db1);
117    root->awar_int   (GA_AWAR_COLOR,          1,        db1);
118    root->awar_int   (GA_AWAR_GENE_START,     0,        db1);
119    root->awar_int   (GA_AWAR_GENE_END,       0,        db1);
120    root->awar_int   (GA_AWAR_FS_COVER_GENE,  1,        db1);
121}
122
123AW_active sina_mask(AW_root *root) {
124    const char *sinaName    = root->awar(GA_AWAR_CMD)->read_char_pntr();
125    char       *sina        = ARB_executable(sinaName, GB_getenv("PATH"));
126    const char *fail_reason = NULp;
127
128    if (sina) {
129        int exitstatus = system(GBS_global_string("%s --has-cli-vers ARB5.99", sina));
130        exitstatus     = WEXITSTATUS(exitstatus);
131
132        switch (exitstatus) {
133        case EXIT_SUCCESS:
134            break;
135
136        case EXIT_FAILURE:
137            fail_reason = "Incompatible SINA and ARB versions";
138            break;
139
140        case 127:                                   // libs missing
141        default:                                    // unexpected
142            fail_reason = GBS_global_string("Could execute SINA binary '%s' (exitstatus was %i)",
143                                            sinaName, exitstatus);
144            break;
145        }
146        free(sina);
147    }
148    else {
149        fail_reason = GBS_global_string("%s not found", sinaName);
150    }
151
152    if (fail_reason) {
153        fprintf(stderr,
154                "Note: SINA (SILVA Aligner) disabled (Reason: %s)\n",
155                fail_reason);
156    }
157
158    return fail_reason ? AWM_DISABLED : AWM_ALL;
159}
160
161inline const char *stream2static(const std::stringstream& str) {
162    return GBS_static_string(str.str().c_str());
163}
164
165inline const char *empty_as_none(const char *sainame) {
166    // see http://bugs.arb-home.de/ticket/519
167    if (sainame && !sainame[0]) sainame = "none";
168    return sainame;
169}
170
171static void sina_start(AW_window *window, const AlignDataAccess *data_access) {
172    cerr << "Starting SINA..." << endl;
173
174    // make string from pt server selection
175    AW_root *root = window->get_root();
176    int      pt   = root->awar(AWAR_PT_SERVER)->read_int();
177
178    std::stringstream ptnam;
179    ptnam << "ARB_PT_SERVER" << pt;
180
181    const char *pt_server = GBS_read_arb_tcp(ptnam.str().c_str());
182    GB_ERROR    gb_error  = NULp;
183
184    if (!pt_server) {
185        gb_error = GBS_global_string("Unable to find definition for chosen PT-server\n(Reason: %s)", GB_await_error());
186    }
187    else {
188        const char *pt_db = pt_server + strlen(pt_server) + 1;
189        pt_db += strlen(pt_db)+3;
190
191        // start pt server if necessary
192        gb_error = arb_look_and_start_server(AISC_MAGIC_NUMBER, ptnam.str().c_str());
193        if (gb_error) {
194            std::stringstream tmp;
195            tmp << "Cannot contact PT server. Aborting" << endl
196                << " ID: \"" << tmp.str().c_str()
197                << "\" PORT: \"" << pt_server
198                << "\" DB: \"" << pt_db  << endl
199                << "\" GBERROR: \"" << gb_error << "\"" << endl;
200            gb_error = stream2static(tmp);
201        }
202        else {
203            // create temporary file
204            char* tmpfile;
205            FILE* tmpfile_F;
206            {
207                char* tmpfile_tpl = GB_unique_filename("sina_select", "tmp");
208                tmpfile_F         = GB_fopen_tempfile(tmpfile_tpl, "w", &tmpfile);
209                free(tmpfile_tpl);
210            }
211
212            if (!tmpfile_F) {
213                std::stringstream tmp;
214                tmp << "Error: Unable to create temporary file \"" << tmpfile << "\"!";
215                gb_error = stream2static(tmp);
216            }
217            else {
218                GB_remove_on_exit(tmpfile);
219
220                std::vector<std::string> spec_names;
221                switch (root->awar(GA_AWAR_TGT)->read_int()) {
222                    case 0: { // current
223                        char *spec_name = root->awar(AWAR_SPECIES_NAME)->read_string();
224                        if (spec_name) {
225                            fwrite(spec_name, strlen(spec_name), 1, tmpfile_F);
226                            fwrite("\n", 1, 1, tmpfile_F);
227                        }
228                        else {
229                            gb_error = "Unable to get name of currently active species";
230                        }
231                        free(spec_name);
232                        break;
233                    }
234                    case 1: { // selected
235                        GB_begin_transaction(GLOBAL_gb_main);
236                        int num_selected = 0;
237                        for (GBDATA *gb_spec = data_access->get_first_selected_species(&num_selected);
238                             gb_spec;
239                             gb_spec = data_access->get_next_selected_species())
240                        {
241                            GBDATA *gbd_name = GB_find(gb_spec, "name", SEARCH_CHILD);
242                            if (gbd_name) {
243                                const char *str = GB_read_char_pntr(gbd_name);
244                                fwrite(str, strlen(str), 1, tmpfile_F);
245                                fwrite("\n", 1, 1, tmpfile_F);
246                            }
247                        }
248                        GB_commit_transaction(GLOBAL_gb_main);
249                        break;
250                    }
251                    case 2: { // marked
252                        GB_begin_transaction(GLOBAL_gb_main);
253                        for (GBDATA *gb_spec = GBT_first_marked_species(GLOBAL_gb_main);
254                             gb_spec; gb_spec = GBT_next_marked_species(gb_spec)) {
255                            GBDATA *gbd_name = GB_find(gb_spec, "name", SEARCH_CHILD);
256                            if (gbd_name) {
257                                const char *str = GB_read_char_pntr(gbd_name);
258                                fwrite(str, strlen(str), 1, tmpfile_F);
259                                fwrite("\n", 1, 1, tmpfile_F);
260                            }
261                        }
262                        GB_commit_transaction(GLOBAL_gb_main);
263                        break;
264                    }
265                }
266                fclose(tmpfile_F);
267
268                if (!gb_error) {
269                    // build command line
270                    GBS_strstruct *cl = GBS_stropen(2000);
271
272                    GBS_strcat(cl, root->awar(GA_AWAR_CMD)->read_char_pntr());
273                    GBS_strcat(cl, " -i :");
274                    GBS_strcat(cl, " --ptdb :");
275                    GBS_strcat(cl, " --ptport ");      GBS_strcat(cl,   pt_server);
276                    GBS_strcat(cl, " --turn ");        GBS_strcat(cl,   root->awar(GA_AWAR_TURN_CHECK)->read_int() ? "all" : "none");
277                    GBS_strcat(cl, " --overhang ");    GBS_strcat(cl,   root->awar(GA_AWAR_OVERHANG)->read_char_pntr());
278                    GBS_strcat(cl, " --filter ");      GBS_strcat(cl,   empty_as_none(root->awar(GA_AWAR_SAI)->read_char_pntr()));
279                    GBS_strcat(cl, " --fs-min ");      GBS_intcat(cl,   root->awar(GA_AWAR_FS_MIN)->read_int());
280                    GBS_strcat(cl, " --fs-msc ");      GBS_floatcat(cl, root->awar(GA_AWAR_FS_MSC)->read_float());
281                    GBS_strcat(cl, " --fs-max ");      GBS_intcat(cl,   root->awar(GA_AWAR_FS_MAX)->read_int());
282                    GBS_strcat(cl, " --fs-req 1");
283                    GBS_strcat(cl, " --fs-req-full "); GBS_intcat(cl,   root->awar(GA_AWAR_MIN_FULL)->read_int());
284                    GBS_strcat(cl, " --fs-full-len "); GBS_intcat(cl,   root->awar(GA_AWAR_FULL_MINLEN)->read_int());
285                    GBS_strcat(cl, " --fs-kmer-len "); GBS_intcat(cl,   root->awar(GA_AWAR_KMER_LEN)->read_int());
286                    GBS_strcat(cl, " --fs-kmer-mm ");  GBS_intcat(cl,   root->awar(GA_AWAR_KMER_MM)->read_int());
287                    GBS_strcat(cl, " --fs-min-len ");  GBS_intcat(cl,   root->awar(GA_AWAR_MIN_LEN)->read_int());
288                    GBS_strcat(cl, " --fs-weight ");   GBS_intcat(cl,   root->awar(GA_AWAR_WEIGHT)->read_float()); // @@@ possible type conflict?
289                    GBS_strcat(cl, " --pen-gap ");     GBS_floatcat(cl, root->awar(GA_AWAR_GAP_PEN)->read_float());
290                    GBS_strcat(cl, " --pen-gapext ");  GBS_floatcat(cl, root->awar(GA_AWAR_GAP_EXT)->read_float());
291                    GBS_strcat(cl, " --match-score "); GBS_floatcat(cl, root->awar(GA_AWAR_MATCH_SCORE)->read_float());
292                    GBS_strcat(cl, " --mismatch-score "); GBS_floatcat(cl, root->awar(GA_AWAR_MISMATCH_SCORE)->read_float());
293                    GBS_strcat(cl, " --prot-level ");  GBS_intcat(cl,   root->awar(GA_AWAR_PROTECTION)->read_int());
294                    GBS_strcat(cl, " --select-file "); GBS_strcat(cl,   tmpfile);
295                    GBS_strcat(cl, " --insertion ");   GBS_strcat(cl,   root->awar(GA_AWAR_INSERT)->read_char_pntr());
296                    GBS_strcat(cl, " --lowercase ");   GBS_strcat(cl,   root->awar(GA_AWAR_LOWERCASE)->read_char_pntr());
297                    GBS_strcat(cl, " --auto-filter-field "); GBS_strcat(cl, root->awar(GA_AWAR_AUTOFILTER)->read_char_pntr());
298                    GBS_strcat(cl, " --gene-start ");  GBS_intcat(cl,   root->awar(GA_AWAR_GENE_START)->read_int());
299                    GBS_strcat(cl, " --gene-end ");    GBS_intcat(cl,   root->awar(GA_AWAR_GENE_END)->read_int());
300                    GBS_strcat(cl, " --fs-cover-gene ");GBS_intcat(cl,   root->awar(GA_AWAR_FS_COVER_GENE)->read_int());
301
302
303                    if (root->awar(GA_AWAR_KMER_NOREL)->read_int()) GBS_strcat(cl, " --fs-kmer-norel ");
304                    if (root->awar(GA_AWAR_KMER_NOFAST)->read_int()) GBS_strcat(cl, " --fs-kmer-no-fast ");
305                    if (root->awar(GA_AWAR_SHOW_DIST)->read_int()) GBS_strcat(cl, " --show-dist ");
306                    if (root->awar(GA_AWAR_SHOW_DIFF)->read_int()) GBS_strcat(cl, " --show-diff ");
307                    if (root->awar(GA_AWAR_COLOR)->read_int())     GBS_strcat(cl, " --color");
308                    if (root->awar(GA_AWAR_REALIGN)->read_int())     GBS_strcat(cl, " --realign");
309
310                    gb_error = GB_xcmd(GBS_mempntr(cl), XCMD_ASYNC_WAITKEY);
311                    GBS_strforget(cl);
312                }
313
314                if (!gb_error) aw_message("SINA finished aligning.");
315            }
316            free(tmpfile);
317        }
318    }
319   
320    aw_message_if(gb_error);
321}
322
323
324
325static char* filter_posvar_SAI_for_ali(GBDATA *gb_extended, const char *ali_name) {
326    char   *result   = NULp;
327    char   *typePath = GBS_global_string_copy("%s/_TYPE", ali_name);
328    GBDATA *gbd      = GB_search(gb_extended, typePath, GB_FIND);
329    if (gbd) {
330        const char* type = GB_read_char_pntr(gbd);
331        if (type && strncmp("PV", type, 2) == 0) {
332            gbd    = GB_find(gb_extended, "name", SEARCH_CHILD);
333            result = GB_read_string(gbd);
334        }
335    }
336    free(typePath);
337    return result;
338}
339
340static AWT_config_mapping_def sina_config_mapping[] = {
341    // both
342    { GA_AWAR_TGT,         "target" },
343    { GA_AWAR_OVERHANG,    "overhang" },
344    { GA_AWAR_INSERT,      "insertions" },
345    { GA_AWAR_LOWERCASE,   "lowercase" },
346    { GA_AWAR_WEIGHT,      "weight" },
347    { GA_AWAR_FULL_MINLEN, "fullminlen" },
348
349    // advanced only
350    { GA_AWAR_SAI,            "sai" },
351    { GA_AWAR_AUTOFILTER,     "autofilter" },
352    { GA_AWAR_TURN_CHECK,     "turncheck" },
353    { GA_AWAR_REALIGN,        "realign" },
354    { GA_AWAR_GAP_PEN,        "gappen" },
355    { GA_AWAR_GAP_EXT,        "gapext" },
356    { GA_AWAR_MATCH_SCORE,    "matchscore" },
357    { GA_AWAR_MISMATCH_SCORE, "mismatchscore" },
358    { GA_AWAR_FS_MIN,         "fs_min" },
359    { GA_AWAR_FS_MSC,         "fs_minscore" },
360    { GA_AWAR_FS_MAX,         "fs_min" },
361    { GA_AWAR_MIN_FULL,       "minfull" },
362    { GA_AWAR_KMER_LEN,       "kmerlen" },
363    { GA_AWAR_KMER_MM,        "kmermm" },
364    { GA_AWAR_MIN_LEN,        "refminlen" },
365    { GA_AWAR_GENE_START,     "genestart" },
366    { GA_AWAR_GENE_END,       "geneend" },
367    { GA_AWAR_FS_COVER_GENE,  "fs_covergene" },
368    { GA_AWAR_KMER_NOFAST,    "kmernofast" },
369    { GA_AWAR_KMER_NOREL,     "kmernorel" },
370
371    // both
372    { GA_AWAR_SHOW_DIFF, "showdiff" },
373    { GA_AWAR_COLOR,     "color" },
374    { GA_AWAR_SHOW_DIST, "showdist" },
375
376    { NULp, NULp }
377};
378
379static AW_window_simple* new_sina_simple(AW_root *root, const AlignDataAccess *alignData, bool adv) {
380    int closex, closey, startx, starty, winx, winy;
381    const int hgap = 10;
382    AW_window_simple *aws = new AW_window_simple;
383
384    aws->init(root, adv ? "XSINA" : "SINA", "SINA (SILVA Incremental Aligner)");
385
386    aws->button_length(12);
387    aws->at(10, 10);
388    aws->auto_space(5, 5);
389
390    aws->callback(AW_POPDOWN);
391    aws->create_button("CLOSE", "CLOSE", "O");
392    aws->get_at_position(&closex, &closey);
393
394    aws->at_shift(10, 0);
395    aws->label_length(0);
396    aws->label("Show advanced options");
397    aws->create_toggle(GA_AWAR_ADVANCED);
398
399    bool cbInstalled = false;
400    if (!cbInstalled) {
401        root->awar(GA_AWAR_ADVANCED)->add_callback(makeRootCallback(show_sina_window, alignData));
402        cbInstalled = true;
403    }
404
405    aws->at_newline();
406    aws->at_shift(0, hgap);
407    aws->label_length(15);
408    aws->create_toggle_field(GA_AWAR_TGT, "Align what?", "A");
409    aws->insert_toggle("Current Species:", "C", 0);
410    aws->insert_toggle("Selected Species", "S", 1);
411    aws->insert_default_toggle("Marked Species", "M", 2);
412    aws->update_toggle_field();
413
414    aws->at_shift(0, 3);
415    aws->create_input_field(AWAR_SPECIES_NAME, 20);
416
417    aws->at_newline();
418    aws->at_shift(0, hgap);
419    aws->button_length(24);
420    aws->label("PT Server:");
421    awt_create_PTSERVER_selection_button(aws, AWAR_PT_SERVER);
422
423    aws->at_newline();
424    aws->label_length(0);
425    aws->label("Overhang placement");
426    aws->create_option_menu(GA_AWAR_OVERHANG, true);
427    aws->insert_option("keep attached", NULp, "attach");
428    aws->insert_option("move to edge",  NULp, "edge");
429    aws->insert_option("remove",        NULp, "remove");
430    aws->update_option_menu();
431
432    aws->at_newline();
433    aws->label("Handling of unmappable insertions");
434    aws->create_option_menu(GA_AWAR_INSERT, true);
435    aws->insert_option("Shift surrounding bases",    NULp, "shift");
436    aws->insert_option("Forbid during DP alignment", NULp, "forbid");
437    aws->insert_option("Delete bases",               NULp, "remove");
438    aws->update_option_menu();
439
440    aws->at_newline();
441    aws->label("Character Case");
442    aws->create_option_menu(GA_AWAR_LOWERCASE, true);
443    aws->insert_option("Do not modify",                      NULp, "original");
444    aws->insert_option("Show unaligned bases as lower case", NULp, "unaligned");
445    aws->insert_option("Uppercase all",                      NULp, "none");
446    aws->update_option_menu();
447
448    aws->at_newline();
449    aws->label("Family conservation weight (0-1)");
450    aws->create_input_field(GA_AWAR_WEIGHT, 3);
451
452    aws->at_newline();
453    aws->label("Size of full-length sequences");
454    aws->create_input_field(GA_AWAR_FULL_MINLEN, 5);
455
456    if (adv) {
457        aws->at_newline();
458        aws->at_shift(0, hgap);
459
460        aws->at_newline();
461
462        aws->label("Pos. Var.:");
463        awt_create_SAI_selection_button(GLOBAL_gb_main, aws, GA_AWAR_SAI, makeSaiSelectionlistFilterCallback(filter_posvar_SAI_for_ali, alignData->alignment_name.c_str()));
464
465        aws->at_newline();
466        aws->label("Field used for automatic filter selection");
467        aws->create_input_field(GA_AWAR_AUTOFILTER, 20);
468
469        aws->label("Turn check");
470        aws->create_toggle(GA_AWAR_TURN_CHECK);
471
472        aws->at_newline();
473        aws->label("Realign");
474        aws->create_toggle(GA_AWAR_REALIGN);
475
476       /*
477        aws->at_newline();
478        aws->label("(Copy and) mark sequences used as reference");
479        aws->create_toggle(GA_AWAR_COPYMARKREF);
480        */
481
482        aws->at_newline();
483        aws->at_shift(0, hgap);
484        aws->label_length(0);
485
486        aws->label("Gap insertion/extension penalties");
487        aws->create_input_field(GA_AWAR_GAP_PEN, 5);
488        aws->create_input_field(GA_AWAR_GAP_EXT, 5);
489
490        aws->at_newline();
491        aws->label("Match score");
492        aws->create_input_field(GA_AWAR_MATCH_SCORE, 3);
493        aws->label("Mismatch score");
494        aws->create_input_field(GA_AWAR_MISMATCH_SCORE, 3);
495
496        aws->at_newline();
497        aws->label("Family search min/min_score/max");
498        aws->create_input_field(GA_AWAR_FS_MIN, 3);
499        aws->create_input_field(GA_AWAR_FS_MSC, 3);
500        aws->create_input_field(GA_AWAR_FS_MAX, 3);
501
502        aws->at_newline();
503        aws->label("Minimal number of full length sequences");
504        aws->create_input_field(GA_AWAR_MIN_FULL, 3);
505
506        aws->at_newline();
507        aws->label("Family search oligo length / mismatches");
508        aws->create_input_field(GA_AWAR_KMER_LEN, 3);
509        aws->create_input_field(GA_AWAR_KMER_MM, 3);
510
511        aws->at_newline();
512        aws->label("Minimal reference sequence length");
513        aws->create_input_field(GA_AWAR_MIN_LEN, 5);
514
515        aws->at_newline();
516        aws->label("Alignment bounds: start");
517        aws->create_input_field(GA_AWAR_GENE_START, 6);
518        aws->label("end");
519        aws->create_input_field(GA_AWAR_GENE_END, 6);
520
521        aws->at_newline();
522        aws->label("Number of references required to touch bounds");
523        aws->create_input_field(GA_AWAR_FS_COVER_GENE, 3);
524
525        aws->at_newline();
526        aws->label("Disable fast search");
527        aws->create_toggle(GA_AWAR_KMER_NOFAST);
528
529        aws->at_newline();
530        aws->label("Score search results by absolute oligo match count");
531        aws->create_toggle(GA_AWAR_KMER_NOREL);
532
533        aws->at_newline();
534        aws->label("SINA command");
535        aws->create_input_field(GA_AWAR_CMD, 20);
536
537        aws->at_shift(0, hgap);
538    }
539
540    aws->at_newline();
541    aws->at_shift(0, hgap);
542
543    aws->label_length(17);
544    aws->label("Protection Level");
545    aws->create_option_menu(GA_AWAR_PROTECTION, true);
546    aws->insert_option("0", NULp, 0);
547    aws->insert_option("1", NULp, 1);
548    aws->insert_option("2", NULp, 2);
549    aws->insert_option("3", NULp, 3);
550    aws->insert_option("4", NULp, 4);
551    aws->insert_option("5", NULp, 5);
552    aws->insert_option("6", NULp, 6);
553    aws->update_option_menu();
554
555    aws->at_newline();
556    aws->label("Show changed sections of alignment");
557    aws->create_toggle(GA_AWAR_SHOW_DIFF);
558    aws->label("color bases");
559    aws->create_toggle(GA_AWAR_COLOR);
560
561    aws->at_newline();
562    aws->label("Show statistics");
563    aws->create_toggle(GA_AWAR_SHOW_DIST);
564
565    aws->get_window_size(winx, winy);
566    aws->get_at_position(&startx, &starty);
567
568    aws->button_length(12);
569
570    aws->at(winx-closex+5, closey);
571    aws->callback(makeHelpCallback("sina_main.hlp"));
572    aws->create_button("HELP", "HELP");
573
574    aws->at(winx-closex+5, starty);
575    aws->callback(makeWindowCallback(sina_start, alignData));
576    aws->highlight();
577    aws->create_button("Start", "Start", "S");
578
579    aws->at(winx-50, starty-50);
580    AWT_insert_config_manager(aws, AW_ROOT_DEFAULT, "sina", sina_config_mapping);
581
582    return aws;
583}
584
585void show_sina_window(UNFIXED, const AlignDataAccess *alignData) {
586    AW_root *root = AW_root::SINGLETON;
587
588    static AW_window_simple *ga_aws     = new_sina_simple(root, alignData, false);
589    static AW_window_simple *ga_aws_adv = new_sina_simple(root, alignData, true);
590
591    if (root->awar(GA_AWAR_ADVANCED)->read_int()) {
592        ga_aws_adv->show();
593        ga_aws->hide();
594    }
595    else {
596        ga_aws->show();
597        ga_aws_adv->hide();
598    }
599}
600
Note: See TracBrowser for help on using the repository browser.