2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
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
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.
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.
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
26 // Contact: phylosoft @ gmail . com
27 // WWW: www.phylosoft.org/forester
29 package org.forester.archaeopteryx;
31 import java.awt.Color;
32 import java.io.BufferedReader;
34 import java.io.FileReader;
35 import java.io.IOException;
36 import java.io.InputStreamReader;
37 import java.net.MalformedURLException;
39 import java.util.Arrays;
40 import java.util.Hashtable;
42 import java.util.SortedMap;
43 import java.util.StringTokenizer;
44 import java.util.TreeMap;
46 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
47 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
48 import org.forester.archaeopteryx.Options.NodeFill;
49 import org.forester.archaeopteryx.Options.NodeShape;
50 import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
51 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
52 import org.forester.util.ForesterUtil;
54 public final class Configuration {
57 NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
59 static final String VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA = "validate_against_phyloxml_xsd_schema";
60 private static final String WEB_LINK_KEY = "web_link";
61 private static final String DISPLAY_COLOR_KEY = "display_color";
62 private static final int DEPRECATED = -2;
63 private UI _ui = UI.UNKNOWN;
64 private boolean _use_tabbed_display = false;
65 private boolean _hide_controls_and_menus = false;
66 private CLADOGRAM_TYPE _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
67 private SortedMap<String, WebLink> _weblinks = null;
68 private SortedMap<String, Color> _display_colors = null;
69 private boolean _antialias_screen = true;
70 private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
71 private String _base_font_family_name = "";
72 private int _base_font_size = -1;
73 private int _graphics_export_x = -1;
74 private int _graphics_export_y = -1;
75 private short _ov_max_width = 80;
76 private short _ov_max_height = 80;
77 private OVERVIEW_PLACEMENT_TYPE _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
78 private double _min_confidence_value = Options.MIN_CONFIDENCE_DEFAULT;
79 private float _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT;
80 private boolean _show_scale = false;
81 private boolean _show_branch_length_values = false;
82 private boolean _show_overview = true;
83 private short _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
84 private short _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
85 private boolean _editable = true;
86 private boolean _nh_parsing_replace_underscores = false;
87 private boolean _nh_parsing_extract_pfam_taxonomy_codes = false;
88 private boolean _internal_number_are_confidence_for_nh_parsing = false;
89 private boolean _display_sequence_relations = false;
90 private boolean _validate_against_phyloxml_xsd_schema = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
91 private boolean _background_color_gradient = false;
92 private boolean _show_domain_labels = true;
93 private boolean _abbreviate_scientific_names = false;
94 private boolean _color_labels_same_as_parent_branch = false;
95 private int _default_bootstrap_samples = -1;
96 private boolean _show_default_node_shapes = false;
97 private NodeShape _default_node_shape = NodeShape.NONE;
98 private NodeFill _default_node_fill = NodeFill.GRADIENT;
99 private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
100 private boolean _taxonomy_colorize_node_shapes = false;
101 final static int display_as_phylogram = 0;
102 final static int show_node_names = 1;
103 final static int show_tax_code = 2;
104 final static int show_annotation = 3;
105 final static int write_confidence_values = 4;
106 final static int write_events = 5;
107 final static int color_according_to_species = 6;
108 final static int color_branches = 7;
109 final static int width_branches = 8;
110 final static int show_custom_node_shapes = 9;
111 final static int show_domain_architectures = 10;
112 final static int show_binary_characters = 11;
113 final static int show_binary_character_counts = 12;
114 final static int show_gene_names = 13;
115 final static int show_sequence_acc = 14;
116 final static int display_internal_data = 15;
117 final static int dynamically_hide_data = 16;
118 final static int show_taxonomy_scientific_names = 17;
119 final static int show_taxonomy_common_names = 18;
120 final static int color_according_to_annotation = 19;
121 final static int show_property = 20;
122 final static int show_gene_symbols = 21;
123 final static int node_data_popup = 22;
124 final static int show_relation_confidence = 23;
125 final static int show_vector_data = 24;
126 final static int show_taxonomy_images = 25;
127 // ------------------
129 // ------------------
130 final static int display_node_data = 0;
131 final static int collapse_uncollapse = 1;
132 final static int reroot = 2;
133 final static int subtree = 3;
134 final static int swap = 4;
135 final static int color_subtree = 5;
136 final static int open_seq_web = 6;
137 final static int open_tax_web = 7;
138 final static int cut_subtree = 8;
139 final static int copy_subtree = 9;
140 final static int paste_subtree = 10;
141 final static int delete_subtree_or_node = 11;
142 final static int add_new_node = 12;
143 final static int edit_node_data = 13;
144 final static int blast = 14;
145 // ---------------------------
146 // Display options for trees
147 // ---------------------------
148 // ---------------------------------
149 // Pertaining to the config itself
150 // ---------------------------------
151 // Full path to config (may be URL)
152 String config_filename;
153 String default_config_filename = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
154 final static String display_options[][] = {
155 { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
156 { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" },
157 { "Taxonomy Colorize", "display", "yes" }, { "Colorize Branches", "display", "no" },
158 { "Use Branch-Width", "nodisplay", "no" }, { "Show Custom Nodes", "display", "yes"}, { "Domains", "nodisplay", "no" },
159 { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" },
160 { "Prot/Gene Name", "display", "no" }, { "Prot/Gene Acc", "display", "no" },
161 { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" },
162 { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" },
163 { "Annotation Colorize", "nodisplay", "no" }, { "Property", "nodisplay", "no" },
164 { "Prot/Gene Symbol", "display", "no" }, { "Rollover", "display", "yes" },
165 { "Relation Confidence", "display", "no" }, { "Vector Data", "display", "no" },
166 { "Taxonomy Images", "display", "no" } };
167 final static String clickto_options[][] = {
168 { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
169 { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree", "display" },
170 { "Open Sequence Web", "nodisplay" }, { "Open Taxonomy Web", "nodisplay" }, { "Cut Subtree", "display" },
171 { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
172 { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Blast", "display" } };
173 // This option is selected in the dropdown
174 int default_clickto = Configuration.display_node_data;
178 TreeColorSet tree_color_set;
182 TreeFontSet tree_font_set;
186 private static Hashtable<String, Color> _species_colors;
190 private static Hashtable<String, Color> _domain_colors;
194 private static Hashtable<String, Color> _annotation_colors;
195 boolean verbose = Constants.VERBOSE_DEFAULT;
196 private NODE_LABEL_DIRECTION _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL;
197 private Color _gui_background_color = Constants.GUI_BACKGROUND_DEFAULT;
198 private Color _gui_checkbox_text_color = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
199 private Color _gui_checkbox_and_button_active_color = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
200 private Color _gui_button_text_color = Constants.BUTTON_TEXT_COLOR_DEFAULT;
201 private Color _gui_button_background_color = Constants.BUTTON_BACKGROUND_COLOR_DEFAULT;
202 private Color _gui_menu_background_color = Constants.MENU_BACKGROUND_COLOR_DEFAULT;
203 private Color _gui_menu_text_color = Constants.MENU_TEXT_COLOR_DEFAULT;
204 private Color _gui_button_border_color = Constants.BUTTON_BORDER_COLOR_DEFAULT;
205 private Color _domain_structure_font_color = Constants.DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT;
206 private Color _domain_structure_base_color = Constants.DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT;
207 private static String DEFAULT_FONT_FAMILY = "";
209 for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
210 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
211 DEFAULT_FONT_FAMILY = font_name;
215 if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
216 DEFAULT_FONT_FAMILY = Constants.DEFAULT_FONT_CHOICES[ Constants.DEFAULT_FONT_CHOICES.length - 1 ];
220 Configuration( final String cf, final boolean is_url, final boolean is_applet ) {
221 if ( ForesterUtil.isEmpty( cf ) ) {
222 config_filename = default_config_filename;
225 config_filename = cf;
227 setWebLinks( new TreeMap<String, WebLink>() );
228 setDisplayColors( new TreeMap<String, Color>() );
229 config_filename = config_filename.trim();
232 // If URL, open accordingly
234 u = new URL( config_filename );
236 final InputStreamReader isr = new InputStreamReader( u.openStream() );
237 final BufferedReader bf = new BufferedReader( isr );
240 ForesterUtil.programMessage( Constants.PRG_NAME, "successfully read from configuration url ["
241 + config_filename + "]" );
243 catch ( final Exception e ) {
244 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
245 + config_filename + "]: " + e.getLocalizedMessage() );
248 catch ( final Exception e ) {
249 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration url ["
250 + config_filename + "]" );
254 // Otherwise, open as a file
255 File f = new File( config_filename );
257 f = new File( config_filename + ".txt" );
259 if ( f.exists() && f.canRead() ) {
261 final BufferedReader bf = new BufferedReader( new FileReader( f ) );
265 catch ( final Exception e ) {
266 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
267 + config_filename + "]: " + e );
271 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
272 + config_filename + "]" );
277 private void createWebLink( final String url_str, final String desc, final String source_identifier ) {
278 WebLink weblink = null;
281 weblink = new WebLink( new URL( url_str.trim() ), desc.trim(), source_identifier.trim() );
283 catch ( final MalformedURLException e ) {
284 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not create URL from [" + url_str + "]" );
287 if ( !ex && ( weblink != null ) ) {
288 getWebLinks().put( weblink.getSourceIdentifier().toLowerCase(), weblink );
292 Color getGuiBackgroundColor() {
293 return _gui_background_color;
296 Color getGuiCheckboxTextColor() {
297 return _gui_checkbox_text_color;
300 Color getGuiCheckboxAndButtonActiveColor() {
301 return _gui_checkbox_and_button_active_color;
304 Color getGuiButtonTextColor() {
305 return _gui_button_text_color;
308 Color getGuiButtonBackgroundColor() {
309 return _gui_button_background_color;
312 Color getGuiMenuBackgroundColor() {
313 return _gui_menu_background_color;
316 Color getGuiMenuTextColor() {
317 return _gui_menu_text_color;
320 Color getGuiButtonBorderColor() {
321 return _gui_button_border_color;
324 boolean displaySequenceRelations() {
325 return _display_sequence_relations;
328 boolean doCheckOption( final int which ) {
329 return ( display_options[ which ][ 2 ].equalsIgnoreCase( "yes" ) )
330 || ( display_options[ which ][ 2 ].equalsIgnoreCase( "true" ) );
333 boolean doDisplayClickToOption( final int which ) {
334 return clickto_options[ which ][ 1 ].equalsIgnoreCase( "display" );
337 boolean doDisplayOption( final int which ) {
338 return display_options[ which ][ 1 ].equalsIgnoreCase( "display" );
342 * Will attempt to use the phylogeny to determine whether to check
343 * this or not (e.g. phylogram)
346 boolean doGuessCheckOption( final int which ) {
347 return display_options[ which ][ 2 ].equals( "?" );
350 Map<String, Color> getAnnotationColors() {
351 if ( _annotation_colors == null ) {
352 _annotation_colors = new Hashtable<String, Color>();
354 return _annotation_colors;
357 public String getBaseFontFamilyName() {
358 return _base_font_family_name;
361 int getBaseFontSize() {
362 return _base_font_size;
365 CLADOGRAM_TYPE getCladogramType() {
366 return _cladogram_type;
370 private int getClickToIndex( final String name ) {
372 if ( name.equals( "edit_info" ) ) {
373 index = Configuration.display_node_data;
375 .printWarningMessage( Constants.PRG_NAME,
376 "configuration key [edit_info] is deprecated, use [display node data] instead" );
378 else if ( name.equals( "display_node_data" ) ) {
379 index = Configuration.display_node_data;
381 else if ( name.equals( "collapse_uncollapse" ) ) {
382 index = Configuration.collapse_uncollapse;
384 else if ( name.equals( "reroot" ) ) {
385 index = Configuration.reroot;
387 else if ( name.equals( "subtree" ) ) {
388 index = Configuration.subtree;
390 else if ( name.equals( "swap" ) ) {
391 index = Configuration.swap;
393 else if ( name.equals( "display_sequences" ) ) {
395 .printWarningMessage( Constants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
398 else if ( name.equals( "open_seq_web" ) ) {
399 index = Configuration.open_seq_web;
401 else if ( name.equals( "open_tax_web" ) ) {
402 index = Configuration.open_tax_web;
404 else if ( name.equals( "cut_subtree" ) ) {
405 index = Configuration.cut_subtree;
407 else if ( name.equals( "copy_subtree" ) ) {
408 index = Configuration.copy_subtree;
410 else if ( name.equals( "paste_subtree" ) ) {
411 index = Configuration.paste_subtree;
413 else if ( name.equals( "delete" ) ) {
414 index = Configuration.delete_subtree_or_node;
416 else if ( name.equals( "add_new_node" ) ) {
417 index = Configuration.add_new_node;
419 else if ( name.equals( "edit_node_data" ) ) {
420 index = Configuration.edit_node_data;
422 else if ( name.equals( "display_node_popup" ) ) {
423 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
424 "configuration key [display_node_popup] is deprecated" );
427 else if ( name.equals( "custom_option" ) ) {
428 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [custom_option] is deprecated" );
431 else if ( name.equals( "color_subtree" ) ) {
432 index = Configuration.color_subtree;
434 else if ( name.equals( "go_to_swiss_prot" ) ) {
435 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [go_to_swiss_prot] is deprecated" );
441 int getClickToOptionsCount() {
442 return clickto_options.length;
445 String getClickToTitle( final int which ) {
446 return clickto_options[ which ][ 0 ];
449 int getDefaultDisplayClicktoOption() {
450 return default_clickto;
453 SortedMap<String, Color> getDisplayColors() {
454 return _display_colors;
457 String getDisplayTitle( final int which ) {
458 return display_options[ which ][ 0 ];
461 Map<String, Color> getDomainColors() {
462 if ( _domain_colors == null ) {
463 _domain_colors = new Hashtable<String, Color>();
465 return _domain_colors;
468 int getGraphicsExportX() {
469 return _graphics_export_x;
472 int getGraphicsExportY() {
473 return _graphics_export_y;
476 public int getDefaultBootstrapSamples() {
477 return _default_bootstrap_samples;
480 double getMinConfidenceValue() {
481 return _min_confidence_value;
484 NODE_LABEL_DIRECTION getNodeLabelDirection() {
485 return _node_label_direction;
488 short getNumberOfDigitsAfterCommaForBranchLengthValues() {
489 return _number_of_digits_after_comma_for_branch_length_values;
492 short getNumberOfDigitsAfterCommaForConfidenceValues() {
493 return _number_of_digits_after_comma_for_confidence_values;
496 short getOvMaxHeight() {
497 return _ov_max_height;
500 short getOvMaxWidth() {
501 return _ov_max_width;
504 OVERVIEW_PLACEMENT_TYPE getOvPlacement() {
505 return _ov_placement;
508 PHYLOGENY_GRAPHICS_TYPE getPhylogenyGraphicsType() {
509 return _phylogeny_graphics_type;
512 float getPrintLineWidth() {
513 return _print_line_width;
516 Hashtable<String, Color> getSpeciesColors() {
517 if ( _species_colors == null ) {
518 _species_colors = new Hashtable<String, Color>();
520 return _species_colors;
523 TreeColorSet getTreeColorSet() {
527 TreeFontSet getTreeFontSet() {
531 WebLink getWebLink( final String source ) {
532 return getWebLinks().get( source );
535 Map<String, WebLink> getWebLinks() {
539 boolean isAntialiasScreen() {
540 return _antialias_screen;
543 public boolean isBackgroundColorGradient() {
544 return _background_color_gradient;
548 * Convenience method.
550 * @return true if value in configuration file was 'yes'
552 boolean isDrawAsPhylogram() {
553 return doCheckOption( display_as_phylogram );
556 boolean isEditable() {
560 boolean isExtractPfamTaxonomyCodesInNhParsing() {
561 return _nh_parsing_extract_pfam_taxonomy_codes;
564 boolean isHasWebLink( final String source ) {
565 return getWebLinks().containsKey( source );
569 * Only used by ArchaeoptryxE.
572 boolean isHideControlPanelAndMenubar() {
573 return _hide_controls_and_menus;
576 boolean isInternalNumberAreConfidenceForNhParsing() {
577 return _internal_number_are_confidence_for_nh_parsing;
580 boolean isReplaceUnderscoresInNhParsing() {
581 return _nh_parsing_replace_underscores;
584 boolean isShowBranchLengthValues() {
585 return _show_branch_length_values;
588 boolean isShowOverview() {
589 return _show_overview;
592 boolean isShowScale() {
596 final boolean isUseNativeUI() {
597 if ( ( _ui == UI.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
600 return _ui == UI.NATIVE;
604 * Only used by ArchaeoptryxE.
607 boolean isUseTabbedDisplay() {
608 return _use_tabbed_display;
611 boolean isValidatePhyloXmlAgainstSchema() {
612 return _validate_against_phyloxml_xsd_schema;
615 private boolean parseBoolean( final String str ) {
616 final String my_str = str.trim().toLowerCase();
617 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
620 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
624 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
629 private double parseDouble( final String str ) {
632 d = Double.parseDouble( str );
634 catch ( final Exception e ) {
635 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse double from [" + str + "]" );
641 private float parseFloat( final String str ) {
644 f = Float.parseFloat( str );
646 catch ( final Exception e ) {
647 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse float from [" + str + "]" );
653 private int parseInt( final String str ) {
656 i = Integer.parseInt( str );
658 catch ( final Exception e ) {
659 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse integer from [" + str + "]" );
665 private short parseShort( final String str ) {
668 i = Short.parseShort( str );
670 catch ( final Exception e ) {
671 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse short from [" + str + "]" );
677 private void processFontFamily( final StringTokenizer st ) {
678 setBaseFontFamilyName( "" );
679 final String font_str = ( ( String ) st.nextElement() ).trim();
680 final String[] fonts = font_str.split( ",+" );
681 for( String font : fonts ) {
682 font = font.replace( '_', ' ' ).trim();
683 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
684 setBaseFontFamilyName( font );
691 * read each line of config file, process non-comment lines
692 * @throws IOException
694 private void readConfig( final BufferedReader conf_in ) throws IOException {
697 line = conf_in.readLine();
698 if ( line != null ) {
700 // skip comments and blank lines
701 if ( !line.startsWith( "#" ) && ( !ForesterUtil.isEmpty( line ) ) ) {
702 // convert runs of spaces to tabs
703 line = line.replaceAll( "\\s+", "\t" );
704 final StringTokenizer st = new StringTokenizer( line, "\t" );
708 } while ( line != null );
711 private void setAntialiasScreen( final boolean antialias_screen ) {
712 _antialias_screen = antialias_screen;
715 public void setBackgroundColorGradient( final boolean background_color_gradient ) {
716 _background_color_gradient = background_color_gradient;
719 private void setBaseFontFamilyName( final String base_font_family_name ) {
720 _base_font_family_name = base_font_family_name;
723 private void setBaseFontSize( final int base_font_size ) {
724 _base_font_size = base_font_size;
727 private void setShowDomainLabels( final boolean show_domain_labels ) {
728 _show_domain_labels = show_domain_labels;
731 private void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
732 _abbreviate_scientific_names = abbreviate_scientific_names;
735 private void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
736 _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
739 private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
740 _cladogram_type = cladogram_type;
743 void setDisplayColors( final SortedMap<String, Color> display_colors ) {
744 _display_colors = display_colors;
747 private void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
748 _display_sequence_relations = display_sequence_relations;
751 private void setEditable( final boolean editable ) {
752 _editable = editable;
755 private void setExtractPfamTaxonomyCodesInNhParsing( final boolean nh_parsing_extract_pfam_taxonomy_codes ) {
756 _nh_parsing_extract_pfam_taxonomy_codes = nh_parsing_extract_pfam_taxonomy_codes;
759 private void setGraphicsExportX( final int graphics_export_x ) {
760 _graphics_export_x = graphics_export_x;
763 private void setGraphicsExportY( final int graphics_export_y ) {
764 _graphics_export_y = graphics_export_y;
767 private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
768 _default_bootstrap_samples = default_bootstrap_samples;
771 private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
772 _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
776 * Set a key-value(s) tuple
778 private void setKeyValue( final StringTokenizer st ) {
779 String key = ( String ) st.nextElement();
780 key = key.replace( ':', ' ' );
782 key = key.toLowerCase();
783 // Handle single value settings first:
784 if ( key.equals( "default_click_to" ) ) {
785 final String clickto_name = ( String ) st.nextElement();
786 default_clickto = getClickToIndex( clickto_name );
787 if ( default_clickto == -1 ) {
788 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "invalid value [" + clickto_name
789 + "] for [default_click_to]" );
792 else if ( default_clickto == DEPRECATED ) {
796 else if ( key.equals( "native_ui" ) ) {
797 final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
798 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
801 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
802 _ui = UI.CROSSPLATFORM;
804 else if ( my_str.equals( "?" ) ) {
808 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
813 else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
814 setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
816 else if ( key.equals( "antialias_screen" ) ) {
817 setAntialiasScreen( parseBoolean( ( String ) st.nextElement() ) );
819 else if ( key.equals( "phylogeny_graphics_type" ) ) {
820 final String type_str = ( ( String ) st.nextElement() ).trim();
821 if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CONVEX.toString() ) ) {
822 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
824 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CURVED.toString() ) ) {
825 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
827 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE.toString() ) ) {
828 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
830 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.ROUNDED.toString() ) ) {
831 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
833 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR.toString() ) ) {
834 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
836 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR.toString() ) ) {
837 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
839 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.UNROOTED.toString() ) ) {
840 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
842 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR.toString() ) ) {
843 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
846 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
847 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
848 + "] for [phylogeny_graphics_type]" );
851 else if ( key.equals( "min_confidence_value" ) ) {
852 final String mcv_str = ( ( String ) st.nextElement() ).trim();
853 final double d = parseDouble( mcv_str );
854 setMinConfidenceValue( d );
856 else if ( key.equals( "font_family" ) ) {
857 processFontFamily( st );
859 else if ( key.equals( "font_size" ) ) {
860 final String size_str = ( ( String ) st.nextElement() ).trim();
861 final int i = parseInt( size_str );
862 setBaseFontSize( i );
864 else if ( key.equals( "graphics_export_x" ) ) {
865 final String str = ( ( String ) st.nextElement() ).trim();
866 final int i = parseInt( str );
867 setGraphicsExportX( i );
869 else if ( key.equals( "graphics_export_y" ) ) {
870 final String str = ( ( String ) st.nextElement() ).trim();
871 final int i = parseInt( str );
872 setGraphicsExportY( i );
874 else if ( key.equals( "pdf_export_line_width" ) ) {
875 final String str = ( ( String ) st.nextElement() ).trim();
876 final float f = parseFloat( str );
878 setPrintLineWidth( f );
881 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
882 "value for [pdf_export_line_width] cannot be zero or negative" );
885 else if ( key.equals( "default_number_of_bootstrap_resamples" ) ) {
886 final String str = ( ( String ) st.nextElement() ).trim();
887 final int i = parseInt( str );
889 setDefaultBootstrapSamples( i );
893 .printWarningMessage( Constants.PRG_NAME,
894 "value for [default_number_of_bootstrap_resamples] cannot be negative" );
897 else if ( key.equals( "show_scale" ) ) {
898 setShowScale( parseBoolean( ( String ) st.nextElement() ) );
900 else if ( key.equals( "show_overview" ) ) {
901 setShowOverview( parseBoolean( ( String ) st.nextElement() ) );
903 else if ( key.equals( "show_branch_length_values" ) ) {
904 setShowBranchLengthValues( parseBoolean( ( String ) st.nextElement() ) );
906 else if ( key.equals( "background_gradient" ) ) {
907 setBackgroundColorGradient( parseBoolean( ( String ) st.nextElement() ) );
909 else if ( key.equals( "color_labels_same_as_branch_length_values" ) ) {
910 setColorLabelsSameAsParentBranch( parseBoolean( ( String ) st.nextElement() ) );
912 else if ( key.equals( "show_domain_labels" ) ) {
913 setShowDomainLabels( parseBoolean( ( String ) st.nextElement() ) );
915 else if ( key.equals( "abbreviate_scientific_names" ) ) {
916 setAbbreviateScientificTaxonNames( parseBoolean( ( String ) st.nextElement() ) );
918 else if ( key.equals( "cladogram_type" ) ) {
919 final String type_str = ( ( String ) st.nextElement() ).trim();
920 if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.NON_LINED_UP.toString() ) ) {
921 setCladogramType( Options.CLADOGRAM_TYPE.NON_LINED_UP );
923 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP.toString() ) ) {
924 setCladogramType( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
926 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP.toString() ) ) {
927 setCladogramType( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
930 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
931 + "] for [cladogram_type]" );
934 else if ( key.equals( "non_lined_up_cladogram" ) ) {
936 .printWarningMessage( Constants.PRG_NAME,
937 "configuration key [non_lined_up_cladogram] is deprecated, use [cladogram_type] instead" );
939 else if ( key.equals( "hide_controls_and_menus" ) ) {
940 _hide_controls_and_menus = parseBoolean( ( String ) st.nextElement() );
942 else if ( key.equals( "use_tabbed_display" ) ) {
943 _use_tabbed_display = parseBoolean( ( String ) st.nextElement() );
945 else if ( key.equals( "overview_width" ) ) {
946 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
949 else if ( key.equals( "overview_height" ) ) {
950 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
953 else if ( key.equals( "overview_placement_type" ) ) {
954 final String type_str = ( ( String ) st.nextElement() ).trim();
955 if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT.toTag() ) ) {
956 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
958 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT.toTag() ) ) {
959 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
961 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT.toTag() ) ) {
962 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
964 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT.toTag() ) ) {
965 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
968 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
969 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
970 + "] for [overview_placement_type]" );
973 else if ( key.equals( "node_label_direction" ) ) {
974 final String type_str = ( ( String ) st.nextElement() ).trim();
975 if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.HORIZONTAL.toString() ) ) {
976 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
978 else if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.RADIAL.toString() ) ) {
979 setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
982 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
983 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
984 + "] for [node_label_direction]" );
987 else if ( key.equals( "branch_length_value_digits" ) ) {
988 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
990 setNumberOfDigitsAfterCommaForBranchLengthValue( i );
993 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
994 + "] for [branch_length_value_digits]" );
997 else if ( key.equals( "confidence_value_digits" ) ) {
998 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1000 setNumberOfDigitsAfterCommaForConfidenceValues( i );
1003 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
1004 + "] for [confidence_value_digits]" );
1007 else if ( key.equals( "allow_editing" ) ) {
1008 setEditable( parseBoolean( ( String ) st.nextElement() ) );
1010 else if ( key.equals( "display_sequence_relations" ) ) {
1011 setDisplaySequenceRelations( parseBoolean( ( String ) st.nextElement() ) );
1013 else if ( key.equals( "replace_underscores_in_nh_parsing" ) ) {
1014 final boolean r = parseBoolean( ( String ) st.nextElement() );
1015 if ( r && isExtractPfamTaxonomyCodesInNhParsing() ) {
1017 .printWarningMessage( Constants.PRG_NAME,
1018 "attempt to extract taxonomies and replace underscores at the same time" );
1021 setReplaceUnderscoresInNhParsing( r );
1024 else if ( key.equals( "extract_taxonomy_codes_in_nh_parsing" ) ) {
1025 final boolean e = parseBoolean( ( String ) st.nextElement() );
1026 if ( e && isReplaceUnderscoresInNhParsing() ) {
1028 .printWarningMessage( Constants.PRG_NAME,
1029 "attempt to extract taxonomies and replace underscores at the same time" );
1032 setExtractPfamTaxonomyCodesInNhParsing( e );
1035 else if ( key.equals( "internal_labels_are_confidence_values" ) ) {
1036 setInternalNumberAreConfidenceForNhParsing( parseBoolean( ( String ) st.nextElement() ) );
1038 else if ( key.equals( "gui_background_color" ) ) {
1039 _gui_background_color = Color.decode( ( String ) st.nextElement() );
1041 else if ( key.equals( "gui_checkbox_text_color" ) ) {
1042 _gui_checkbox_text_color = Color.decode( ( String ) st.nextElement() );
1044 else if ( key.equals( "gui_checkbox_and_button_active_color" ) ) {
1045 _gui_checkbox_and_button_active_color = Color.decode( ( String ) st.nextElement() );
1047 else if ( key.equals( "gui_button_text_color" ) ) {
1048 _gui_button_text_color = Color.decode( ( String ) st.nextElement() );
1050 else if ( key.equals( "gui_button_background_color" ) ) {
1051 _gui_button_background_color = Color.decode( ( String ) st.nextElement() );
1053 else if ( key.equals( "gui_menu_background_color" ) ) {
1054 _gui_menu_background_color = Color.decode( ( String ) st.nextElement() );
1056 else if ( key.equals( "gui_menu_text_color" ) ) {
1057 _gui_menu_text_color = Color.decode( ( String ) st.nextElement() );
1059 else if ( key.equals( "gui_button_border_color" ) ) {
1060 _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
1062 else if ( key.equals( "domain_structure_font_color" ) ) {
1063 _domain_structure_font_color = Color.decode( ( String ) st.nextElement() );
1065 else if ( key.equals( "domain_structure_base_color" ) ) {
1066 _domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
1069 else if ( key.equals( "show_default_node_shapes" ) ) {
1070 setShowDefaultNodeShapes( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1072 else if ( key.equals( "default_node_size" ) ) {
1073 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1074 setDefaultNodeShapeSize( i );
1076 else if ( key.equals( "default_node_fill" ) ) {
1077 final String fill_str = ( ( String ) st.nextElement() ).trim();
1078 if ( fill_str.equalsIgnoreCase( Options.NodeFill.NONE.toString() ) ) {
1079 setDefaultNodeFill( NodeFill.NONE );
1081 else if ( fill_str.equalsIgnoreCase( Options.NodeFill.GRADIENT.toString() ) ) {
1082 setDefaultNodeFill( NodeFill.GRADIENT );
1084 else if ( fill_str.equalsIgnoreCase( Options.NodeFill.SOLID.toString() ) ) {
1085 setDefaultNodeFill( NodeFill.SOLID );
1088 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
1089 + "] for [default_node_fill]" );
1092 else if ( key.equals( "default_node_shape" ) ) {
1093 final String shape_str = ( ( String ) st.nextElement() ).trim();
1094 if ( shape_str.equalsIgnoreCase( Options.NodeShape.NONE.toString() ) ) {
1095 setDefaultNodeShape( NodeShape.NONE );
1097 else if ( shape_str.equalsIgnoreCase( Options.NodeShape.CIRCLE.toString() ) ) {
1098 setDefaultNodeShape( NodeShape.CIRCLE );
1100 else if ( shape_str.equalsIgnoreCase( Options.NodeShape.RECTANGLE.toString() ) ) {
1101 setDefaultNodeShape( NodeShape.RECTANGLE );
1104 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
1105 + "] for [default_node_shape]" );
1108 else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) {
1109 setTaxonomyColorizeNodeShapes( parseBoolean( ( String ) st.nextElement() ) );
1111 else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
1114 if ( key.equals( "use_real_br_lengths" ) || key.equals( "phylogram" ) ) {
1115 key_index = Configuration.display_as_phylogram;
1116 if ( key.equals( "use_real_br_lengths" ) ) {
1118 .printWarningMessage( Constants.PRG_NAME,
1119 "configuration key [use_real_br_lengths] is deprecated, use [phylogram] instead" );
1122 else if ( key.equals( "rollover" ) ) {
1123 key_index = Configuration.node_data_popup;
1125 else if ( key.equals( "color_according_to_species" ) ) {
1126 key_index = Configuration.color_according_to_species;
1128 else if ( key.equals( "show_node_names" ) ) {
1129 key_index = Configuration.show_node_names;
1131 else if ( key.equals( "show_taxonomy" ) || key.equals( "show_taxonomy_code" ) ) {
1132 key_index = Configuration.show_tax_code;
1133 if ( key.equals( "show_taxonomy" ) ) {
1135 .printWarningMessage( Constants.PRG_NAME,
1136 "configuration key [show_taxonomy] is deprecated, use [show_taxonomy_code] instead" );
1139 else if ( key.equals( "write_br_length_values" ) ) {
1140 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1141 "configuration key [write_br_length_values] is deprecated" );
1142 key_index = DEPRECATED;
1144 else if ( key.equals( "write_bootstrap_values" ) || key.equals( "write_confidence_values" ) ) {
1145 key_index = Configuration.write_confidence_values;
1146 if ( key.equals( "write_bootstrap_values" ) ) {
1148 .printWarningMessage( Constants.PRG_NAME,
1149 "configuration key [write_bootstrap_values] is deprecated, use [write_confidence_values] instead" );
1152 else if ( key.equals( "write_events" ) || key.equals( "write_dup_spec" ) ) {
1153 key_index = Configuration.write_events;
1154 if ( key.equals( "write_dup_spec" ) ) {
1156 .printWarningMessage( Constants.PRG_NAME,
1157 "configuration key [write_dup_spec] is deprecated, use [write_events] instead" );
1160 else if ( key.equals( "color_branches" ) ) {
1161 key_index = Configuration.color_branches;
1163 else if ( key.equals( "width_branches" ) ) {
1164 key_index = Configuration.width_branches;
1166 else if ( key.equals( "color_orthologous" ) ) {
1167 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1168 "configuration key [color_orthologous] is deprecated" );
1170 else if ( key.equals( "color_subtree_neighbors" ) ) {
1171 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1172 "configuration key [color_subtree_neighbors] is deprecated" );
1174 else if ( key.equals( "color_super_orthologous" ) ) {
1175 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1176 "configuration key [color_super_orthologous] is deprecated" );
1178 else if ( key.equals( "mark_nodes_with_box" ) ) {
1179 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1180 "configuration key [mark_nodes_with_box] is deprecated" );
1181 key_index = DEPRECATED;
1183 else if ( key.equals( "show_domain_architectures" ) ) {
1184 key_index = Configuration.show_domain_architectures;
1186 else if ( key.equals( "show_annotations" ) ) {
1187 key_index = Configuration.show_annotation;
1189 else if ( key.equals( "show_binary_characters" ) ) {
1190 key_index = Configuration.show_binary_characters;
1192 else if ( key.equals( "show_binary_character_counts" ) ) {
1193 key_index = Configuration.show_binary_character_counts;
1195 else if ( key.equals( "show_gene_names" ) ) {
1196 key_index = Configuration.show_gene_names;
1198 else if ( key.equals( "show_gene_symbols" ) ) {
1199 key_index = Configuration.show_gene_symbols;
1201 else if ( key.equals( "show_sequence_acc" ) ) {
1202 key_index = Configuration.show_sequence_acc;
1204 else if ( key.equals( "show_node_ids" ) ) {
1206 .printWarningMessage( Constants.PRG_NAME, "configuration key [show_node_ids] is deprecated" );
1207 key_index = DEPRECATED;
1209 else if ( key.equals( "display_internal_data" ) ) {
1210 key_index = Configuration.display_internal_data;
1212 else if ( key.equals( "dynamically_hide_data" ) ) {
1213 key_index = Configuration.dynamically_hide_data;
1215 else if ( key.equals( "show_taxonomy_names" ) ) {
1216 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1217 "configuration key [show_taxonomy_names] is deprecated" );
1218 key_index = DEPRECATED;
1220 else if ( key.equals( "show_taxonomy_scientific_names" ) ) {
1221 key_index = Configuration.show_taxonomy_scientific_names;
1223 else if ( key.equals( "show_taxonomy_common_names" ) ) {
1224 key_index = Configuration.show_taxonomy_common_names;
1226 else if ( key.equals( "show_taxonomy_images" ) ) {
1227 key_index = Configuration.show_taxonomy_images;
1229 else if ( key.equals( "color_according_to_annotation" ) ) {
1230 key_index = Configuration.color_according_to_annotation;
1232 else if ( key.equals( "show_property" ) ) {
1233 key_index = Configuration.show_property;
1235 else if ( key.equals( "show_vector_data" ) ) {
1236 key_index = Configuration.show_vector_data;
1238 else if ( key.equals( "show_relation_confidence" ) ) {
1239 key_index = Configuration.show_relation_confidence;
1241 else if ( key.equals( "show_custom_node_shapes" ) ) {
1242 key_index = Configuration.show_custom_node_shapes;
1244 // If we've found the key, set the values
1245 if ( key_index >= 0 ) {
1246 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1247 display_options[ key_index ][ 2 ] = ( String ) st.nextElement();
1248 // otherwise, keep looking
1251 if ( key_index == DEPRECATED ) {
1254 else if ( key.equals( "click_to" ) ) {
1255 final String click_to_name = ( String ) st.nextElement();
1256 key_index = getClickToIndex( click_to_name );
1257 if ( key_index >= 0 ) {
1258 clickto_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1260 else if ( key_index == DEPRECATED ) {
1264 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown click-to option: "
1268 else if ( key.equals( "species_color" ) ) {
1269 getSpeciesColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1271 else if ( key.equals( "domain_color" ) ) {
1272 getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1274 else if ( key.equals( "annotation_color" ) ) {
1275 getAnnotationColors()
1276 .put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1278 else if ( key.equals( "function_color" ) ) {
1279 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1280 "configuration key [function_color] is deprecated" );
1282 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
1283 getDisplayColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1285 else if ( key.equals( WEB_LINK_KEY ) ) {
1286 if ( st.countTokens() == 3 ) {
1287 createWebLink( ( String ) st.nextElement(),
1288 ( String ) st.nextElement(),
1289 ( String ) st.nextElement() );
1292 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1293 "illegal format in configuration file for key [" + key + "]" );
1297 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
1298 + "] in: " + config_filename );
1303 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key + "] in: "
1304 + config_filename );
1308 private void setMinConfidenceValue( final double min_confidence_value ) {
1309 _min_confidence_value = min_confidence_value;
1312 void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
1313 _node_label_direction = node_label_direction;
1316 private void setNumberOfDigitsAfterCommaForBranchLengthValue( final short _number_of_digits_after_comma_for_branch_length_values ) {
1317 this._number_of_digits_after_comma_for_branch_length_values = _number_of_digits_after_comma_for_branch_length_values;
1320 private void setNumberOfDigitsAfterCommaForConfidenceValues( final short _number_of_digits_after_comma_for_confidence_values ) {
1321 this._number_of_digits_after_comma_for_confidence_values = _number_of_digits_after_comma_for_confidence_values;
1324 private void setOvMaxHeight( final short ov_max_height ) {
1325 _ov_max_height = ov_max_height;
1328 private void setOvMaxWidth( final short ov_max_width ) {
1329 _ov_max_width = ov_max_width;
1332 private void setOvPlacement( final OVERVIEW_PLACEMENT_TYPE ov_placement ) {
1333 _ov_placement = ov_placement;
1336 void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
1337 _phylogeny_graphics_type = phylogeny_graphics_type;
1340 private void setPrintLineWidth( final float print_line_width ) {
1341 _print_line_width = print_line_width;
1344 private void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
1345 _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
1348 private void setShowBranchLengthValues( final boolean show_branch_length_values ) {
1349 _show_branch_length_values = show_branch_length_values;
1352 private void setShowOverview( final boolean show_overview ) {
1353 _show_overview = show_overview;
1356 private void setShowScale( final boolean show_scale ) {
1357 _show_scale = show_scale;
1360 private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
1361 _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
1364 void setWebLinks( final SortedMap<String, WebLink> weblinks ) {
1365 _weblinks = weblinks;
1368 static String getDefaultFontFamilyName() {
1369 return DEFAULT_FONT_FAMILY;
1372 static enum TRIPLET {
1373 TRUE, FALSE, UNKNOWN
1376 public Color getDomainStructureFontColor() {
1377 return _domain_structure_font_color;
1380 public Color getDomainStructureBaseColor() {
1381 return _domain_structure_base_color;
1384 public boolean isColorLabelsSameAsParentBranch() {
1385 return _color_labels_same_as_parent_branch;
1388 public boolean isShowDomainLabels() {
1389 return _show_domain_labels;
1392 public boolean isAbbreviateScientificTaxonNames() {
1393 return _abbreviate_scientific_names;
1396 public NodeShape getDefaultNodeShape() {
1397 return _default_node_shape;
1400 private void setDefaultNodeShape( final NodeShape default_node_shape ) {
1401 _default_node_shape = default_node_shape;
1404 private void setDefaultNodeFill( final NodeFill default_node_fill ) {
1405 _default_node_fill = default_node_fill;
1408 public NodeFill getDefaultNodeFill() {
1409 return _default_node_fill;
1412 private void setDefaultNodeShapeSize( final short default_node_shape_size ) {
1413 _default_node_shape_size = default_node_shape_size;
1416 public short getDefaultNodeShapeSize() {
1417 return _default_node_shape_size;
1420 private void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) {
1421 _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes;
1424 public boolean isTaxonomyColorizeNodeShapes() {
1425 return _taxonomy_colorize_node_shapes;
1428 public boolean isShowDefaultNodeShapes() {
1429 return _show_default_node_shapes;
1431 private void setShowDefaultNodeShapes(boolean show_default_node_shapes) {
1432 _show_default_node_shapes =show_default_node_shapes;