fixing vector size issue...
[jalview.git] / forester / java / src / org / forester / archaeopteryx / Configuration.java
index 1914d76..2a4b7dd 100644 (file)
@@ -90,18 +90,18 @@ public final class Configuration {
     // ------------------
     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" },
-            { "Visual Styles/Branch Colors", "display", "no" }, { "Branch Widths", "display", "no" },
-            { "Protein Domains", "nodisplay", "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" }, { "Rollover", "display", "yes" },
-            { "Relation Confidence", "nodisplay", "no" }, { "Vector Data", "nodisplay", "no" },
-            { "Taxonomy Images", "display", "no" }, { "Properties", "nodisplay", "no" },
-            { "Gene Name", "display", "yes" }                                                     };
+            { "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", "display", "no" }, { "Seq Symbol", "display", "yes" },
+            { "Rollover", "display", "yes" }, { "Relation Confidence", "nodisplay", "no" },
+            { "Vector Data", "nodisplay", "no" }, { "Taxonomy Images", "display", "no" },
+            { "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;
@@ -109,37 +109,30 @@ public final class Configuration {
     final static int                        write_confidence_values                                = 4;
     final static int                        write_events                                           = 5;
     final static int                        color_according_to_species                             = 6;
-    final static int                        use_style                                              = 7;
-    final static int                        width_branches                                         = 8;
-    final static int                        show_domain_architectures                              = 9;
-    final static int                        show_binary_characters                                 = 10;
-    final static int                        show_binary_character_counts                           = 11;
-    final static int                        show_seq_names                                         = 12;
-    final static int                        show_sequence_acc                                      = 13;
-    final static int                        display_internal_data                                  = 14;
-    final static int                        dynamically_hide_data                                  = 15;
-    final static int                        show_taxonomy_scientific_names                         = 16;
-    final static int                        show_taxonomy_common_names                             = 17;
-    final static int                        color_according_to_annotation                          = 18;
-    final static int                        show_seq_symbols                                       = 19;
-    final static int                        node_data_popup                                        = 20;
-    final static int                        show_relation_confidence                               = 21;
-    final static int                        show_vector_data                                       = 22;
-    final static int                        show_taxonomy_images                                   = 23;
-    final static int                        show_properties                                        = 24;
-    final static int                        show_gene_names                                        = 25;
+    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_binary_characters                                 = 11;
+    final static int                        show_binary_character_counts                           = 12;
+    final static int                        show_seq_names                                         = 13;
+    final static int                        show_sequence_acc                                      = 14;
+    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                        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";
-    // ----------------
-    // Function colors
-    // ----------------
+    private static Hashtable<String, Color> _sequence_colors;
     private static Hashtable<String, Color> _annotation_colors;
-    // ----------------
-    // Domain colors
-    // ----------------
     private static Hashtable<String, Color> _domain_colors;
-    // ----------------
-    // Species colors
-    // ----------------
     private static Hashtable<String, Color> _species_colors;
     private static String                   DEFAULT_FONT_FAMILY                                    = "";
     private static final int                DEPRECATED                                             = -2;
@@ -224,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 ) {
@@ -352,7 +350,7 @@ public final class Configuration {
         return _path_to_local_fastme;
     }
 
-    public File getpathToLocalMafft() {
+    public File getPathToLocalMafft() {
         return _path_to_local_mafft;
     }
 
@@ -568,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;
     }
@@ -735,6 +725,13 @@ public final class Configuration {
         return _species_colors;
     }
 
+    Hashtable<String, Color> getSequenceColors() {
+        if ( _sequence_colors == null ) {
+            _sequence_colors = new Hashtable<String, Color>();
+        }
+        return _sequence_colors;
+    }
+
     final TAXONOMY_EXTRACTION getTaxonomyExtraction() {
         return _taxonomy_extraction;
     }
@@ -1510,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;
@@ -1522,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;
             }
@@ -1625,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() ) );
                 }
@@ -1714,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;
+    }
 }