From: cmzmasek Date: Sun, 3 Aug 2014 13:34:36 +0000 (+0000) Subject: fixing vector size issue... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1702b9bd1e87048151c4b40c9c8598291d6fcfed;p=jalview.git fixing vector size issue... --- diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index 5ae230f..2a4b7dd 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -92,17 +92,16 @@ public final class Configuration { { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" }, { "Seq Annotations", "display", "no" }, { "Confidence Values", "display", "?" }, { "Node Events", "display", "?" }, { "Colorize by Taxonomy", "display", "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", "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" } }; + { "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; @@ -131,9 +130,7 @@ public final class Configuration { 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"; - private static Hashtable _sequence_colors; - - + private static Hashtable _sequence_colors; private static Hashtable _annotation_colors; private static Hashtable _domain_colors; private static Hashtable _species_colors; @@ -220,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 ) { @@ -348,7 +350,7 @@ public final class Configuration { return _path_to_local_fastme; } - public File getpathToLocalMafft() { + public File getPathToLocalMafft() { return _path_to_local_mafft; } @@ -563,7 +565,7 @@ public final class Configuration { public void setShowScale( final boolean show_scale ) { _show_scale = show_scale; } - + boolean displaySequenceRelations() { return _display_sequence_relations; } @@ -722,7 +724,7 @@ public final class Configuration { } return _species_colors; } - + Hashtable getSequenceColors() { if ( _sequence_colors == null ) { _sequence_colors = new Hashtable(); @@ -1505,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; @@ -1625,7 +1651,7 @@ public final class Configuration { } else if ( key.equals( "sequence_color" ) ) { getSequenceColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ), - Color.decode( ( String ) st.nextElement() ) ); + Color.decode( ( String ) st.nextElement() ) ); } else if ( key.equals( "domain_color" ) ) { getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) ); @@ -1716,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; + } } diff --git a/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableVector.java b/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableVector.java index a25af65..c39cf8d 100644 --- a/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableVector.java +++ b/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableVector.java @@ -48,16 +48,21 @@ public final class RenderableVector implements RenderablePhylogenyData { private double _rendering_factor_width = 1.0; private List _values; private final Rectangle2D _rectangle = new Rectangle2D.Float(); - private Configuration _configuration; - private double _height; + + private double _height = VECTOR_DEFAULT_HEIGHT; private double _min; private double _max; private double _mean; + private Color _min_color = Color.BLUE; + private Color _max_color = Color.YELLOW; + private Color _mean_color = Color.WHITE; + private int _width = VECTOR_DEFAULT_WIDTH; + + private static RenderableVector _instance = null; private RenderableVector() { _values = null; - _configuration = null; } @Override @@ -116,7 +121,7 @@ public final class RenderableVector implements RenderablePhylogenyData { final boolean to_pdf ) { final double y = y1; final double start = x1 + 20.0; - final double width = ( double ) VECTOR_DEFAULT_WIDTH / _values.size(); + final double width = ( double ) _width / _values.size(); for( int i = 0; i < _values.size(); ++i ) { g.setColor( calculateColor( _values.get( i ) ) ); _rectangle.setFrame( start + ( i * width ), y - 0.5, width, getRenderingHeight() ); @@ -149,7 +154,7 @@ public final class RenderableVector implements RenderablePhylogenyData { } private Color calculateColor( final double v ) { - return ForesterUtil.calcColor( v, _min, _max, _mean, Color.BLUE, Color.RED, Color.WHITE ); + return ForesterUtil.calcColor( v, _min, _max, _mean, _min_color, _max_color, _mean_color ); } private double getRenderingHeight() { @@ -162,9 +167,18 @@ public final class RenderableVector implements RenderablePhylogenyData { if ( _instance == null ) { _instance = new RenderableVector(); } - _instance.setRenderingHeight( VECTOR_DEFAULT_HEIGHT ); + //_instance.setRenderingHeight( VECTOR_DEFAULT_HEIGHT ); _instance._values = values; - _instance._configuration = configuration; + + if ( configuration != null ) { + _instance._min_color =configuration.getVectorDataMinColor(); + _instance._max_color = configuration.getVectorDataMaxColor(); + _instance._mean_color = configuration.getVectorDataMeanColor(); + _instance._width = configuration.getVectorDataWidth(); + _instance._height = configuration.getVectorDataHeight(); + } + + if ( stats.getN() > 0 ) { _instance._min = stats.getMin(); _instance._max = stats.getMax(); diff --git a/forester/java/src/org/forester/archaeopteryx/tools/InferenceManager.java b/forester/java/src/org/forester/archaeopteryx/tools/InferenceManager.java index e3e5e65..d7fe243 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/InferenceManager.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/InferenceManager.java @@ -14,7 +14,7 @@ public final class InferenceManager { private final File _path_to_local_raxml; public static InferenceManager createInstance( final Configuration c ) { - return new InferenceManager( c.getpathToLocalMafft(), c.getPathToLocalFastme(), c.getPathToLocalRaxml() ); + return new InferenceManager( c.getPathToLocalMafft(), c.getPathToLocalFastme(), c.getPathToLocalRaxml() ); } public boolean canDoMsa() {