in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / Configuration.java
1 // $Id:
2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
4 //
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
7 // Copyright (C) 2000-2001 Washington University School of Medicine
8 // and Howard Hughes Medical Institute
9 // Copyright (C) 2003-2007 Ethalinda K.S. Cannon
10 // All rights reserved
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 //
26 // Contact: phylosoft @ gmail . com
27 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
28
29 package org.forester.archaeopteryx;
30
31 import java.awt.Color;
32 import java.io.BufferedReader;
33 import java.io.File;
34 import java.io.FileReader;
35 import java.io.IOException;
36 import java.io.InputStreamReader;
37 import java.net.URL;
38 import java.util.Arrays;
39 import java.util.Hashtable;
40 import java.util.Map;
41 import java.util.SortedMap;
42 import java.util.StringTokenizer;
43 import java.util.TreeMap;
44
45 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
46 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
47 import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
48 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
49 import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
50 import org.forester.phylogeny.data.NodeDataField;
51 import org.forester.phylogeny.data.NodeVisualData;
52 import org.forester.phylogeny.data.NodeVisualData.NodeFill;
53 import org.forester.phylogeny.data.NodeVisualData.NodeShape;
54 import org.forester.util.ForesterUtil;
55
56 public final class Configuration {
57
58     public enum EXT_NODE_DATA_RETURN_ON {
59         BUFFER_ONLY, CONSOLE, WINODW;
60     }
61
62     public enum UI {
63         CROSSPLATFORM, NATIVE, NIMBUS, UNKNOWN
64     }
65
66     static enum TRIPLET {
67         FALSE, TRUE, UNKNOWN
68     }
69     final static String                     clickto_options[][]                                    = {
70         { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
71         { "Go to Sub/Supertree", "display" }, { "Swap Descendants", "display" },
72         { "Colorize Node(s)", "display" }, { "Change Node Font(s)", "display" },
73         { "Colorize Subtree(s)", "display" }, { "Open Sequence DB", "display" }, { "Open PDB", "display" },
74         { "Open Taxonomy DB", "display" }, { "Launch BLAST", "display" }, { "Cut Subtree", "display" },
75         { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
76         { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Sort Descendants", "display" },
77         { "List Node Data", "display" }, { "Select Node(s)", "display" } , { "Uncollapse All", "display" },  { "Order Subtree", "display" },                     };
78     private final static String             DEFAULT_SPECIES_COLORS[][]                             = {
79         { "BRAFL", "0x00FFFF" }, { "SPHGR", "0x9620F0" }, { "STRPU", "0x9620F0" }, { "CIOIN", "0xFF1CAE" },
80         { "CIOSA", "0xFF2CAE" }, { "BOVIN", "0x5C3317" }, { "CANFA", "0x8B2323" }, { "HUMAN", "0xFF2400" },
81         { "PANTR", "0xCC2400" }, { "MOUSE", "0xFF7F00" }, { "RAT", "0xFFEF00" }, { "MONDO", "0xEE9A49" },
82         { "ORNAN", "0xCD853F" }, { "XENLA", "0x6BAA23" }, { "XENTR", "0x6BAA23" }, { "CHICK", "0xFFC125" },
83         { "FUGRU", "0x0000FF" }, { "BRARE", "0x0000DD" }, { "DANRE", "0x0000BB" }, { "TETNG", "0x0000AA" },
84         { "ORYLA", "0x000088" }, { "GASAC", "0x000066" }, { "CAEEL", "0x666699" }, { "CAEBR", "0xB0B0B0" },
85         { "DROME", "0x663366" }, { "DROPS", "0x996699" }, { "APIME", "0x7A7700" }, { "AEDAE", "0x8C5900" },
86         { "TRICA", "0x918E00" }, { "NEMVE", "0x0066CC" }, { "HYDVU", "0x3399FF" }, { "LUBBA", "0xF7B5CB" },
87         { "GEOCY", "0xF5A0BD" }, { "AMPQE", "0x009966" }, { "SUBDO", "0xC790B9" }, { "MONBE", "0xFC0FC0" },
88         { "DICPU", "0xFFCC33" }, { "DICDI", "0xFFCC00" }, { "ENTHI", "0x5959AB" }, { "ARATH", "0x00FF00" },
89         { "POPTR", "0x006400" }, { "VITVI", "0x00CD00" }, { "GLYMA", "0x00FF7F" }, { "ORYSA", "0x008B00" },
90         { "ORYSJ", "0x008C00" }, { "SORBI", "0x00EE76" }, { "SELMO", "0x238E23" }, { "PHYPA", "0x09F911" },
91         { "OSTLU", "0x7FFF00" }, { "OSTTA", "0x7FFF00" }, { "OSTRC", "0x7FFF00" }, { "MICPU", "0x66CD00" },
92         { "MIC99", "0x66CD00" }, { "CHLRE", "0xB3EE3A" }, { "VOLCA", "0xC0FF3E" }, { "CHLSP", "0x6B8E23" },
93         { "CYAME", "0xD02090" }, { "YEAST", "0xAAAAAA" }, { "BACFR", "0xFF0000" }, { "BACTN", "0xFFFF00" },
94         { "MYXXD", "0x0000FF" }, { "STIAU", "0x00FFFF" }, { "BACOV", "0x8C5900" }, { "BACUN", "0x66CD00" },
95         { "PORGI", "0x918E00" }                                                               };
96     final static int                        display_node_data                                      = 0;
97     final static int                        collapse_uncollapse                                    = 1;
98     final static int                        reroot                                                 = 2;
99     final static int                        subtree                                                = 3;
100     final static int                        swap                                                   = 4;
101     final static int                        color_node_font                                        = 5;
102     final static int                        change_node_font                                       = 6;
103     final static int                        color_subtree                                          = 7;
104     final static int                        open_seq_web                                           = 8;
105     final static int                        open_pdb_web                                           = 9;
106     final static int                        open_tax_web                                           = 10;
107     final static int                        blast                                                  = 11;
108     final static int                        cut_subtree                                            = 12;
109     final static int                        copy_subtree                                           = 13;
110     final static int                        paste_subtree                                          = 14;
111     final static int                        delete_subtree_or_node                                 = 15;
112     final static int                        add_new_node                                           = 16;
113     final static int                        edit_node_data                                         = 17;
114     final static int                        sort_descendents                                       = 18;
115     final static int                        get_ext_desc_data                                      = 19;
116     final static int                        select_nodes                                           = 20;
117     final static int                        uncollapse_all                                         = 21;
118     final static int                        order_subtree                                         = 22;
119     
120     // ------------------
121     // Click-to options
122     // ------------------
123     final static String                     display_options[][]                                    = {
124         { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
125         { "Seq Annotations", "display", "no" }, { "Confidence Values", "display", "?" },
126         { "Node Events", "display", "?" }, { "Colorize by Taxonomy", "display", "no" },
127         { "Colorize by Sequence", "display", "no" }, { "Visual Styles/Branch Colors", "display", "no" },
128         { "Branch Widths", "display", "no" }, { "Domain Architectures", "display", "no" },
129         { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" },
130         { "Seq Name", "display", "yes" }, { "Seq Accession", "display", "no" },
131         { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" },
132         { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" },
133         { "Colorize by Annotation", "display", "no" }, { "Seq Symbol", "display", "yes" },
134         { "Rollover", "display", "yes" }, { "Relation Confidence", "nodisplay", "no" },
135         { "Vector Data", "nodisplay", "no" }, { "Taxonomy Images", "display", "no" },
136         { "Properties", "display", "no" }, { "Gene Name", "display", "yes" },
137         { "Multiple Seq Alignment", "display", "no" }, { "Branch Length Values", "display", "no" }
138         , { "Taxonomy Rank", "display", "no" }, { "Show External Data", "display", "yes" }};
139     final static int                        display_as_phylogram                                   = 0;
140     final static int                        show_node_names                                        = 1;
141     final static int                        show_tax_code                                          = 2;
142     final static int                        show_annotation                                        = 3;
143     final static int                        write_confidence_values                                = 4;
144     final static int                        write_events                                           = 5;
145     final static int                        color_according_to_species                             = 6;
146     final static int                        color_according_to_sequence                            = 7;
147     final static int                        use_style                                              = 8;
148     final static int                        width_branches                                         = 9;
149     final static int                        show_domain_architectures                              = 10;
150     final static int                        show_binary_characters                                 = 11;
151     final static int                        show_binary_character_counts                           = 12;
152     final static int                        show_seq_names                                         = 13;
153     final static int                        show_sequence_acc                                      = 14;
154     final static int                        display_internal_data                                  = 15;
155     final static int                        dynamically_hide_data                                  = 16;
156     final static int                        show_taxonomy_scientific_names                         = 17;
157     final static int                        show_taxonomy_common_names                             = 18;
158     final static int                        color_according_to_annotation                          = 19;
159     final static int                        show_seq_symbols                                       = 20;
160     final static int                        node_data_popup                                        = 21;
161     final static int                        show_relation_confidence                               = 22;
162     final static int                        show_vector_data                                       = 23;
163     final static int                        show_taxonomy_images                                   = 24;
164     final static int                        show_properties                                        = 25;
165     final static int                        show_gene_names                                        = 26;
166     final static int                        show_mol_seqs                                          = 27;
167     final static int                        write_branch_length_values                             = 28;
168     final static int                        show_tax_rank                                          = 29;
169     final static int                        display_external_data                                  = 30;
170     
171     static final String                     VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA                   = "validate_against_phyloxml_xsd_schema";
172     private static Hashtable<String, Color> _sequence_colors;
173     private static Hashtable<String, Color> _annotation_colors;
174     private static Hashtable<String, Color> _domain_colors;
175     private static Hashtable<String, Color> _species_colors;
176     private static String                   DEFAULT_FONT_FAMILY                                    = "";
177     private static final int                DEPRECATED                                             = -2;
178     private static final String             DISPLAY_COLOR_KEY                                      = "display_color";
179     // ---------------------------
180     // Display options for trees
181     // ---------------------------
182     // ---------------------------------
183     // Pertaining to the config itself
184     // ---------------------------------
185     // Full path to config (may be URL)
186     String                                  config_filename;
187     // This option is selected in the dropdown
188     int                                     default_clickto                                        = Configuration.display_node_data;
189     String                                  default_config_filename                                = AptxConstants.DEFAULT_CONFIGURATION_FILE_NAME;
190     // --------------
191     // Color set
192     // --------------
193     TreeColorSet                            tree_color_set;
194     // -------
195     // Fonts
196     // -------
197     TreeFontSet                             tree_font_set;
198     boolean                                 verbose                                                = AptxConstants.VERBOSE_DEFAULT;
199     private boolean                         _abbreviate_scientific_names                           = false;
200     private boolean                         _antialias_screen                                      = true;
201     private boolean                         _background_color_gradient                             = false;
202     private String                          _base_font_family_name                                 = "";
203     private int                             _base_font_size                                        = -1;
204     private CLADOGRAM_TYPE                  _cladogram_type                                        = AptxConstants.CLADOGRAM_TYPE_DEFAULT;
205     private boolean                         _color_labels_same_as_parent_branch                    = false;
206     private int                             _default_bootstrap_samples                             = -1;
207     private NodeFill                        _default_node_fill                                     = NodeFill.SOLID;
208     private NodeShape                       _default_node_shape                                    = NodeShape.RECTANGLE;
209     private short                           _default_node_shape_size                               = AptxConstants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
210     private SortedMap<String, Color>        _display_colors                                        = null;
211     private boolean                         _display_sequence_relations                            = false;
212     private boolean                         _editable                                              = true;
213     private NodeDataField                   _ext_desc_data_to_return                               = NodeDataField.UNKNOWN;
214     private EXT_NODE_DATA_RETURN_ON         _ext_node_data_return_on                               = EXT_NODE_DATA_RETURN_ON.WINODW;
215     private int                             _frame_x_size;
216     private int                             _frame_y_size;
217     private Color                           _gui_background_color                                  = AptxConstants.GUI_BACKGROUND_DEFAULT;
218     private Color                           _gui_button_background_color                           = AptxConstants.BUTTON_BACKGROUND_COLOR_DEFAULT;
219     private Color                           _gui_button_border_color                               = AptxConstants.BUTTON_BORDER_COLOR_DEFAULT;
220     private Color                           _gui_button_text_color                                 = AptxConstants.BUTTON_TEXT_COLOR_DEFAULT;
221     private Color                           _gui_checkbox_and_button_active_color                  = AptxConstants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
222     private Color                           _gui_checkbox_text_color                               = AptxConstants.CHECKBOX_TEXT_COLOR_DEFAULT;
223     private Color                           _gui_menu_background_color                             = AptxConstants.MENU_BACKGROUND_COLOR_DEFAULT;
224     private Color                           _gui_menu_text_color                                   = AptxConstants.MENU_TEXT_COLOR_DEFAULT;
225     private boolean                         _hide_controls_and_menus                               = false;
226     private boolean                         _internal_number_are_confidence_for_nh_parsing         = false;
227     private String                          _label_for_get_ext_descendents_data                    = "";
228     private int                             _max_base_font_size                                    = 20;
229     private boolean                         _midpoint_root                                         = false;
230     private int                             _min_base_font_size                                    = 2;
231     private double                          _min_confidence_value                                  = Options.MIN_CONFIDENCE_DEFAULT;
232     private boolean                         _nh_parsing_replace_underscores                        = false;
233     private NODE_LABEL_DIRECTION            _node_label_direction                                  = NODE_LABEL_DIRECTION.HORIZONTAL;
234     private short                           _number_of_digits_after_comma_for_branch_length_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
235     private short                           _number_of_digits_after_comma_for_confidence_values    = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
236     private short                           _ov_max_height                                         = 80;
237     private short                           _ov_max_width                                          = 80;
238     private OVERVIEW_PLACEMENT_TYPE         _ov_placement                                          = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
239     private File                            _path_to_local_fastme                                  = null;
240     private File                            _path_to_local_mafft                                   = null;
241     private File                            _path_to_local_raxml                                   = null;
242     private PHYLOGENY_GRAPHICS_TYPE         _phylogeny_graphics_type                               = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
243     private float                           _print_line_width                                      = AptxConstants.PDF_LINE_WIDTH_DEFAULT;
244     private boolean                         _show_annotation_ref_source                            = true;
245     private boolean                         _show_default_node_shapes_external                     = false;
246     private boolean                         _show_default_node_shapes_for_marked_nodes             = false;
247     private boolean                         _show_default_node_shapes_internal                     = false;
248     private boolean                         _show_domain_labels                                    = true;
249     private boolean                         _show_overview                                         = true;
250     private boolean                         _show_scale                                            = false;
251     private TAXONOMY_EXTRACTION             _taxonomy_extraction                                   = TAXONOMY_EXTRACTION.NO;
252     private UI                              _ui                                                    = UI.UNKNOWN;
253     private boolean                         _use_tabbed_display                                    = false;
254     private boolean                         _validate_against_phyloxml_xsd_schema                  = AptxConstants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
255     private Color                           _vector_data_min_color                                 = Color.BLUE;
256     private Color                           _vector_data_max_color                                 = Color.YELLOW;
257     private Color                           _vector_data_mean_color                                = Color.WHITE;
258     private double                          _vector_data_height                                    = 12;
259     private int                             _vector_data_width                                     = 120;
260     private boolean                         _line_up_renderable_node_data                          = true;
261     private boolean                         _right_align_domains                                   = false;
262     private boolean                         _allow_thick_strokes                                   = false;
263     private boolean                         _could_read_config_file = false;
264     static {
265         for( final String font_name : AptxConstants.DEFAULT_FONT_CHOICES ) {
266             if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
267                 DEFAULT_FONT_FAMILY = font_name;
268                 break;
269             }
270         }
271         if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
272             DEFAULT_FONT_FAMILY = AptxConstants.DEFAULT_FONT_CHOICES[ AptxConstants.DEFAULT_FONT_CHOICES.length - 1 ];
273         }
274     }
275
276     public Configuration() {
277         this( null, false, false, false );
278     }
279
280     public Configuration( final String cf, final boolean is_url, final boolean is_applet, final boolean verbose ) {
281         if ( ForesterUtil.isEmpty( cf ) ) {
282             config_filename = default_config_filename;
283         }
284         else {
285             config_filename = cf;
286         }
287         _could_read_config_file = false;
288         setDisplayColors( new TreeMap<String, Color>() );
289         config_filename = config_filename.trim();
290         URL u = null;
291         if ( is_url ) {
292             // If URL, open accordingly
293             try {
294                 u = new URL( config_filename );
295                 try {
296                     final InputStreamReader isr = new InputStreamReader( u.openStream() );
297                     final BufferedReader bf = new BufferedReader( isr );
298                     readConfig( bf );
299                     bf.close();
300                     ForesterUtil.programMessage( AptxConstants.PRG_NAME, "successfully read from configuration url ["
301                             + config_filename + "]" );
302                     _could_read_config_file = true;
303                 }
304                 catch ( final Exception e ) {
305                     ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "failed to read configuration from ["
306                             + config_filename + "]: " + e.getLocalizedMessage() );
307                 }
308             }
309             catch ( final Exception e ) {
310                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "cannot find or open configuration url ["
311                         + config_filename + "]" );
312             }
313         }
314         else {
315             // Otherwise, open as a file
316             File f = new File( config_filename );
317             if ( !f.exists() ) {
318                 f = new File( config_filename + ".txt" );
319             }
320             if ( f.exists() && f.canRead() ) {
321                 try {
322                     final BufferedReader bf = new BufferedReader( new FileReader( f ) );
323                     readConfig( bf );
324                     bf.close();
325                     _could_read_config_file = true;
326                 }
327                 catch ( final Exception e ) {
328                     if ( verbose ) {
329                         ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "failed to read configuration from ["
330                                 + config_filename + "]: " + e );
331                     }
332                 }
333             }
334             else {
335                 if ( verbose ) {
336                     ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "cannot find or open configuration file ["
337                             + config_filename + "]" );
338                 }
339             }
340         }
341     }
342
343     public String getBaseFontFamilyName() {
344         return _base_font_family_name;
345     }
346
347     public int getDefaultBootstrapSamples() {
348         return _default_bootstrap_samples;
349     }
350
351     public NodeFill getDefaultNodeFill() {
352         return _default_node_fill;
353     }
354
355     public NodeShape getDefaultNodeShape() {
356         return _default_node_shape;
357     }
358
359     public short getDefaultNodeShapeSize() {
360         return _default_node_shape_size;
361     }
362
363     public NodeDataField getExtDescNodeDataToReturn() {
364         return _ext_desc_data_to_return;
365     }
366
367     public EXT_NODE_DATA_RETURN_ON getExtNodeDataReturnOn() {
368         return _ext_node_data_return_on;
369     }
370
371     public int getFrameXSize() {
372         return _frame_x_size;
373     }
374
375     public int getFrameYSize() {
376         return _frame_y_size;
377     }
378
379     public String getLabelForGetExtDescendentsData() {
380         return _label_for_get_ext_descendents_data;
381     }
382
383     public File getPathToLocalFastme() {
384         return _path_to_local_fastme;
385     }
386
387     public File getPathToLocalMafft() {
388         return _path_to_local_mafft;
389     }
390
391     public File getPathToLocalRaxml() {
392         return _path_to_local_raxml;
393     }
394
395     public double getVectorDataHeight() {
396         return _vector_data_height;
397     }
398
399     public Color getVectorDataMaxColor() {
400         return _vector_data_max_color;
401     }
402
403     public Color getVectorDataMeanColor() {
404         return _vector_data_mean_color;
405     }
406
407     public Color getVectorDataMinColor() {
408         return _vector_data_min_color;
409     }
410
411     public int getVectorDataWidth() {
412         return _vector_data_width;
413     }
414
415     public boolean isAbbreviateScientificTaxonNames() {
416         return _abbreviate_scientific_names;
417     }
418
419     public boolean isAllowThickStrokes() {
420         return _allow_thick_strokes;
421     }
422
423     public boolean isBackgroundColorGradient() {
424         return _background_color_gradient;
425     }
426
427     public boolean isColorByTaxonomicGroup() {
428         return false;
429     }
430
431     public boolean isColorLabelsSameAsParentBranch() {
432         return _color_labels_same_as_parent_branch;
433     }
434
435     final public boolean isLineUpRendarableNodeData() {
436         return _line_up_renderable_node_data;
437     }
438
439     public boolean isMidpointReroot() {
440         return _midpoint_root;
441     }
442
443     final public boolean isRightLineUpDomains() {
444         return _right_align_domains;
445     }
446
447     public boolean isShowAnnotationRefSource() {
448         return _show_annotation_ref_source;
449     }
450
451     public boolean isShowDefaultNodeShapesExternal() {
452         return _show_default_node_shapes_external;
453     }
454
455     public boolean isShowDefaultNodeShapesForMarkedNodes() {
456         return _show_default_node_shapes_for_marked_nodes;
457     }
458
459     public boolean isShowDefaultNodeShapesInternal() {
460         return _show_default_node_shapes_internal;
461     }
462
463     public boolean isShowDomainLabels() {
464         return _show_domain_labels;
465     }
466
467     public void putDisplayColors( final String key, final Color color ) {
468         getDisplayColors().put( key, color );
469     }
470
471     public void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
472         _abbreviate_scientific_names = abbreviate_scientific_names;
473     }
474
475     public void setAddTaxonomyImagesCB( final boolean b ) {
476         display_options[ show_taxonomy_images ][ 1 ] = b ? "yes" : "no";
477     }
478
479     public void setBackgroundColorGradient( final boolean background_color_gradient ) {
480         _background_color_gradient = background_color_gradient;
481     }
482
483     public void setBaseFontFamilyName( final String base_font_family_name ) {
484         _base_font_family_name = base_font_family_name;
485     }
486
487     public void setBaseFontSize( final int base_font_size ) {
488         _base_font_size = base_font_size;
489     }
490
491     public void setColorizeBranches( final boolean b ) {
492         display_options[ use_style ][ 2 ] = b ? "yes" : "no";
493     }
494
495     public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
496         _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
497     }
498
499     public void setDefaultNodeFill( final NodeFill default_node_fill ) {
500         _default_node_fill = default_node_fill;
501     }
502
503     public void setDefaultNodeShape( final NodeShape default_node_shape ) {
504         _default_node_shape = default_node_shape;
505     }
506
507     public void setDefaultNodeShapeSize( final short default_node_shape_size ) {
508         _default_node_shape_size = default_node_shape_size;
509     }
510
511     public void setDisplayAsPhylogram( final boolean b ) {
512         display_options[ display_as_phylogram ][ 2 ] = b ? "yes" : "no";
513     }
514
515     public void setDisplayColors( final SortedMap<String, Color> display_colors ) {
516         _display_colors = display_colors;
517     }
518
519     public void setDisplayConfidenceValues( final boolean b ) {
520         display_options[ write_confidence_values ][ 2 ] = b ? "yes" : "no";
521     }
522
523     public void setDisplayGeneNames( final boolean b ) {
524         display_options[ show_gene_names ][ 2 ] = b ? "yes" : "no";
525     }
526
527     public void setDisplayInternalData( final boolean b ) {
528         display_options[ display_internal_data ][ 2 ] = b ? "yes" : "no";
529     }
530     
531     public void setDisplayExternalData( final boolean b ) {
532         display_options[ display_external_data ][ 2 ] = b ? "yes" : "no";
533     }
534
535     public void setDisplayMultipleSequenceAlignment( final boolean b ) {
536         display_options[ show_mol_seqs ][ 2 ] = b ? "yes" : "no";
537     }
538
539     public void setDisplayNodeNames( final boolean b ) {
540         display_options[ show_node_names ][ 2 ] = b ? "yes" : "no";
541     }
542
543     public void setDisplaySequenceAcc( final boolean b ) {
544         display_options[ show_sequence_acc ][ 2 ] = b ? "yes" : "no";
545     }
546
547     public void setDisplaySequenceNames( final boolean b ) {
548         display_options[ show_seq_names ][ 2 ] = b ? "yes" : "no";
549     }
550
551     public void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
552         _display_sequence_relations = display_sequence_relations;
553     }
554
555     public void setDisplaySequenceSymbols( final boolean b ) {
556         display_options[ show_seq_symbols ][ 2 ] = b ? "yes" : "no";
557     }
558
559     public void setDisplayTaxonomyCode( final boolean b ) {
560         display_options[ show_tax_code ][ 2 ] = b ? "yes" : "no";
561     }
562     
563     public void setDisplayTaxonomyRank( final boolean b ) {
564         display_options[ show_tax_rank ][ 2 ] = b ? "yes" : "no";
565     }
566
567     public void setDisplayTaxonomyCommonNames( final boolean b ) {
568         display_options[ show_taxonomy_common_names ][ 2 ] = b ? "yes" : "no";
569     }
570
571     public void setDisplayTaxonomyImages( final boolean b ) {
572         display_options[ show_taxonomy_images ][ 2 ] = b ? "yes" : "no";
573     }
574
575     public void setDisplayTaxonomyScientificNames( final boolean b ) {
576         display_options[ show_taxonomy_scientific_names ][ 2 ] = b ? "yes" : "no";
577     }
578
579     public void setDynamicallyHideData( final boolean b ) {
580         display_options[ dynamically_hide_data ][ 2 ] = b ? "yes" : "no";
581     }
582
583     public void setExtDescNodeDataToReturn( final NodeDataField ext_desc_data_to_return ) {
584         _ext_desc_data_to_return = ext_desc_data_to_return;
585     }
586
587     public void setFrameXSize( final int frame_x_size ) {
588         _frame_x_size = frame_x_size;
589     }
590
591     public void setFrameYSize( final int frame_y_size ) {
592         _frame_y_size = frame_y_size;
593     }
594
595     final public void setLineUpRendarableNodeData( final boolean line_up_renderable_node_data ) {
596         _line_up_renderable_node_data = line_up_renderable_node_data;
597     }
598
599     public void setMidpointReroot( final boolean midpoint_root ) {
600         _midpoint_root = midpoint_root;
601     }
602
603     public void setMinConfidenceValue( final double min_confidence_value ) {
604         _min_confidence_value = min_confidence_value;
605     }
606
607     public void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
608         _node_label_direction = node_label_direction;
609     }
610
611     public void setNumberOfDigitsAfterCommaForBranchLengthValue( final short number_of_digits_after_comma_for_branch_length_values ) {
612         _number_of_digits_after_comma_for_branch_length_values = number_of_digits_after_comma_for_branch_length_values;
613     }
614
615     public void setNumberOfDigitsAfterCommaForConfidenceValues( final short number_of_digits_after_comma_for_confidence_values ) {
616         _number_of_digits_after_comma_for_confidence_values = number_of_digits_after_comma_for_confidence_values;
617     }
618
619     public void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
620         _phylogeny_graphics_type = phylogeny_graphics_type;
621     }
622
623     public void setPrintLineWidth( final float print_line_width ) {
624         _print_line_width = print_line_width;
625     }
626
627     public void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
628         _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
629     }
630
631     final public void setRightLineUpDomains( final boolean right_align_domains ) {
632         _right_align_domains = right_align_domains;
633     }
634
635     public void setShowDefaultNodeShapesExternal( final boolean show_default_node_shapes_external ) {
636         _show_default_node_shapes_external = show_default_node_shapes_external;
637     }
638
639     public void setShowDefaultNodeShapesForMarkedNodes( final boolean show_default_node_shapes_for_marked_nodes ) {
640         _show_default_node_shapes_for_marked_nodes = show_default_node_shapes_for_marked_nodes;
641     }
642
643     public void setShowDefaultNodeShapesInternal( final boolean show_default_node_shapes_internal ) {
644         _show_default_node_shapes_internal = show_default_node_shapes_internal;
645     }
646
647     public void setShowDomainLabels( final boolean show_domain_labels ) {
648         _show_domain_labels = show_domain_labels;
649     }
650
651     public void setShowScale( final boolean show_scale ) {
652         _show_scale = show_scale;
653     }
654
655     public void setUseStyle( final boolean b ) {
656         display_options[ use_style ][ 2 ] = b ? "yes" : "no";
657     }
658
659     private int getClickToIndex( final String name ) {
660         int index = -1;
661         if ( name.equals( "edit_info" ) ) {
662             index = Configuration.display_node_data;
663             ForesterUtil
664             .printWarningMessage( AptxConstants.PRG_NAME,
665                                   "configuration key [edit_info] is deprecated, use [display node data] instead" );
666         }
667         else if ( name.equals( "display_node_data" ) ) {
668             index = Configuration.display_node_data;
669         }
670         else if ( name.equals( "collapse_uncollapse" ) ) {
671             index = Configuration.collapse_uncollapse;
672         }
673         else if ( name.equals( "uncollapse_all" ) ) {
674             index = Configuration.uncollapse_all;
675         }
676         else if ( name.equals( "reroot" ) ) {
677             index = Configuration.reroot;
678         }
679         else if ( name.equals( "subtree" ) ) {
680             index = Configuration.subtree;
681         }
682         else if ( name.equals( "swap" ) ) {
683             index = Configuration.swap;
684         }
685         else if ( name.equals( "order_subtree" ) ) {
686             index = Configuration.order_subtree;
687         }
688         else if ( name.equals( "sort_descendants" ) ) {
689             index = Configuration.sort_descendents;
690         }
691         else if ( name.equals( "get_ext_descendents_data" ) ) {
692             index = Configuration.get_ext_desc_data;
693         }
694         else if ( name.equals( "display_sequences" ) ) {
695             ForesterUtil
696             .printWarningMessage( AptxConstants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
697             return DEPRECATED;
698         }
699         else if ( name.equals( "open_seq_web" ) ) {
700             index = Configuration.open_seq_web;
701         }
702         else if ( name.equals( "open_pdb_web" ) ) {
703             index = Configuration.open_pdb_web;
704         }
705         else if ( name.equals( "open_tax_web" ) ) {
706             index = Configuration.open_tax_web;
707         }
708         else if ( name.equals( "blast" ) ) {
709             index = Configuration.blast;
710         }
711         else if ( name.equals( "cut_subtree" ) ) {
712             index = Configuration.cut_subtree;
713         }
714         else if ( name.equals( "copy_subtree" ) ) {
715             index = Configuration.copy_subtree;
716         }
717         else if ( name.equals( "paste_subtree" ) ) {
718             index = Configuration.paste_subtree;
719         }
720         else if ( name.equals( "delete" ) ) {
721             index = Configuration.delete_subtree_or_node;
722         }
723         else if ( name.equals( "add_new_node" ) ) {
724             index = Configuration.add_new_node;
725         }
726         else if ( name.equals( "edit_node_data" ) ) {
727             index = Configuration.edit_node_data;
728         }
729         else if ( name.equals( "select_nodes" ) ) {
730             index = Configuration.select_nodes;
731         }
732         else if ( name.equals( "display_node_popup" ) ) {
733             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
734                     "configuration key [display_node_popup] is deprecated" );
735             return DEPRECATED;
736         }
737         else if ( name.equals( "custom_option" ) ) {
738             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "configuration key [custom_option] is deprecated" );
739             return DEPRECATED;
740         }
741         else if ( name.equals( "color_subtree" ) ) {
742             index = Configuration.color_subtree;
743         }
744         else if ( name.equals( "change_node_font" ) ) {
745             index = Configuration.change_node_font;
746         }
747         else if ( name.equals( "color_node_font" ) ) {
748             index = Configuration.color_node_font;
749         }
750         else if ( name.equals( "color_subtree" ) ) {
751             index = Configuration.color_subtree;
752         }
753         return index;
754     }
755
756     private final void initSpeciesColors() {
757         _species_colors = new Hashtable<String, Color>();
758         for( final String[] s : DEFAULT_SPECIES_COLORS ) {
759             _species_colors.put( s[ 0 ], Color.decode( s[ 1 ] ) );
760         }
761     }
762
763     private boolean parseBoolean( final String str ) {
764         final String my_str = str.trim().toLowerCase();
765         if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
766             return true;
767         }
768         else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
769             return false;
770         }
771         else {
772             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
773             return false;
774         }
775     }
776
777     private double parseDouble( final String str ) {
778         double d = 0.0;
779         try {
780             d = Double.parseDouble( str.trim() );
781         }
782         catch ( final Exception e ) {
783             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse double from [" + str + "]" );
784             d = 0.0;
785         }
786         return d;
787     }
788
789     private float parseFloat( final String str ) {
790         float f = 0.0f;
791         try {
792             f = Float.parseFloat( str.trim() );
793         }
794         catch ( final Exception e ) {
795             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse float from [" + str + "]" );
796             f = 0.0f;
797         }
798         return f;
799     }
800
801     private int parseInt( final String str ) {
802         int i = -1;
803         try {
804             i = Integer.parseInt( str.trim() );
805         }
806         catch ( final Exception e ) {
807             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse integer from [" + str + "]" );
808             i = -1;
809         }
810         return i;
811     }
812
813     private short parseShort( final String str ) {
814         short i = -1;
815         try {
816             i = Short.parseShort( str.trim() );
817         }
818         catch ( final Exception e ) {
819             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse short from [" + str + "]" );
820             i = -1;
821         }
822         return i;
823     }
824
825     private void processFontFamily( final StringTokenizer st ) {
826         setBaseFontFamilyName( "" );
827         final String font_str = ( ( String ) st.nextElement() ).trim();
828         final String[] fonts = font_str.split( ",+" );
829         for( String font : fonts ) {
830             font = font.replace( '_', ' ' ).trim();
831             if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
832                 setBaseFontFamilyName( font );
833                 break;
834             }
835         }
836     }
837
838     /**
839      * read each line of config file, process non-comment lines
840      * @throws IOException
841      */
842     private void readConfig( final BufferedReader conf_in ) throws IOException {
843         String line;
844         do {
845             line = conf_in.readLine();
846             if ( line != null ) {
847                 line = line.trim();
848                 // skip comments and blank lines
849                 if ( !line.startsWith( "#" ) && ( !ForesterUtil.isEmpty( line ) ) ) {
850                     // convert runs of spaces to tabs
851                     line = line.replaceAll( "\\s+", "\t" );
852                     final StringTokenizer st = new StringTokenizer( line, "\t" );
853                     setKeyValue( st );
854                 }
855             }
856         } while ( line != null );
857     }
858
859     private void setAntialiasScreen( final boolean antialias_screen ) {
860         _antialias_screen = antialias_screen;
861     }
862
863     private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
864         _cladogram_type = cladogram_type;
865     }
866
867     private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
868         _default_bootstrap_samples = default_bootstrap_samples;
869     }
870
871     private void setEditable( final boolean editable ) {
872         _editable = editable;
873     }
874
875     private void setExtNodeDataReturnOn( final EXT_NODE_DATA_RETURN_ON ext_node_data_return_on ) {
876         _ext_node_data_return_on = ext_node_data_return_on;
877     }
878
879     //private void setGraphicsExportX( final int graphics_export_x ) {
880     //    _graphics_export_x = graphics_export_x;
881     //}
882
883     //private void setGraphicsExportY( final int graphics_export_y ) {
884     //    _graphics_export_y = graphics_export_y;
885     //}
886
887     private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
888         _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
889     }
890
891     /**
892      * Set a key-value(s) tuple
893      */
894     private void setKeyValue( final StringTokenizer st ) {
895         final String key = ( ( String ) st.nextElement() ).replace( ':', ' ' ).trim().toLowerCase();
896         if ( !st.hasMoreElements() ) {
897             return;
898         }
899         // Handle single value settings first:
900         if ( key.equals( "default_click_to" ) ) {
901             final String clickto_name = ( String ) st.nextElement();
902             default_clickto = getClickToIndex( clickto_name );
903             if ( default_clickto == -1 ) {
904                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "invalid value [" + clickto_name
905                                                   + "] for [default_click_to]" );
906                 default_clickto = 0;
907             }
908             else if ( default_clickto == DEPRECATED ) {
909                 // Deprecated.
910             }
911         }
912         else if ( key.equals( "native_ui" ) ) {
913             final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
914             if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
915                 _ui = UI.NATIVE;
916             }
917             else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
918                 _ui = UI.CROSSPLATFORM;
919             }
920             else if ( my_str.equals( "?" ) ) {
921                 _ui = UI.UNKNOWN;
922             }
923             else {
924                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
925                                                   + "]" );
926                 _ui = UI.UNKNOWN;
927             }
928         }
929         else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
930             setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
931         }
932         else if ( key.equals( "antialias_screen" ) ) {
933             setAntialiasScreen( parseBoolean( ( String ) st.nextElement() ) );
934         }
935         else if ( key.equals( "phylogeny_graphics_type" ) ) {
936             final String type_str = ( ( String ) st.nextElement() ).trim();
937             if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CONVEX.toString() ) ) {
938                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
939             }
940             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CURVED.toString() ) ) {
941                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
942             }
943             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE.toString() ) ) {
944                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
945             }
946             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.ROUNDED.toString() ) ) {
947                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
948             }
949             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR.toString() ) ) {
950                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
951             }
952             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR.toString() ) ) {
953                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
954             }
955             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.UNROOTED.toString() ) ) {
956                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
957             }
958             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR.toString() ) ) {
959                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
960             }
961             else {
962                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
963                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
964                                                   + "] for [phylogeny_graphics_type]" );
965             }
966         }
967         else if ( key.equals( "min_confidence_value" ) ) {
968             final String mcv_str = ( ( String ) st.nextElement() ).trim();
969             final double d = parseDouble( mcv_str );
970             setMinConfidenceValue( d );
971         }
972         else if ( key.equals( "font_family" ) ) {
973             processFontFamily( st );
974         }
975         else if ( key.equals( "font_size" ) ) {
976             final String size_str = ( ( String ) st.nextElement() ).trim();
977             final int i = parseInt( size_str );
978             if ( i > 0 ) {
979                 setBaseFontSize( i );
980             }
981         }
982         else if ( key.equals( "font_size_min" ) ) {
983             final String size_str = ( ( String ) st.nextElement() ).trim();
984             final int i = parseInt( size_str );
985             if ( i > 0 ) {
986                 setMinBaseFontSize( i );
987             }
988         }
989         else if ( key.equals( "font_size_max" ) ) {
990             final String size_str = ( ( String ) st.nextElement() ).trim();
991             final int i = parseInt( size_str );
992             if ( i > 1 ) {
993                 setMaxBaseFontSize( i );
994             }
995         }
996         else if ( key.equals( "pdf_export_line_width" ) ) {
997             final String str = ( ( String ) st.nextElement() ).trim();
998             final float f = parseFloat( str );
999             if ( f > 0 ) {
1000                 setPrintLineWidth( f );
1001             }
1002             else {
1003                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
1004                         "value for [pdf_export_line_width] cannot be zero or negative" );
1005             }
1006         }
1007         else if ( key.equals( "window_initial_size_x" ) ) {
1008             final String str = ( ( String ) st.nextElement() ).trim();
1009             final int i = parseInt( str );
1010             if ( i > 0 ) {
1011                 setFrameXSize( i );
1012             }
1013         }
1014         else if ( key.equals( "window_initial_size_y" ) ) {
1015             final String str = ( ( String ) st.nextElement() ).trim();
1016             final int i = parseInt( str );
1017             if ( i > 0 ) {
1018                 setFrameYSize( i );
1019             }
1020         }
1021         else if ( key.equals( "default_number_of_bootstrap_resamples" ) ) {
1022             final String str = ( ( String ) st.nextElement() ).trim();
1023             final int i = parseInt( str );
1024             if ( i >= 0 ) {
1025                 setDefaultBootstrapSamples( i );
1026             }
1027             else {
1028                 ForesterUtil
1029                 .printWarningMessage( AptxConstants.PRG_NAME,
1030                                       "value for [default_number_of_bootstrap_resamples] cannot be negative" );
1031             }
1032         }
1033         else if ( key.equals( "mafft_local" ) ) {
1034             final String str = ( ( String ) st.nextElement() ).trim();
1035             if ( !ForesterUtil.isEmpty( str ) ) {
1036                 setPathToLocalMafft( new File( str ) );
1037             }
1038         }
1039         else if ( key.equals( "fastme_local" ) ) {
1040             final String str = ( ( String ) st.nextElement() ).trim();
1041             if ( !ForesterUtil.isEmpty( str ) ) {
1042                 setPathToLocalFastme( new File( str ) );
1043             }
1044         }
1045         else if ( key.equals( "raxml_local" ) ) {
1046             final String str = ( ( String ) st.nextElement() ).trim();
1047             if ( !ForesterUtil.isEmpty( str ) ) {
1048                 setPathToLocalRaxml( new File( str ) );
1049             }
1050         }
1051         else if ( key.equals( "show_scale" ) ) {
1052             setShowScale( parseBoolean( ( String ) st.nextElement() ) );
1053         }
1054         else if ( key.equals( "show_overview" ) ) {
1055             setShowOverview( parseBoolean( ( String ) st.nextElement() ) );
1056         }
1057         else if ( key.equals( "background_gradient" ) ) {
1058             setBackgroundColorGradient( parseBoolean( ( String ) st.nextElement() ) );
1059         }
1060         else if ( key.equals( "color_labels_same_as_branch_length_values" ) ) {
1061             setColorLabelsSameAsParentBranch( parseBoolean( ( String ) st.nextElement() ) );
1062         }
1063         else if ( key.equals( "show_domain_labels" ) ) {
1064             setShowDomainLabels( parseBoolean( ( String ) st.nextElement() ) );
1065         }
1066         else if ( key.equals( "show_seq_annotation_ref_sources" ) ) {
1067             setShowAnnotationRefSource( parseBoolean( ( String ) st.nextElement() ) );
1068         }
1069         else if ( key.equals( "abbreviate_scientific_names" ) ) {
1070             setAbbreviateScientificTaxonNames( parseBoolean( ( String ) st.nextElement() ) );
1071         }
1072         else if ( key.equals( "cladogram_type" ) ) {
1073             final String type_str = ( ( String ) st.nextElement() ).trim();
1074             if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.NON_LINED_UP.toString() ) ) {
1075                 setCladogramType( Options.CLADOGRAM_TYPE.NON_LINED_UP );
1076             }
1077             else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.LINED_UP.toString() ) ) {
1078                 setCladogramType( Options.CLADOGRAM_TYPE.LINED_UP );
1079             }
1080             else {
1081                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
1082                                                   + "] for [cladogram_type]" );
1083             }
1084         }
1085         else if ( key.equals( "hide_controls_and_menus" ) ) {
1086             _hide_controls_and_menus = parseBoolean( ( String ) st.nextElement() );
1087         }
1088         else if ( key.equals( "use_tabbed_display" ) ) {
1089             _use_tabbed_display = parseBoolean( ( String ) st.nextElement() );
1090         }
1091         else if ( key.equals( "overview_width" ) ) {
1092             final short i = parseShort( ( ( String ) st.nextElement() ) );
1093             setOvMaxWidth( i );
1094         }
1095         else if ( key.equals( "overview_height" ) ) {
1096             final short i = parseShort( ( ( String ) st.nextElement() ) );
1097             setOvMaxHeight( i );
1098         }
1099         else if ( key.equals( "overview_placement_type" ) ) {
1100             final String type_str = ( ( String ) st.nextElement() ).trim();
1101             if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT.toTag() ) ) {
1102                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1103             }
1104             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT.toTag() ) ) {
1105                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
1106             }
1107             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT.toTag() ) ) {
1108                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
1109             }
1110             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT.toTag() ) ) {
1111                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
1112             }
1113             else {
1114                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1115                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
1116                                                   + "] for [overview_placement_type]" );
1117             }
1118         }
1119         else if ( key.equals( "node_label_direction" ) ) {
1120             final String type_str = ( ( String ) st.nextElement() ).trim();
1121             if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.HORIZONTAL.toString() ) ) {
1122                 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1123             }
1124             else if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.RADIAL.toString() ) ) {
1125                 setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1126             }
1127             else {
1128                 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1129                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
1130                                                   + "] for [node_label_direction]" );
1131             }
1132         }
1133         else if ( key.equals( "branch_length_value_digits" ) ) {
1134             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1135             if ( i >= 0 ) {
1136                 setNumberOfDigitsAfterCommaForBranchLengthValue( i );
1137             }
1138             else {
1139                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "illegal value [" + i
1140                                                   + "] for [branch_length_value_digits]" );
1141             }
1142         }
1143         else if ( key.equals( "confidence_value_digits" ) ) {
1144             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1145             if ( i >= 0 ) {
1146                 setNumberOfDigitsAfterCommaForConfidenceValues( i );
1147             }
1148             else {
1149                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "illegal value [" + i
1150                                                   + "] for [confidence_value_digits]" );
1151             }
1152         }
1153         else if ( key.equals( "allow_editing" ) ) {
1154             setEditable( parseBoolean( ( String ) st.nextElement() ) );
1155         }
1156         else if ( key.equals( "display_sequence_relations" ) ) {
1157             setDisplaySequenceRelations( parseBoolean( ( String ) st.nextElement() ) );
1158         }
1159         else if ( key.equals( "replace_underscores_in_nh_parsing" ) ) {
1160             final boolean r = parseBoolean( ( String ) st.nextElement() );
1161             if ( r && ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) ) {
1162                 ForesterUtil
1163                 .printWarningMessage( AptxConstants.PRG_NAME,
1164                                       "attempt to extract taxonomies and replace underscores at the same time" );
1165             }
1166             else {
1167                 setReplaceUnderscoresInNhParsing( r );
1168             }
1169         }
1170         else if ( key.equals( "taxonomy_extraction_in_nh_parsing" ) ) {
1171             final String s = ( String ) st.nextElement();
1172             if ( s.equalsIgnoreCase( "no" ) ) {
1173                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO );
1174             }
1175             else if ( s.equalsIgnoreCase( "pfam_relaxed" ) ) {
1176                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
1177             }
1178             else if ( s.equalsIgnoreCase( "pfam_strict" ) ) {
1179                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );
1180             }
1181             else if ( s.equalsIgnoreCase( "aggressive" ) ) {
1182                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.AGGRESSIVE );
1183             }
1184             else {
1185                 ForesterUtil
1186                 .printWarningMessage( AptxConstants.PRG_NAME,
1187                                       "unknown value for \"taxonomy_extraction_in_nh_parsing\": "
1188                                               + s
1189                                               + " (must be either: no, pfam_relaxed, pfam_strict, or aggressive)" );
1190             }
1191             if ( ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) && isReplaceUnderscoresInNhParsing() ) {
1192                 ForesterUtil
1193                 .printWarningMessage( AptxConstants.PRG_NAME,
1194                                       "attempt to extract taxonomies and replace underscores at the same time" );
1195             }
1196         }
1197         else if ( key.equals( "internal_labels_are_confidence_values" ) ) {
1198             setInternalNumberAreConfidenceForNhParsing( parseBoolean( ( String ) st.nextElement() ) );
1199         }
1200         else if ( key.equals( "gui_background_color" ) ) {
1201             _gui_background_color = Color.decode( ( String ) st.nextElement() );
1202         }
1203         else if ( key.equals( "gui_checkbox_text_color" ) ) {
1204             _gui_checkbox_text_color = Color.decode( ( String ) st.nextElement() );
1205         }
1206         else if ( key.equals( "gui_checkbox_and_button_active_color" ) ) {
1207             _gui_checkbox_and_button_active_color = Color.decode( ( String ) st.nextElement() );
1208         }
1209         else if ( key.equals( "gui_button_text_color" ) ) {
1210             _gui_button_text_color = Color.decode( ( String ) st.nextElement() );
1211         }
1212         else if ( key.equals( "gui_button_background_color" ) ) {
1213             _gui_button_background_color = Color.decode( ( String ) st.nextElement() );
1214         }
1215         else if ( key.equals( "gui_menu_background_color" ) ) {
1216             _gui_menu_background_color = Color.decode( ( String ) st.nextElement() );
1217         }
1218         else if ( key.equals( "gui_menu_text_color" ) ) {
1219             _gui_menu_text_color = Color.decode( ( String ) st.nextElement() );
1220         }
1221         else if ( key.equals( "gui_button_border_color" ) ) {
1222             _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
1223         }
1224         else if ( key.equals( "show_default_node_shapes_internal" ) ) {
1225             setShowDefaultNodeShapesInternal( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1226         }
1227         else if ( key.equals( "show_default_node_shapes_external" ) ) {
1228             setShowDefaultNodeShapesExternal( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1229         }
1230         else if ( key.equals( "show_node_shapes_for_nodes_with_vis_data" ) ) {
1231             setShowDefaultNodeShapesForMarkedNodes( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1232         }
1233         else if ( key.equals( "default_node_size" ) ) {
1234             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1235             setDefaultNodeShapeSize( i );
1236         }
1237         else if ( key.equals( "default_node_fill" ) ) {
1238             final String fill_str = ( ( String ) st.nextElement() ).trim();
1239             if ( fill_str.equalsIgnoreCase( NodeVisualData.NodeFill.NONE.toString() ) ) {
1240                 setDefaultNodeFill( NodeFill.NONE );
1241             }
1242             else if ( fill_str.equalsIgnoreCase( NodeVisualData.NodeFill.GRADIENT.toString() ) ) {
1243                 setDefaultNodeFill( NodeFill.GRADIENT );
1244             }
1245             else if ( fill_str.equalsIgnoreCase( NodeVisualData.NodeFill.SOLID.toString() ) ) {
1246                 setDefaultNodeFill( NodeFill.SOLID );
1247             }
1248             else {
1249                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + fill_str
1250                                                   + "] for [default_node_fill]" );
1251             }
1252         }
1253         else if ( key.equals( "default_node_shape" ) ) {
1254             final String shape_str = ( ( String ) st.nextElement() ).trim();
1255             if ( shape_str.equalsIgnoreCase( NodeVisualData.NodeShape.CIRCLE.toString() ) ) {
1256                 setDefaultNodeShape( NodeShape.CIRCLE );
1257             }
1258             else if ( shape_str.equalsIgnoreCase( NodeVisualData.NodeShape.RECTANGLE.toString() ) ) {
1259                 setDefaultNodeShape( NodeShape.RECTANGLE );
1260             }
1261             else {
1262                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + shape_str
1263                                                   + "] for [default_node_shape]" );
1264             }
1265         }
1266         else if ( key.equals( "midpoint_reroot" ) ) {
1267             setMidpointReroot( parseBoolean( ( String ) st.nextElement() ) );
1268         }
1269         else if ( key.equals( "list_node_data_field" ) || key.equals( "ext_descendents_data_to_return" ) ) {
1270             final String s = ( ( String ) st.nextElement() ).trim();
1271             if ( s.equalsIgnoreCase( "node_name" ) ) {
1272                 setExtDescNodeDataToReturn( NodeDataField.NODE_NAME );
1273             }
1274             else if ( s.equalsIgnoreCase( "sequence_acc" ) ) {
1275                 setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_ACC );
1276             }
1277             else if ( s.equalsIgnoreCase( "sequence_mol_seq_fasta" ) ) {
1278                 setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_MOL_SEQ_FASTA );
1279             }
1280             else if ( s.equalsIgnoreCase( "sequence_name" ) ) {
1281                 setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_NAME );
1282             }
1283             else if ( s.equalsIgnoreCase( "gene_name" ) ) {
1284                 setExtDescNodeDataToReturn( NodeDataField.GENE_NAME );
1285             }
1286             else if ( s.equalsIgnoreCase( "sequence_symbol" ) ) {
1287                 setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_SYMBOL );
1288             }
1289             else if ( s.equalsIgnoreCase( "taxonomy_scientific_name" ) ) {
1290                 setExtDescNodeDataToReturn( NodeDataField.TAXONOMY_SCIENTIFIC_NAME );
1291             }
1292             else if ( s.equalsIgnoreCase( "taxonomy_code" ) ) {
1293                 setExtDescNodeDataToReturn( NodeDataField.TAXONOMY_CODE );
1294             }
1295             else if ( s.equalsIgnoreCase( "user_selected" ) ) {
1296                 setExtDescNodeDataToReturn( NodeDataField.UNKNOWN );
1297             }
1298             else if ( s.equalsIgnoreCase( "domains" ) ) {
1299                 setExtDescNodeDataToReturn( NodeDataField.DOMAINS_ALL );
1300             }
1301             else if ( s.equalsIgnoreCase( "domains_collapsed" ) ) {
1302                 setExtDescNodeDataToReturn( NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN );
1303             }
1304             else if ( s.equalsIgnoreCase( "seq_annotations" ) ) {
1305                 setExtDescNodeDataToReturn( NodeDataField.SEQ_ANNOTATIONS );
1306             }
1307             else if ( s.equalsIgnoreCase( "go_term_ids" ) ) {
1308                 setExtDescNodeDataToReturn( NodeDataField.GO_TERM_IDS );
1309             }
1310             else {
1311                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + s
1312                                                   + "] for [ext_descendents_data_to_return]" );
1313             }
1314         }
1315         else if ( key.equals( "list_node_data_custom_label" ) || key.equals( "label_for_get_ext_descendents_data" ) ) {
1316             final String s = ( ( String ) st.nextElement() ).trim();
1317             if ( !ForesterUtil.isEmpty( s ) && ( s.length() > 1 ) ) {
1318                 setLabelForGetExtDescendentsData( s.replaceAll( "_", " " ) );
1319             }
1320         }
1321         else if ( key.equals( "list_node_data_in" ) || key.equals( "ext_descendents_data_to_return_on" ) ) {
1322             final String s = ( ( String ) st.nextElement() ).trim().toLowerCase();
1323             if ( s.equals( "console" ) ) {
1324                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.CONSOLE );
1325             }
1326             else if ( s.equals( "window" ) ) {
1327                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.WINODW );
1328             }
1329             else if ( s.equals( "buffer_only" ) ) {
1330                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.BUFFER_ONLY );
1331             }
1332             else {
1333                 ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + s
1334                                                   + "] for [ext_descendents_data_to_return_on]" );
1335             }
1336         }
1337         else if ( key.equals( "vector_data_min_color" ) ) {
1338             _vector_data_min_color = Color.decode( ( String ) st.nextElement() );
1339         }
1340         else if ( key.equals( "vector_data_max_color" ) ) {
1341             _vector_data_max_color = Color.decode( ( String ) st.nextElement() );
1342         }
1343         else if ( key.equals( "vector_data_mean_color" ) ) {
1344             _vector_data_mean_color = Color.decode( ( String ) st.nextElement() );
1345         }
1346         else if ( key.equals( "vector_data_width" ) ) {
1347             _vector_data_width = parseShort( ( String ) st.nextElement() );
1348             if ( _vector_data_width < 1 ) {
1349                 _vector_data_width = 120;
1350             }
1351         }
1352         else if ( key.equals( "vector_data_height" ) ) {
1353             _vector_data_height = parseShort( ( String ) st.nextElement() );
1354             if ( _vector_data_height < 1 ) {
1355                 _vector_data_height = 12;
1356             }
1357         }
1358         else if ( key.equals( "line_up_renderable_data" ) ) {
1359             setLineUpRendarableNodeData( parseBoolean( ( String ) st.nextElement() ) );
1360         }
1361         else if ( key.equals( "right_align_domain_architectures" ) ) {
1362             setRightLineUpDomains( parseBoolean( ( String ) st.nextElement() ) );
1363         }
1364         else if ( key.equals( "allow_thick_strokes" ) ) {
1365             _allow_thick_strokes = parseBoolean( ( String ) st.nextElement() );
1366         }
1367         else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
1368             // yet retrieved!
1369             int key_index = -1;
1370             if ( key.equals( "phylogram" ) ) {
1371                 key_index = Configuration.display_as_phylogram;
1372             }
1373             else if ( key.equals( "rollover" ) ) {
1374                 key_index = Configuration.node_data_popup;
1375             }
1376             else if ( key.equals( "color_according_to_species" ) ) {
1377                 key_index = Configuration.color_according_to_species;
1378             }
1379             else if ( key.equals( "color_according_to_sequence" ) ) {
1380                 key_index = Configuration.color_according_to_sequence;
1381             }
1382             else if ( key.equals( "show_node_names" ) ) {
1383                 key_index = Configuration.show_node_names;
1384             }
1385             else if ( key.equals( "show_taxonomy_code" ) ) {
1386                 key_index = Configuration.show_tax_code;
1387             }
1388             else if ( key.equals( "show_taxonomy_rank" ) ) {
1389                 key_index = Configuration.show_tax_rank;
1390             }
1391             else if ( key.equals( "write_confidence_values" ) ) {
1392                 key_index = Configuration.write_confidence_values;
1393             }
1394             else if ( key.equals( "write_branch_length_values" ) ) {
1395                 key_index = Configuration.write_branch_length_values;
1396             }
1397             else if ( key.equals( "write_events" ) ) {
1398                 key_index = Configuration.write_events;
1399             }
1400             else if ( key.equals( "use_visual_styles" ) ) {
1401                 key_index = Configuration.use_style;
1402             }
1403             else if ( key.equals( "color_branches" ) ) {
1404                 key_index = Configuration.use_style;
1405                 ForesterUtil
1406                 .printWarningMessage( AptxConstants.PRG_NAME,
1407                                       "configuration key [color_branches] is deprecated, use [use_visual_styles] instead" );
1408             }
1409             else if ( key.equals( "width_branches" ) ) {
1410                 key_index = Configuration.width_branches;
1411             }
1412             else if ( key.equals( "show_domain_architectures" ) ) {
1413                 key_index = Configuration.show_domain_architectures;
1414             }
1415             else if ( key.equals( "show_msa" ) ) {
1416                 key_index = Configuration.show_mol_seqs;
1417             }
1418             else if ( key.equals( "show_annotations" ) ) {
1419                 key_index = Configuration.show_annotation;
1420             }
1421             else if ( key.equals( "show_binary_characters" ) ) {
1422                 key_index = Configuration.show_binary_characters;
1423             }
1424             else if ( key.equals( "show_binary_character_counts" ) ) {
1425                 key_index = Configuration.show_binary_character_counts;
1426             }
1427             else if ( key.equals( "show_seq_names" ) ) {
1428                 key_index = Configuration.show_seq_names;
1429             }
1430             else if ( key.equals( "show_gene_names" ) ) {
1431                 key_index = Configuration.show_gene_names;
1432             }
1433             else if ( key.equals( "show_seq_symbols" ) ) {
1434                 key_index = Configuration.show_seq_symbols;
1435             }
1436             else if ( key.equals( "show_seq_acc" ) ) {
1437                 key_index = Configuration.show_sequence_acc;
1438             }
1439             else if ( key.equals( "display_internal_data" ) ) {
1440                 key_index = Configuration.display_internal_data;
1441             }
1442             else if ( key.equals( "display_external_data" ) ) {
1443                 key_index = Configuration.display_external_data;
1444             }
1445             else if ( key.equals( "dynamically_hide_data" ) ) {
1446                 key_index = Configuration.dynamically_hide_data;
1447             }
1448             else if ( key.equals( "show_taxonomy_scientific_names" ) ) {
1449                 key_index = Configuration.show_taxonomy_scientific_names;
1450             }
1451             else if ( key.equals( "show_taxonomy_common_names" ) ) {
1452                 key_index = Configuration.show_taxonomy_common_names;
1453             }
1454             else if ( key.equals( "show_taxonomy_images" ) ) {
1455                 key_index = Configuration.show_taxonomy_images;
1456             }
1457             else if ( key.equals( "color_according_to_annotation" ) ) {
1458                 key_index = Configuration.color_according_to_annotation;
1459             }
1460             else if ( key.equals( "show_vector_data" ) ) {
1461                 key_index = Configuration.show_vector_data;
1462             }
1463             else if ( key.equals( "show_properties" ) ) {
1464                 key_index = Configuration.show_properties;
1465             }
1466             else if ( key.equals( "show_relation_confidence" ) ) {
1467                 key_index = Configuration.show_relation_confidence;
1468             }
1469             // If we've found the key, set the values
1470             if ( key_index >= 0 ) {
1471                 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1472                 display_options[ key_index ][ 2 ] = ( String ) st.nextElement();
1473                 // otherwise, keep looking
1474             }
1475             else {
1476                 if ( key_index == DEPRECATED ) {
1477                     // Deprecated.
1478                 }
1479                 else if ( key.equals( "click_to" ) ) {
1480                     final String click_to_name = ( String ) st.nextElement();
1481                     key_index = getClickToIndex( click_to_name );
1482                     if ( key_index >= 0 ) {
1483                         clickto_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1484                     }
1485                     else if ( key_index == DEPRECATED ) {
1486                         // Deprecated.
1487                     }
1488                     else {
1489                         ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown click-to option: "
1490                                 + click_to_name );
1491                     }
1492                 }
1493                 else if ( key.equals( "species_color" ) ) {
1494                     getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ),
1495                                             Color.decode( ( String ) st.nextElement() ) );
1496                 }
1497                 else if ( key.equals( "sequence_color" ) ) {
1498                     getSequenceColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ),
1499                                              Color.decode( ( String ) st.nextElement() ) );
1500                 }
1501                 else if ( key.equals( "domain_color" ) ) {
1502                     getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1503                 }
1504                 else if ( key.equals( "annotation_color" ) ) {
1505                     getAnnotationColors()
1506                     .put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1507                 }
1508                 else if ( key.equals( "function_color" ) ) {
1509                     ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
1510                             "configuration key [function_color] is deprecated" );
1511                 }
1512                 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
1513                     putDisplayColors( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1514                 }
1515                 else {
1516                     ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown configuration key [" + key
1517                                                       + "] in: " + config_filename );
1518                 }
1519             }
1520         }
1521         else {
1522             ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown configuration key [" + key + "] in: "
1523                     + config_filename );
1524         }
1525     }
1526
1527     private void setLabelForGetExtDescendentsData( final String label_for_get_ext_descendents_data ) {
1528         _label_for_get_ext_descendents_data = label_for_get_ext_descendents_data;
1529     }
1530
1531     private void setMaxBaseFontSize( final int max_base_font_size ) {
1532         _max_base_font_size = max_base_font_size;
1533     }
1534
1535     private void setMinBaseFontSize( final int min_base_font_size ) {
1536         _min_base_font_size = min_base_font_size;
1537     }
1538
1539     private void setOvMaxHeight( final short ov_max_height ) {
1540         _ov_max_height = ov_max_height;
1541     }
1542
1543     private void setOvMaxWidth( final short ov_max_width ) {
1544         _ov_max_width = ov_max_width;
1545     }
1546
1547     private void setOvPlacement( final OVERVIEW_PLACEMENT_TYPE ov_placement ) {
1548         _ov_placement = ov_placement;
1549     }
1550
1551     private void setPathToLocalFastme( final File path_to_local_fastme ) {
1552         _path_to_local_fastme = path_to_local_fastme;
1553     }
1554
1555     private void setPathToLocalMafft( final File path_to_local_mafft ) {
1556         _path_to_local_mafft = path_to_local_mafft;
1557     }
1558
1559     private void setPathToLocalRaxml( final File path_to_local_raxml ) {
1560         _path_to_local_raxml = path_to_local_raxml;
1561     }
1562
1563     private void setShowAnnotationRefSource( final boolean b ) {
1564         _show_annotation_ref_source = b;
1565     }
1566
1567     private void setShowOverview( final boolean show_overview ) {
1568         _show_overview = show_overview;
1569     }
1570
1571     private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
1572         _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
1573     }
1574
1575     boolean displaySequenceRelations() {
1576         return _display_sequence_relations;
1577     }
1578
1579     boolean doCheckOption( final int which ) {
1580         return ( display_options[ which ][ 2 ].equalsIgnoreCase( "yes" ) )
1581                 || ( display_options[ which ][ 2 ].equalsIgnoreCase( "true" ) );
1582     }
1583
1584     boolean doDisplayClickToOption( final int which ) {
1585         return clickto_options[ which ][ 1 ].equalsIgnoreCase( "display" );
1586     }
1587
1588     boolean doDisplayOption( final int which ) {
1589         return display_options[ which ][ 1 ].equalsIgnoreCase( "display" );
1590     }
1591
1592     /**
1593      * Will attempt to use the phylogeny to determine whether to check
1594      * this or not (e.g. phylogram)
1595      *
1596      */
1597     boolean doGuessCheckOption( final int which ) {
1598         return display_options[ which ][ 2 ].equals( "?" );
1599     }
1600
1601     Map<String, Color> getAnnotationColors() {
1602         if ( _annotation_colors == null ) {
1603             _annotation_colors = new Hashtable<String, Color>();
1604         }
1605         return _annotation_colors;
1606     }
1607
1608     int getBaseFontSize() {
1609         return _base_font_size;
1610     }
1611
1612     CLADOGRAM_TYPE getCladogramType() {
1613         return _cladogram_type;
1614     }
1615
1616     int getClickToOptionsCount() {
1617         return clickto_options.length;
1618     }
1619
1620     String getClickToTitle( final int which ) {
1621         return clickto_options[ which ][ 0 ];
1622     }
1623
1624     int getDefaultDisplayClicktoOption() {
1625         return default_clickto;
1626     }
1627
1628     SortedMap<String, Color> getDisplayColors() {
1629         return _display_colors;
1630     }
1631
1632     String getDisplayTitle( final int which ) {
1633         return display_options[ which ][ 0 ];
1634     }
1635
1636     Map<String, Color> getDomainColors() {
1637         if ( _domain_colors == null ) {
1638             _domain_colors = new Hashtable<String, Color>();
1639         }
1640         return _domain_colors;
1641     }
1642
1643  
1644     Color getGuiBackgroundColor() {
1645         return _gui_background_color;
1646     }
1647
1648     Color getGuiButtonBackgroundColor() {
1649         return _gui_button_background_color;
1650     }
1651
1652     Color getGuiButtonBorderColor() {
1653         return _gui_button_border_color;
1654     }
1655
1656     Color getGuiButtonTextColor() {
1657         return _gui_button_text_color;
1658     }
1659
1660     Color getGuiCheckboxAndButtonActiveColor() {
1661         return _gui_checkbox_and_button_active_color;
1662     }
1663
1664     Color getGuiCheckboxTextColor() {
1665         return _gui_checkbox_text_color;
1666     }
1667
1668     Color getGuiMenuBackgroundColor() {
1669         return _gui_menu_background_color;
1670     }
1671
1672     Color getGuiMenuTextColor() {
1673         return _gui_menu_text_color;
1674     }
1675
1676     static int getGuiFontSize() {
1677         return 11;
1678     }
1679     
1680     int getMaxBaseFontSize() {
1681         return _max_base_font_size;
1682     }
1683
1684     int getMinBaseFontSize() {
1685         return _min_base_font_size;
1686     }
1687
1688     double getMinConfidenceValue() {
1689         return _min_confidence_value;
1690     }
1691
1692     NODE_LABEL_DIRECTION getNodeLabelDirection() {
1693         return _node_label_direction;
1694     }
1695
1696     short getNumberOfDigitsAfterCommaForBranchLengthValues() {
1697         return _number_of_digits_after_comma_for_branch_length_values;
1698     }
1699
1700     short getNumberOfDigitsAfterCommaForConfidenceValues() {
1701         return _number_of_digits_after_comma_for_confidence_values;
1702     }
1703
1704     short getOvMaxHeight() {
1705         return _ov_max_height;
1706     }
1707
1708     short getOvMaxWidth() {
1709         return _ov_max_width;
1710     }
1711
1712     OVERVIEW_PLACEMENT_TYPE getOvPlacement() {
1713         return _ov_placement;
1714     }
1715
1716     PHYLOGENY_GRAPHICS_TYPE getPhylogenyGraphicsType() {
1717         return _phylogeny_graphics_type;
1718     }
1719
1720     float getPrintLineWidth() {
1721         return _print_line_width;
1722     }
1723
1724     Hashtable<String, Color> getSequenceColors() {
1725         if ( _sequence_colors == null ) {
1726             _sequence_colors = new Hashtable<String, Color>();
1727         }
1728         return _sequence_colors;
1729     }
1730
1731     Hashtable<String, Color> getSpeciesColors() {
1732         if ( _species_colors == null ) {
1733             initSpeciesColors();
1734         }
1735         return _species_colors;
1736     }
1737
1738     final TAXONOMY_EXTRACTION getTaxonomyExtraction() {
1739         return _taxonomy_extraction;
1740     }
1741
1742     boolean isAntialiasScreen() {
1743         return _antialias_screen;
1744     }
1745
1746     /**
1747      * Convenience method.
1748      *
1749      * @return true if value in configuration file was 'yes'
1750      */
1751     boolean isDrawAsPhylogram() {
1752         return doCheckOption( display_as_phylogram );
1753     }
1754
1755     boolean isEditable() {
1756         return _editable;
1757     }
1758
1759     /**
1760      * Only used by ArchaeoptryxE.
1761      *
1762      */
1763     boolean isHideControlPanelAndMenubar() {
1764         return _hide_controls_and_menus;
1765     }
1766
1767     boolean isInternalNumberAreConfidenceForNhParsing() {
1768         return _internal_number_are_confidence_for_nh_parsing;
1769     }
1770
1771     boolean isReplaceUnderscoresInNhParsing() {
1772         return _nh_parsing_replace_underscores;
1773     }
1774
1775     boolean isShowOverview() {
1776         return _show_overview;
1777     }
1778
1779     boolean isShowScale() {
1780         return _show_scale;
1781     }
1782
1783     final boolean isUseNativeUI() {
1784         if ( ( _ui == UI.UNKNOWN ) && ForesterUtil.isMac() ) {
1785             _ui = UI.NATIVE;
1786         }
1787         return _ui == UI.NATIVE;
1788     }
1789
1790     /**
1791      * Only used by ArchaeoptryxE.
1792      *
1793      */
1794     boolean isUseTabbedDisplay() {
1795         return _use_tabbed_display;
1796     }
1797
1798     boolean isValidatePhyloXmlAgainstSchema() {
1799         return _validate_against_phyloxml_xsd_schema;
1800     }
1801
1802     final void setTaxonomyExtraction( final TAXONOMY_EXTRACTION taxonomy_extraction ) {
1803         _taxonomy_extraction = taxonomy_extraction;
1804     }
1805
1806     static String getDefaultFontFamilyName() {
1807         return DEFAULT_FONT_FAMILY;
1808     }
1809
1810     public boolean isCouldReadConfigFile() {
1811         return _could_read_config_file;
1812     }
1813
1814     
1815 }