ARB
ColumnStat_2_gnuplot.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : ColumnStat_2_gnuplot.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #include "NT_local.h"
12 
13 #include <ColumnStat.hxx>
14 #include <AP_filter.hxx>
15 #include <awt_filter.hxx>
16 #include <aw_awars.hxx>
17 #include <aw_file.hxx>
18 #include <aw_msg.hxx>
19 #include <aw_root.hxx>
20 #include <aw_select.hxx>
21 #include <arbdbt.h>
22 #include <arb_file.h>
23 
24 #include <unistd.h>
25 
26 #define AWAR_CS2GP "tmp/ntree/colstat_2_gnuplot"
27 
28 #define AWAR_CS2GP_NAME AWAR_CS2GP "/name"
29 #define AWAR_CS2GP_SUFFIX AWAR_CS2GP "/filter"
30 #define AWAR_CS2GP_DIRECTORY AWAR_CS2GP "/directory"
31 #define AWAR_CS2GP_FILENAME AWAR_CS2GP "/file_name"
32 
33 #define AWAR_CS2GP_SMOOTH_VALUES AWAR_CS2GP "/smooth_values"
34 #define AWAR_CS2GP_SMOOTH_GNUPLOT AWAR_CS2GP "/smooth_gnuplot"
35 #define AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX AWAR_CS2GP "/gnuplot_overlay_prefix"
36 #define AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX AWAR_CS2GP "/gnuplot_overlay_postfix"
37 #define AWAR_CS2GP_FILTER_NAME AWAR_CS2GP "/ap_filter/name"
38 
39 static GB_ERROR split_stat_filename(const char *fname, char **dirPtr, char **name_prefixPtr, char **name_postfixPtr) {
40  // 'fname' is sth like 'directory/prefix.sth_gnu'
41  // 'dirPtr' is set to a malloc-copy of 'directory'
42  // 'name_prefixPtr' is set to a malloc-copy of 'prefix' (defaults to '*')
43  // 'name_postfixPtr' is set to a malloc-copy of 'sth_gnu' (defaults to '*_gnu')
44 
45  *dirPtr = NULp;
46  *name_prefixPtr = NULp;
47  *name_postfixPtr = NULp;
48 
49  const char *lslash = strrchr(fname, '/');
50  if (!lslash) return GB_export_errorf("'%s' has to contain a '/'", fname);
51 
52  char *dir = ARB_strdup(fname);
53  dir[lslash-fname] = 0; // cut off at last '/'
54 
55  char *name_prefix = ARB_strdup(lslash+1);
56  char *name_postfix = NULp;
57  char *ldot = strrchr(name_prefix, '.');
58 
59  if (ldot) {
60  ldot[0] = 0;
61  name_postfix = ARB_strdup(ldot+1);
62  }
63  if (!ldot || name_prefix[0] == 0) freedup(name_prefix, "*"); // no dot or empty name_prefix
64  if (!name_postfix || name_postfix[0] == 0) freedup(name_postfix, "*_gnu");
65 
66  nt_assert(name_prefix);
67  nt_assert(name_postfix);
68 
69  *dirPtr = dir;
70  *name_prefixPtr = name_prefix;
71  *name_postfixPtr = name_postfix;
72 
73  return NULp;
74 }
75 
76 static char * get_overlay_files(AW_root *awr, const char *fname, GB_ERROR& error) {
77  nt_assert(!error);
78 
79  bool overlay_prefix = awr->awar(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX)->read_int();
80  bool overlay_postfix = awr->awar(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX)->read_int();
81 
82  char *dir, *name_prefix, *name_postfix;
83  error = split_stat_filename(fname, &dir, &name_prefix, &name_postfix);
84 
85  char *found_files = NULp;
86  if (!error) {
87  char *found_prefix_files = NULp;
88  char *found_postfix_files = NULp;
89 
90  if (overlay_prefix || overlay_postfix) {
91  char *mask = GBS_global_string_copy("%s.*_gnu", name_prefix);
92  if (overlay_prefix) {
93 #if defined(WARN_TODO)
94 #warning change error handling for GB_find_all_files() - globally!
95 #endif
96  found_prefix_files = GB_find_all_files(dir, mask, false);
97  if (!found_prefix_files) error = GB_get_error();
98  }
99  free(mask);
100 
101  if (!error) {
102  mask = GBS_global_string_copy("*.%s", name_postfix);
103  if (overlay_postfix) {
104  found_postfix_files = GB_find_all_files(dir, mask, false);
105  if (!found_postfix_files) error = GB_get_error();
106  }
107  free(mask);
108  }
109  }
110 
111  if (!error) {
112  if (found_prefix_files) {
113  if (found_postfix_files) {
114  found_files = GBS_global_string_copy("%s*%s", found_prefix_files, found_postfix_files);
115  }
116  else { // only found_prefix_files
117  found_files = found_prefix_files;
118  found_prefix_files = NULp;
119  }
120  }
121  else {
122  found_files = found_postfix_files;
123  found_postfix_files = NULp;
124  }
125  }
126 
127  free(found_postfix_files);
128  free(found_prefix_files);
129  }
130 
131  free(name_postfix);
132  free(name_prefix);
133  free(dir);
134 
135  return found_files;
136 }
137 
138 enum PlotType {
152 
155 };
156 
157 static const char *plotTypeName[PT_PLOT_TYPES] = {
158  "gc_gnu",
159  "ga_gnu",
160  "rate_gnu",
161  "tt_gnu",
162  "f1_gnu",
163  "f2_gnu",
164  "f3_gnu",
165  "f4_gnu",
166  "a_gnu",
167  "c_gnu",
168  "g_gnu",
169  "tu_gnu",
170  "helix_gnu"
171 };
172 
173 static const char *plotTypeDescription[PT_PLOT_TYPES] = {
174  "G+C ratio",
175  "G+A ratio",
176  "Rate",
177  "TT Ratio",
178  "Most frequent base",
179  "2nd frequent base",
180  "3rd frequent base",
181  "Least frequent base",
182  "A ratio",
183  "C ratio",
184  "G ratio",
185  "T/U ratio",
186  "Helix"
187 };
188 
189 static PlotType string2PlotType(const char *type) {
190  for (int pt = 0; pt<PT_PLOT_TYPES; ++pt) {
191  if (strcmp(type, plotTypeName[pt]) == 0) {
192  return PlotType(pt);
193  }
194  }
195 
196  return PT_UNKNOWN;
197 }
198 
199 static const char *makeTitle(const char *fname) {
200  const char *rslash = strrchr(fname, '/');
201  if (rslash) rslash++;
202  else rslash = fname;
203 
204  char *name = ARB_strdup(rslash);
205  char *rdot = strrchr(name, '.');
206 
207  PlotType pt = PT_UNKNOWN;
208  if (rdot) pt = string2PlotType(rdot+1);
209 
210  static char *title = NULp;
211  freenull(title);
212 
213  if (pt == PT_UNKNOWN) {
214  title = GBS_global_string_copy("%s (unknown type)", name);
215  }
216  else {
217  rdot[0] = 0;
218  title = GBS_global_string_copy("%s (%s)", name, plotTypeDescription[pt]);
219  }
220 
221  free(name);
222 
223  return title;
224 }
225 
226 // -------------------
227 // SortedFreq
228 
229 class SortedFreq : virtual Noncopyable {
230  float *freq[4];
231 
232 public:
233  SortedFreq(const ColumnStat *column_stat);
234  ~SortedFreq();
235 
236  float get(PlotType plot_type, size_t pos) const {
237  float f;
238  switch (plot_type) {
239  case PT_MOST_FREQUENT_BASE: f = freq[0][pos]; break;
240  case PT_SECOND_FREQUENT_BASE: f = freq[1][pos]; break;
241  case PT_THIRD_FREQUENT_BASE: f = freq[2][pos]; break;
242  case PT_LEAST_FREQUENT_BASE: f = freq[3][pos]; break;
243  default: nt_assert(0); f = 0; break;
244  }
245  return f;
246  }
247 };
248 
249 SortedFreq::SortedFreq(const ColumnStat *column_stat) {
250  size_t len = column_stat->get_length();
251  for (int i = 0; i<4; ++i) { // 4 best frequencies
252  freq[i] = new float[len];
253  for (size_t p = 0; p<len; ++p) freq[i][p] = 0.0; // clear
254  }
255 
256  for (unsigned int c = 0; c<256; ++c) { // all character stats
257  const float *cfreq = column_stat->get_frequencies((unsigned char)c);
258  if (cfreq) {
259  for (size_t p = 0; p<len; ++p) { // all positions
260  if (freq[3][p] < cfreq[p]) {
261  freq[3][p] = cfreq[p]; // found higher freq
262 
263  for (int i = 3; i > 0; --i) { // bubble upwards to sort
264  if (freq[i-1][p] >= freq[i][p]) break; // sorted!
265 
266  float f = freq[i][p];
267  freq[i][p] = freq[i-1][p];
268  freq[i-1][p] = f;
269  }
270  }
271  }
272  }
273  }
274 
275 #if defined(DEBUG)
276  for (size_t p = 0; p<len; ++p) { // all positions
277  nt_assert(freq[0][p] >= freq[1][p]);
278  nt_assert(freq[1][p] >= freq[2][p]);
279  nt_assert(freq[2][p] >= freq[3][p]);
280  }
281 #endif // DEBUG
282 }
284  for (int i = 0; i<4; ++i) delete [] freq[i];
285 }
286 
287 class Smoother : virtual Noncopyable {
288  double *value;
289  size_t *index;
290  size_t size;
291  size_t halfsize;
292  size_t next;
293  size_t added;
294  double sum;
295 
296  size_t wrap(size_t idx) { return idx >= size ? idx-size : idx; }
297 
298 public:
299  Smoother(size_t smooth_range)
300  : size(smooth_range),
301  halfsize(size/2),
302  next(0),
303  added(0),
304  sum(0.0)
305  {
306  nt_assert(size>0);
307 
308  value = new double[size];
309  index = new size_t[size];
310 
311  for (size_t i = 0; i<size; ++i) value[i] = 0.0;
312  }
314  delete [] value;
315  delete [] index;
316  }
317 
318  void print(FILE *out, size_t i, double v) {
319  sum = sum+v-value[next];
320 
321  index[next] = i;
322  value[next] = v;
323 
324  next = wrap(next+1);
325 
326  if (added<size) ++added;
327  if (added == size) {
328  size_t printNext = wrap(next+halfsize);
329  fprintf(out, "%zu %f\n", index[printNext], sum/size);
330  }
331  }
332 };
333 
334 enum PlotMode {
335  PLOT, // write file
336  PLOT_AND_VIEW, // write file and run gnuplot
337  PLOT_CLEANUP, // delete all files with same prefix
338 };
339 
340 struct PlotParam {
343 
344  PlotParam(ColumnStat *colstat_, adfiltercbstruct *filterdef_)
345  : colstat(colstat_),
346  filterdef(filterdef_)
347  {}
348 };
349 
350 static void colstat_2_gnuplot_cb(AW_window *aww, PlotParam *param, PlotMode mode) {
352  GB_ERROR error = NULp;
353  ColumnStat *column_stat = param->colstat;
354  AW_root *awr = aww->get_root();
355 
356  if (mode == PLOT || mode == PLOT_AND_VIEW) {
357  char *filterstring = awr->awar(param->filterdef->def_filter)->read_string();
358  char *alignment_name = awr->awar(param->filterdef->def_alignment)->read_string();
359  long alignment_length = GBT_get_alignment_len(GLOBAL.gb_main, alignment_name);
360 
361  if (alignment_length<0) {
362  GB_clear_error();
363  error = "Please select a valid alignment";
364  }
365  else {
366  AP_filter filter(filterstring, "0", alignment_length);
367 
368  error = column_stat->calculate(&filter);
369 
370  if (!error && !column_stat->get_length()) error = "Please select column statistic";
371  }
372 
373  free(alignment_name);
374  free(filterstring);
375  }
376 
377  if (!error) {
378  char *fname = awr->awar(AWAR_CS2GP_FILENAME)->read_string();
379 
380  if (!strchr(fname, '/')) freeset(fname, GBS_global_string_copy("./%s", fname));
381  if (strlen(fname) < 1) error = "Please enter file name";
382 
383  if (mode == PLOT_CLEANUP) { // delete overlay files
384  if (!error) {
385  char *found_files = get_overlay_files(awr, fname, error);
386 
387  if (found_files) {
388  for (char *name = strtok(found_files, "*"); name; name = strtok(NULp, "*")) {
389  printf("Deleting gnuplot file '%s'\n", name);
390  if (unlink(name) != 0) printf("Can't delete '%s'\n", name);
391  }
392  free(found_files);
393  awr->awar(AWAR_CS2GP_DIRECTORY)->touch(); // reload file selection box
394  }
395  }
396  }
397  else {
398  FILE *out = NULp;
399  if (!error) {
400  out = fopen(fname, "w");
401  if (!out) error = GB_export_errorf("Cannot write to file '%s'", fname);
402  }
403 
404  nt_assert(out || error);
405 
406  if (!error) {
407  char *type = awr->awar(AWAR_CS2GP_SUFFIX)->read_string();
408  long smoothSize = awr->awar(AWAR_CS2GP_SMOOTH_VALUES)->read_int(); // 1 = discrete values
409  size_t columns = column_stat->get_length();
410 
411  enum {
412  STAT_AMOUNT,
413  STAT_SIMPLE_FLOAT,
414  STAT_SIMPLE_BOOL,
415  STAT_SORT,
416  STAT_UNKNOWN
417  } stat_type = STAT_UNKNOWN;
418  union {
419  struct {
420  const float *A;
421  const float *C;
422  const float *G;
423  const float *TU;
424  } amount; // STAT_AMOUNT
425  const float *floatVals; // STAT_SIMPLE_FLOAT
426  const bool *boolVals; // STAT_SIMPLE_BOOL
427  SortedFreq *sorted; // STAT_SORT
428  } data;
429 
430  data.amount.A = NULp; // silence warnings
431  data.amount.C = NULp;
432  data.amount.G = NULp;
433  data.amount.TU = NULp;
434 
435  PlotType plot_type = string2PlotType(type);
436  switch (plot_type) {
437  case PT_GC_RATIO:
438  case PT_GA_RATIO:
439  case PT_BASE_A:
440  case PT_BASE_C:
441  case PT_BASE_G:
442  case PT_BASE_TU: {
443  stat_type = STAT_AMOUNT;
444 
445  data.amount.A = column_stat->get_frequencies('A');
446  data.amount.C = column_stat->get_frequencies('C');
447  data.amount.G = column_stat->get_frequencies('G');
448  data.amount.TU = column_stat->get_frequencies('U');
449  break;
450  }
451  case PT_RATE:
452  stat_type = STAT_SIMPLE_FLOAT;
453  data.floatVals = column_stat->get_rates();
454  break;
455 
456  case PT_TT_RATIO:
457  stat_type = STAT_SIMPLE_FLOAT;
458  data.floatVals = column_stat->get_ttratio();
459  break;
460 
461  case PT_HELIX: {
462  stat_type = STAT_SIMPLE_BOOL;
463  data.boolVals = column_stat->get_is_helix();
464  break;
465  }
469  case PT_LEAST_FREQUENT_BASE: {
470  stat_type = STAT_SORT;
471  data.sorted = new SortedFreq(column_stat);
472  break;
473  }
474  case PT_PLOT_TYPES:
475  case PT_UNKNOWN:
476  error = "Please select what to plot";
477  break;
478  }
479 
480  const GB_UINT4 *weights = column_stat->get_weights();
481 
482  if (!error) {
483  Smoother smoother(smoothSize);
484 
485  for (size_t j=0; j<columns; ++j) {
486  if (!weights[j]) continue;
487 
488  double val = 0;
489  switch (stat_type) {
490  case STAT_AMOUNT: {
491  float A = data.amount.A[j];
492  float C = data.amount.C[j];
493  float G = data.amount.G[j];
494  float TU = data.amount.TU[j];
495 
496  float amount = A+C+G+TU;
497 
498  switch (plot_type) {
499  case PT_GC_RATIO: val = (G+C)/amount; break;
500  case PT_GA_RATIO: val = (G+A)/amount; break;
501  case PT_BASE_A: val = A/amount; break;
502  case PT_BASE_C: val = C/amount; break;
503  case PT_BASE_G: val = G/amount; break;
504  case PT_BASE_TU: val = TU/amount; break;
505 
506  default: nt_assert(0); break;
507  }
508  break;
509  }
510  case STAT_SIMPLE_FLOAT: val = data.floatVals[j]; break;
511  case STAT_SIMPLE_BOOL: val = data.boolVals[j]; break;
512  case STAT_SORT: val = data.sorted->get(plot_type, j); break;
513 
514  case STAT_UNKNOWN: nt_assert(0); break;
515  }
516 
517  smoother.print(out, j, val);
518  }
519  }
520 
521  if (stat_type == STAT_SORT) delete data.sorted;
522  free(type);
523  }
524 
525  if (out) {
526  fclose(out);
527  out = NULp;
528  }
529 
530  if (!error) {
531  awr->awar(AWAR_CS2GP_DIRECTORY)->touch(); // reload file selection box
532 
533  if (mode == PLOT_AND_VIEW) { // run gnuplot?
534  char *command_file;
535  char *command_name = GB_unique_filename("arb", "gnuplot");
536 
537  out = GB_fopen_tempfile(command_name, "wt", &command_file);
538  if (!out) error = GB_await_error();
539  else {
540  char *smooth = awr->awar(AWAR_CS2GP_SMOOTH_GNUPLOT)->read_string();
541  char *found_files = get_overlay_files(awr, fname, error);
542 
543  fprintf(out, "set samples 1000\n");
544 
545  bool plotted = false; // set to true after first 'plot' command (other plots use 'replot')
546  const char *plot_command[] = { "plot", "replot" };
547 
548  if (found_files) {
549  for (char *name = strtok(found_files, "*"); name; name = strtok(NULp, "*")) {
550  if (strcmp(name, fname) != 0) { // latest data file is done below
551  fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], name, smooth, makeTitle(name));
552  plotted = true;
553  }
554  }
555  free(found_files);
556  }
557 
558  fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], fname, smooth, makeTitle(fname));
559  fprintf(out, "pause mouse any \"Any key or button will terminate gnuplot\"\n");
560  fclose(out);
561  out = NULp;
562 
563  char *script = GBS_global_string_copy("gnuplot %s && rm -f %s", command_file, command_file);
565  free(script);
566  free(smooth);
567  }
568  free(command_file);
569  free(command_name);
570  }
571  }
572  }
573  free(fname);
574  }
575 
576  if (error) aw_message(error);
577 }
578 
579 static void colstat_ali_changed_cb(AW_root *root, AW_awar *awar_ali) {
580  if (GLOBAL.gb_main) {
581  long smooth_max = GBT_get_alignment_len(GLOBAL.gb_main, awar_ali->read_char_pntr());
582  if (smooth_max<0) { // ali not found
583  GB_clear_error();
584  smooth_max = INT_MAX;
585  }
586  root->awar(AWAR_CS2GP_SMOOTH_VALUES)->set_minmax(1, smooth_max);
587  }
588 }
589 
592 
593  AW_awar *awar_default_alignment = root->awar_string(AWAR_DEFAULT_ALIGNMENT, "", GLOBAL.gb_main);
594 
595  ColumnStat *column_stat = new ColumnStat(GLOBAL.gb_main, root, AWAR_CS2GP_NAME, awar_default_alignment);
596  AW_window_simple *aws = new AW_window_simple;
597 
598  aws->init(root, "EXPORT_CSP_TO_GNUPLOT", "Export Column statistic to GnuPlot");
599  aws->load_xfig("cpro/csp_2_gnuplot.fig");
600 
605 
606  AW_create_fileselection_awars(root, AWAR_CS2GP, "", ".gc_gnu", "noname.gc_gnu");
607 
608  aws->at("close");
609  aws->callback(AW_POPDOWN);
610  aws->create_button("CLOSE", "CLOSE", "C");
611 
612  aws->at("help"); aws->callback(makeHelpCallback("csp_2_gnuplot.hlp"));
613  aws->create_button("HELP", "HELP", "H");
614 
616 
617  aws->at("csp");
618  COLSTAT_create_selection_list(aws, column_stat);
619 
620  aws->at("what");
621  AW_selection_list *plotTypeList = aws->create_selection_list(AWAR_CS2GP_SUFFIX, true);
622  for (int pt = 0; pt<PT_PLOT_TYPES; ++pt) {
623  plotTypeList->insert(plotTypeDescription[pt], plotTypeName[pt]);
624  }
625  plotTypeList->insert_default("<select one>", "");
626  plotTypeList->update();
627 
630  {
631  AW_awar *awar_ali = root->awar(filter->def_alignment);
632  awar_ali->add_callback(makeRootCallback(colstat_ali_changed_cb, awar_ali));
633  awar_ali->touch();
634  }
635 
636  aws->at("ap_filter");
637  aws->callback(makeCreateWindowCallback(awt_create_select_filter_win, filter));
638  aws->create_button("SELECT_FILTER", AWAR_CS2GP_FILTER_NAME);
639 
640  aws->at("smooth");
641  aws->create_input_field(AWAR_CS2GP_SMOOTH_VALUES, 8);
642 
643  aws->at("smooth2");
644  aws->create_toggle_field(AWAR_CS2GP_SMOOTH_GNUPLOT, 1);
645  aws->insert_default_toggle("None", "N", "");
646  aws->insert_toggle("Unique", "U", "smooth unique");
647  aws->insert_toggle("CSpline", "S", "smooth cspline");
648  aws->insert_toggle("Bezier", "B", "smooth bezier");
649  aws->update_toggle_field();
650 
651  aws->auto_space(10, 10);
652  aws->button_length(13);
653 
654  PlotParam *param = new PlotParam(column_stat, filter); // bound to CB, dont free
655 
656  aws->at("save");
657  aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT));
658  aws->create_button("SAVE", "Save");
659 
660  aws->highlight();
661  aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_AND_VIEW));
662  aws->create_button("SAVE_AND_VIEW", "Save & View");
663 
664  aws->at("overlay1");
665  aws->label("Overlay statistics with same prefix?");
666  aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX);
667 
668  aws->at("overlay2");
669  aws->label("Overlay statistics with same postfix?");
670  aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX);
671 
672  aws->at("del_overlays");
673  aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_CLEANUP));
674  aws->create_autosize_button("DEL_OVERLAYS", "Delete currently overlayed files", "D", 2);
675 
676  return aws;
677 }
678 
679 
GB_ERROR GB_get_error()
Definition: arb_msg.cxx:344
void awt_create_filter_awars(AW_root *aw_root, AW_default aw_def, const char *awar_filtername, const char *awar_mapto_alignment)
Definition: AWT_filter.cxx:193
const char * GB_ERROR
Definition: arb_core.h:25
GB_TYPES type
#define AWAR_CS2GP_FILTER_NAME
const float * get_frequencies(unsigned char c) const
Definition: ColumnStat.hxx:93
static GB_ERROR split_stat_filename(const char *fname, char **dirPtr, char **name_prefixPtr, char **name_postfixPtr)
void insert_default(const char *displayed, const AW_scalar &value)
Definition: AW_select.cxx:385
char * GB_find_all_files(const char *dir, const char *mask, bool filename_only)
Definition: adfile.cxx:109
Definition: trnsprob.h:20
void AW_create_standard_fileselection(AW_window *aws, const char *awar_prefix)
Definition: aw_file.hxx:30
#define AWAR_CS2GP_DIRECTORY
static PlotType string2PlotType(const char *type)
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
#define AWAR_DEFAULT_ALIGNMENT
Definition: aw_awar_defs.hxx:8
static void colstat_2_gnuplot_cb(AW_window *aww, PlotParam *param, PlotMode mode)
long read_int() const
Definition: AW_awar.cxx:187
Smoother(size_t smooth_range)
AW_awar * set_minmax(float min, float max)
Definition: AW_awar.cxx:532
void COLSTAT_create_selection_list(AW_window *aws, ColumnStat *column_stat)
Definition: ColumnStat.cxx:369
const char * title
Definition: readseq.c:22
long GBT_get_alignment_len(GBDATA *gb_main, const char *aliname)
Definition: adali.cxx:706
static char * alignment_name
void AW_POPDOWN(AW_window *window)
Definition: AW_window.cxx:52
AW_awar * add_callback(const RootCallback &cb)
Definition: AW_awar.cxx:234
void insert(const char *displayed, const AW_scalar &value)
Definition: AW_select.cxx:380
#define AWAR_CS2GP
const char * read_char_pntr() const
Definition: AW_awar.cxx:171
unsigned int GB_UINT4
Definition: arbdb_base.h:37
GB_ERROR GB_await_error()
Definition: arb_msg.cxx:353
WindowCallback makeHelpCallback(const char *helpfile)
Definition: aw_window.hxx:106
char * def_alignment
Definition: awt_filter.hxx:36
const float * get_rates() const
Definition: ColumnStat.hxx:90
const float * get_ttratio() const
Definition: ColumnStat.hxx:91
#define AWAR_CS2GP_SMOOTH_VALUES
void GB_clear_error()
Definition: arb_msg.cxx:365
static int weights[MAX_BASETYPES][MAX_BASETYPES]
Definition: ClustalV.cxx:71
void touch()
Definition: AW_awar.cxx:210
static void error(const char *msg)
Definition: mkptypes.cxx:96
FILE * GB_fopen_tempfile(const char *filename, const char *fmode, char **res_fullname)
Definition: adsocket.cxx:1121
void AW_create_fileselection_awars(AW_root *awr, const char *awar_base, const char *directories, const char *filter, const char *file_name)
Definition: AW_file.cxx:72
#define AWAR_CS2GP_SUFFIX
__ATTR__USERESULT GB_ERROR calculate(AP_filter *filter)
Definition: ColumnStat.cxx:107
adfiltercbstruct * awt_create_select_filter(AW_root *aw_root, GBDATA *gb_main, const char *def_name)
Definition: AWT_filter.cxx:224
AW_window * awt_create_select_filter_win(AW_root *aw_root, adfiltercbstruct *acbs)
Definition: AWT_filter.cxx:364
NOT4PERL GB_ERROR GB_xcmd(const char *cmd, XCMD_TYPE exectype) __ATTR__USERESULT_TODO
Definition: adsocket.cxx:853
char * read_string() const
Definition: AW_awar.cxx:201
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
void print(FILE *out, size_t i, double v)
ColumnStat * colstat
#define AWAR_CS2GP_FILENAME
#define nt_assert(cond)
Definition: NT_local.h:27
char * GB_unique_filename(const char *name_prefix, const char *suffix)
Definition: adsocket.cxx:1178
AW_window * NT_create_colstat_2_gnuplot_window(AW_root *root)
GB_ERROR GB_export_errorf(const char *templat,...)
Definition: arb_msg.cxx:264
#define AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:580
Definition: trnsprob.h:20
#define AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX
const GB_UINT4 * get_weights() const
Definition: ColumnStat.hxx:89
static char * get_overlay_files(AW_root *awr, const char *fname, GB_ERROR &error)
void aw_message(const char *msg)
Definition: AW_status.cxx:932
SortedFreq(const ColumnStat *column_stat)
AW_root * get_root()
Definition: aw_window.hxx:348
adfiltercbstruct * filterdef
size_t get_length() const
Definition: ColumnStat.hxx:87
#define NULp
Definition: cxxforward.h:97
GBDATA * gb_main
Definition: NT_local.h:36
PlotParam(ColumnStat *colstat_, adfiltercbstruct *filterdef_)
static const char * plotTypeName[PT_PLOT_TYPES]
static void colstat_ali_changed_cb(AW_root *root, AW_awar *awar_ali)
GB_transaction ta(gb_var)
Definition: trnsprob.h:20
static const char * plotTypeDescription[PT_PLOT_TYPES]
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:570
#define AWAR_CS2GP_NAME
static const char * makeTitle(const char *fname)
#define AWAR_CS2GP_SMOOTH_GNUPLOT
const bool * get_is_helix() const
Definition: ColumnStat.hxx:92
#define AW_ROOT_DEFAULT
Definition: aw_base.hxx:106
char * GBS_global_string_copy(const char *templat,...)
Definition: arb_msg.cxx:195
NT_global GLOBAL
Definition: NT_main.cxx:44