From 047c3b6856337c82d50c7496aff6ff5d5e751e03 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Mon, 16 Apr 2012 18:20:02 +0000 Subject: [PATCH] in progress --- .../src/org/forester/archaeopteryx/Constants.java | 10 ++++---- .../src/org/forester/archaeopteryx/TreePanel.java | 25 ++++++++++++-------- .../data/RenderableDomainArchitecture.java | 5 ++-- .../phylogeny/data/DomainArchitecture.java | 19 ++++++++------- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/Constants.java b/forester/java/src/org/forester/archaeopteryx/Constants.java index f53c94e..0dde21a 100644 --- a/forester/java/src/org/forester/archaeopteryx/Constants.java +++ b/forester/java/src/org/forester/archaeopteryx/Constants.java @@ -36,14 +36,14 @@ import org.forester.util.ForesterConstants; public final class Constants { - final static boolean __ALLOW_PHYLOGENETIC_INFERENCE = true; - public final static boolean __RELEASE = false; // TODO remove me - public final static boolean __SNAPSHOT_RELEASE = false; // TODO remove me + final static boolean __ALLOW_PHYLOGENETIC_INFERENCE = false; + public final static boolean __RELEASE = true; // TODO remove me + public final static boolean __SNAPSHOT_RELEASE = true; // TODO remove me public final static boolean __SYNTH_LF = false; // TODO remove me public final static boolean ALLOW_DDBJ_BLAST = false; public final static String PRG_NAME = "Archaeopteryx"; final static String VERSION = "0.971 9M"; - final static String PRG_DATE = "2012.04.09"; + final static String PRG_DATE = "2012.04.16"; final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file"; final static String[] DEFAULT_FONT_CHOICES = { "Verdana", "Tahoma", "Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" }; @@ -60,7 +60,7 @@ public final class Constants { final static float WHEEL_ZOOM_IN_X_CORRECTION_FACTOR = 1.085f; final static float WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR = 1 / Constants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR; static final boolean SPECIAL_CUSTOM = false; //TODO remove me - static final int EXT_NODE_INFO_LENGTH_MAX = 300; + static final double EXT_NODE_INFO_LENGTH_MAX_RATIO = 0.95; static final Dimension NODE_PANEL_SPLIT_MINIMUM_SIZE = new Dimension( 100, 50 ); static final Dimension NODE_PANEL_SIZE = new Dimension( 500, 600 ); static final Dimension NODE_FRAME_SIZE = new Dimension( 520, 640 ); diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index c64a820..b245183 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -544,7 +544,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) { return; } - int longest = 20; + int max_length = ForesterUtil.roundToInt( ( getSize().getWidth() - MOVE ) + * Constants.EXT_NODE_INFO_LENGTH_MAX_RATIO ); + if ( max_length < 40 ) { + max_length = 40; + } + int longest = 30; for( final PhylogenyNode node : _phylogeny.getExternalNodes() ) { int sum = 0; if ( node.isCollapse() ) { @@ -574,6 +579,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee .asSimpleText() + " " ); } + if ( getControlPanel().isShowDomainArchitectures() + && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) { + sum += ( ( RenderableDomainArchitecture ) node.getNodeData().getSequence().getDomainArchitecture() ) + .getRenderingSize().getWidth(); + } } if ( node.getNodeData().isHasTaxonomy() ) { final Taxonomy tax = node.getNodeData().getTaxonomy(); @@ -595,21 +605,16 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee sum += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getBinaryCharacters() .getGainedCharactersAsStringBuffer().toString() ); } - if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence() - && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) { - sum += ( ( RenderableDomainArchitecture ) node.getNodeData().getSequence().getDomainArchitecture() ) - .getRenderingSize().getWidth(); - } - if ( sum >= Constants.EXT_NODE_INFO_LENGTH_MAX ) { - setLongestExtNodeInfo( Constants.EXT_NODE_INFO_LENGTH_MAX ); + if ( sum >= max_length ) { + setLongestExtNodeInfo( max_length ); return; } if ( sum > longest ) { longest = sum; } } - if ( longest >= Constants.EXT_NODE_INFO_LENGTH_MAX ) { - setLongestExtNodeInfo( Constants.EXT_NODE_INFO_LENGTH_MAX ); + if ( longest >= max_length ) { + setLongestExtNodeInfo( max_length ); } else { setLongestExtNodeInfo( longest ); diff --git a/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableDomainArchitecture.java b/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableDomainArchitecture.java index ed12a91..539dd65 100644 --- a/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableDomainArchitecture.java +++ b/forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableDomainArchitecture.java @@ -32,6 +32,7 @@ import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.Writer; +import java.math.BigDecimal; import java.util.Map; import java.util.SortedMap; @@ -135,7 +136,7 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple } @Override - public SortedMap getDomains() { + public SortedMap getDomains() { return _domain_structure.getDomains(); } @@ -160,7 +161,7 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple @Override public Dimension getRenderingSize() { - return new Dimension( ForesterUtil.roundToInt( _domain_structure.getTotalLength() * _rendering_factor_width ), + return new Dimension( ForesterUtil.roundToInt( _domain_structure.getTotalLength() * getRenderingFactorWidth() ), ForesterUtil.roundToInt( _rendering_height ) ); } diff --git a/forester/java/src/org/forester/phylogeny/data/DomainArchitecture.java b/forester/java/src/org/forester/phylogeny/data/DomainArchitecture.java index e93e742..3dcf02a 100644 --- a/forester/java/src/org/forester/phylogeny/data/DomainArchitecture.java +++ b/forester/java/src/org/forester/phylogeny/data/DomainArchitecture.java @@ -27,6 +27,7 @@ package org.forester.phylogeny.data; import java.io.IOException; import java.io.Writer; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.SortedMap; @@ -40,10 +41,10 @@ import org.forester.util.ForesterUtil; public class DomainArchitecture implements PhylogenyData { - public final static String NHX_SEPARATOR = ">"; - private static final double INCREASE_KEY = 0.0001; - private SortedMap _domains; - private int _total_length; + public final static String NHX_SEPARATOR = ">"; + private static final BigDecimal INCREASE_KEY = new BigDecimal( "0.00001" ); + private SortedMap _domains; + private int _total_length; public DomainArchitecture() { init(); @@ -79,7 +80,7 @@ public class DomainArchitecture implements PhylogenyData { } } catch ( final Exception e ) { - throw new IllegalArgumentException( "Malformed format for domain structure \"" + da_str + "\": " + throw new IllegalArgumentException( "malformed format for domain structure \"" + da_str + "\": " + e.getMessage() ); } if ( to > total_length ) { @@ -89,9 +90,9 @@ public class DomainArchitecture implements PhylogenyData { } public void addDomain( final ProteinDomain pd ) { - Double key = new Double( pd.getFrom() ); + BigDecimal key = new BigDecimal( "" + pd.getFrom() ); while ( _domains.containsKey( key ) ) { - key = new Double( key.doubleValue() + DomainArchitecture.INCREASE_KEY ); + key = new BigDecimal( "" + ( key.doubleValue() + DomainArchitecture.INCREASE_KEY.doubleValue() ) ); } _domains.put( key, pd ); } @@ -133,7 +134,7 @@ public class DomainArchitecture implements PhylogenyData { return ( ProteinDomain ) _domains.values().toArray()[ i ]; } - public SortedMap getDomains() { + public SortedMap getDomains() { return _domains; } @@ -146,7 +147,7 @@ public class DomainArchitecture implements PhylogenyData { } private void init() { - _domains = new TreeMap(); + _domains = new TreeMap(); _total_length = 0; } -- 1.7.10.2