X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FConfiguration.java;h=2a4b7dd3f6f3827e02703004a565c65de675fed7;hb=9673231c870387fffa4516124d802ee47bbdaf45;hp=7c46dffb3fa95ab1477bf783e6890042751f23c2;hpb=7b05eefd8e0eb34d3879f59f0c8d12d785283d2d;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index 7c46dff..2a4b7dd 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -55,89 +55,84 @@ import org.forester.util.ForesterUtil; public final class Configuration { - final static int add_new_node = 14; - final static int blast = 9; final static String clickto_options[][] = { { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" }, - { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, - { "Colorize Subtree/Node(s)", "display" }, { "Open Sequence DB", "display" }, { "Open PDB", "display" }, - { "Open Taxonomy DB", "display" }, { "Blast", "display" }, { "Cut Subtree", "display" }, + { "Go to Sub-/Super-Tree", "display" }, { "Swap Descendants", "display" }, + { "Colorize Node(s)", "display" }, { "Change Node Font(s)", "display" }, + { "Colorize Subtree(s)", "display" }, { "Open Sequence DB", "display" }, { "Open PDB", "display" }, + { "Open Taxonomy DB", "display" }, { "Launch BLAST", "display" }, { "Cut Subtree", "display" }, { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" }, { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Sort Descendants", "display" }, { "Return", "display" }, { "Select Node(s)", "display" } }; + final static int display_node_data = 0; final static int collapse_uncollapse = 1; - final static int color_according_to_annotation = 19; - final static int color_according_to_species = 6; - final static int color_branches = 7; - final static int color_subtree = 5; - final static int copy_subtree = 11; - final static int cut_subtree = 10; - final static int delete_subtree_or_node = 13; - final static int display_as_phylogram = 0; - final static int display_internal_data = 15; + final static int reroot = 2; + final static int subtree = 3; + final static int swap = 4; + final static int color_node_font = 5; + final static int change_node_font = 6; + final static int color_subtree = 7; + final static int open_seq_web = 8; + final static int open_pdb_web = 9; + final static int open_tax_web = 10; + final static int blast = 11; + final static int cut_subtree = 12; + final static int copy_subtree = 13; + final static int paste_subtree = 14; + final static int delete_subtree_or_node = 15; + final static int add_new_node = 16; + final static int edit_node_data = 17; + final static int sort_descendents = 18; + final static int get_ext_desc_data = 19; + final static int select_nodes = 20; // ------------------ // Click-to options // ------------------ - final static int display_node_data = 0; final static String display_options[][] = { { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" }, - { "Seq Annotations", "nodisplay", "no" }, { "Confidence Values", "display", "?" }, + { "Seq Annotations", "display", "no" }, { "Confidence Values", "display", "?" }, { "Node Events", "display", "?" }, { "Colorize by Taxonomy", "display", "no" }, - { "Use Branch Colors", "display", "no" }, { "Use Branch Widths", "display", "no" }, - { "Show Custom Nodes", "display", "yes" }, { "Protein Domains", "nodisplay", "no" }, + { "Colorize by Sequence", "display", "no" }, { "Visual Styles/Branch Colors", "display", "no" }, + { "Branch Widths", "display", "no" }, { "Protein Domains", "display", "no" }, { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" }, { "Seq Name", "display", "yes" }, { "Seq Accession", "display", "no" }, { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" }, { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" }, - { "Colorize by Annotation", "nodisplay", "no" }, { "Seq Symbol", "display", "yes" }, + { "Colorize by Annotation", "display", "no" }, { "Seq Symbol", "display", "yes" }, { "Rollover", "display", "yes" }, { "Relation Confidence", "nodisplay", "no" }, { "Vector Data", "nodisplay", "no" }, { "Taxonomy Images", "display", "no" }, - { "Properties", "nodisplay", "no" }, { "Gene Name", "display", "yes" } }; - final static int dynamically_hide_data = 16; - final static int edit_node_data = 15; - final static int get_ext_desc_data = 17; - final static int node_data_popup = 21; - final static int open_pdb_web = 7; - final static int open_seq_web = 6; - final static int open_tax_web = 8; - final static int paste_subtree = 12; - final static int reroot = 2; - final static int select_nodes = 18; + { "Properties", "display", "no" }, { "Gene Name", "display", "yes" } }; + final static int display_as_phylogram = 0; + final static int show_node_names = 1; + final static int show_tax_code = 2; final static int show_annotation = 3; - final static int show_binary_character_counts = 12; - final static int show_binary_characters = 11; - final static int show_custom_node_shapes = 9; + final static int write_confidence_values = 4; + final static int write_events = 5; + final static int color_according_to_species = 6; + final static int color_according_to_sequence = 7; + final static int use_style = 8; + final static int width_branches = 9; final static int show_domain_architectures = 10; - final static int show_gene_names = 26; - final static int show_node_names = 1; - final static int show_properties = 25; - final static int show_relation_confidence = 22; + final static int show_binary_characters = 11; + final static int show_binary_character_counts = 12; final static int show_seq_names = 13; - final static int show_seq_symbols = 20; final static int show_sequence_acc = 14; - final static int show_tax_code = 2; - final static int show_taxonomy_common_names = 18; - final static int show_taxonomy_images = 24; + final static int display_internal_data = 15; + final static int dynamically_hide_data = 16; final static int show_taxonomy_scientific_names = 17; + final static int show_taxonomy_common_names = 18; + final static int color_according_to_annotation = 19; + final static int show_seq_symbols = 20; + final static int node_data_popup = 21; + final static int show_relation_confidence = 22; final static int show_vector_data = 23; - final static int sort_descendents = 16; - final static int subtree = 3; - final static int swap = 4; + final static int show_taxonomy_images = 24; + final static int show_properties = 25; + final static int show_gene_names = 26; static final String VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA = "validate_against_phyloxml_xsd_schema"; - final static int width_branches = 8; - final static int write_confidence_values = 4; - final static int write_events = 5; - // ---------------- - // Function colors - // ---------------- + private static Hashtable _sequence_colors; private static Hashtable _annotation_colors; - // ---------------- - // Domain colors - // ---------------- private static Hashtable _domain_colors; - // ---------------- - // Species colors - // ---------------- private static Hashtable _species_colors; private static String DEFAULT_FONT_FAMILY = ""; private static final int DEPRECATED = -2; @@ -222,6 +217,11 @@ public final class Configuration { private UI _ui = UI.UNKNOWN; private boolean _use_tabbed_display = false; private boolean _validate_against_phyloxml_xsd_schema = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT; + private Color _vector_data_min_color = Color.BLUE; + private Color _vector_data_max_color = Color.YELLOW; + private Color _vector_data_mean_color = Color.WHITE; + private double _vector_data_height = 12; + private int _vector_data_width = 120; static { for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) { if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) { @@ -350,7 +350,7 @@ public final class Configuration { return _path_to_local_fastme; } - public File getpathToLocalMafft() { + public File getPathToLocalMafft() { return _path_to_local_mafft; } @@ -398,6 +398,10 @@ public final class Configuration { getDisplayColors().put( key, color ); } + public void setAddTaxonomyImagesCB( final boolean b ) { + display_options[ show_taxonomy_images ][ 1 ] = b ? "yes" : "no"; + } + public void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) { _abbreviate_scientific_names = abbreviate_scientific_names; } @@ -415,7 +419,7 @@ public final class Configuration { } public void setColorizeBranches( final boolean b ) { - display_options[ color_branches ][ 2 ] = b ? "yes" : "no"; + display_options[ use_style ][ 2 ] = b ? "yes" : "no"; } public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) { @@ -438,6 +442,10 @@ public final class Configuration { display_options[ display_as_phylogram ][ 2 ] = b ? "yes" : "no"; } + public void setUseStyle( final boolean b ) { + display_options[ use_style ][ 2 ] = b ? "yes" : "no"; + } + public void setDisplayColors( final SortedMap display_colors ) { _display_colors = display_colors; } @@ -462,6 +470,10 @@ public final class Configuration { display_options[ show_seq_names ][ 2 ] = b ? "yes" : "no"; } + public void setDisplayGeneNames( final boolean b ) { + display_options[ show_gene_names ][ 2 ] = b ? "yes" : "no"; + } + public void setDisplaySequenceRelations( final boolean display_sequence_relations ) { _display_sequence_relations = display_sequence_relations; } @@ -554,14 +566,6 @@ public final class Configuration { _show_scale = show_scale; } - public void setTaxonomyColorize( final boolean b ) { - display_options[ color_according_to_species ][ 2 ] = b ? "yes" : "no"; - } - - public void setUseBranchesWidths( final boolean b ) { - display_options[ width_branches ][ 2 ] = b ? "yes" : "no"; - } - boolean displaySequenceRelations() { return _display_sequence_relations; } @@ -721,6 +725,13 @@ public final class Configuration { return _species_colors; } + Hashtable getSequenceColors() { + if ( _sequence_colors == null ) { + _sequence_colors = new Hashtable(); + } + return _sequence_colors; + } + final TAXONOMY_EXTRACTION getTaxonomyExtraction() { return _taxonomy_extraction; } @@ -876,6 +887,15 @@ public final class Configuration { else if ( name.equals( "color_subtree" ) ) { index = Configuration.color_subtree; } + else if ( name.equals( "change_node_font" ) ) { + index = Configuration.change_node_font; + } + else if ( name.equals( "color_node_font" ) ) { + index = Configuration.color_node_font; + } + else if ( name.equals( "color_subtree" ) ) { + index = Configuration.color_subtree; + } return index; } @@ -1487,6 +1507,30 @@ public final class Configuration { + "] for [ext_descendents_data_to_return_on]" ); } } + // + else if ( key.equals( "vector_data_min_color" ) ) { + _vector_data_min_color = Color.decode( ( String ) st.nextElement() ); + } + else if ( key.equals( "vector_data_max_color" ) ) { + _vector_data_max_color = Color.decode( ( String ) st.nextElement() ); + } + else if ( key.equals( "vector_data_mean_color" ) ) { + _vector_data_mean_color = Color.decode( ( String ) st.nextElement() ); + } + // + else if ( key.equals( "vector_data_width" ) ) { + _vector_data_width = parseShort( ( String ) st.nextElement() ); + if ( _vector_data_width < 1 ) { + _vector_data_width = 120; + } + } + else if ( key.equals( "vector_data_height" ) ) { + _vector_data_height = parseShort( ( String ) st.nextElement() ); + if ( _vector_data_height < 1 ) { + _vector_data_height = 12; + } + } + // else if ( st.countTokens() >= 2 ) { // counts the tokens that are not // yet retrieved! int key_index = -1; @@ -1499,6 +1543,9 @@ public final class Configuration { else if ( key.equals( "color_according_to_species" ) ) { key_index = Configuration.color_according_to_species; } + else if ( key.equals( "color_according_to_sequence" ) ) { + key_index = Configuration.color_according_to_sequence; + } else if ( key.equals( "show_node_names" ) ) { key_index = Configuration.show_node_names; } @@ -1511,8 +1558,14 @@ public final class Configuration { else if ( key.equals( "write_events" ) ) { key_index = Configuration.write_events; } + else if ( key.equals( "use_visual_styles" ) ) { + key_index = Configuration.use_style; + } else if ( key.equals( "color_branches" ) ) { - key_index = Configuration.color_branches; + key_index = Configuration.use_style; + ForesterUtil + .printWarningMessage( Constants.PRG_NAME, + "configuration key [color_branches] is deprecated, use [use_visual_styles] instead" ); } else if ( key.equals( "width_branches" ) ) { key_index = Configuration.width_branches; @@ -1568,9 +1621,6 @@ public final class Configuration { else if ( key.equals( "show_relation_confidence" ) ) { key_index = Configuration.show_relation_confidence; } - else if ( key.equals( "show_custom_node_shapes" ) ) { - key_index = Configuration.show_custom_node_shapes; - } // If we've found the key, set the values if ( key_index >= 0 ) { display_options[ key_index ][ 1 ] = ( String ) st.nextElement(); @@ -1599,6 +1649,10 @@ public final class Configuration { getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ), Color.decode( ( String ) st.nextElement() ) ); } + else if ( key.equals( "sequence_color" ) ) { + getSequenceColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ), + Color.decode( ( String ) st.nextElement() ) ); + } else if ( key.equals( "domain_color" ) ) { getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) ); } @@ -1688,4 +1742,24 @@ public final class Configuration { static enum TRIPLET { FALSE, TRUE, UNKNOWN } + + public Color getVectorDataMinColor() { + return _vector_data_min_color; + } + + public Color getVectorDataMaxColor() { + return _vector_data_max_color; + } + + public Color getVectorDataMeanColor() { + return _vector_data_mean_color; + } + + public double getVectorDataHeight() { + return _vector_data_height; + } + + public int getVectorDataWidth() { + return _vector_data_width; + } }