private float _y_distance = 0.0f;
private int _length_of_longest_text;
private int _longest_domain;
+ public final static boolean SPECIAL_DOMAIN_COLORING = true;
// private Image offscreenImage;
// private Graphics offscreenGraphics;
// private Dimension offscreenDimension;
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
RenderableDomainArchitecture rds = null;
if ( !( node.getNodeData().getSequence().getDomainArchitecture() instanceof RenderableDomainArchitecture ) ) {
- rds = new RenderableDomainArchitecture( node.getNodeData().getSequence().getDomainArchitecture() );
+ if ( SPECIAL_DOMAIN_COLORING ) {
+ rds = new RenderableDomainArchitecture( node.getNodeData().getSequence()
+ .getDomainArchitecture(), node.getName() );
+ }
+ else {
+ rds = new RenderableDomainArchitecture( node.getNodeData().getSequence()
+ .getDomainArchitecture() );
+ }
node.getNodeData().getSequence().setDomainArchitecture( rds );
}
else {
public final class RenderableDomainArchitecture extends DomainArchitecture implements RenderablePhylogenyData {
+ final static private String SPECIAL_DOMAIN = "RRMa";
final static private int BRIGHTEN_COLOR_BY = 200;
final static private int E_VALUE_THRESHOLD_EXP_DEFAULT = 0;
final static private BasicStroke STROKE_1 = new BasicStroke( 1f );
private final Rectangle2D _rectangle = new Rectangle2D.Float();
private float _rendering_factor_width = 1;
private float _rendering_height = 0;
+ private String _node_name;
public RenderableDomainArchitecture( final DomainArchitecture domain_structure ) {
_domain_structure = domain_structure;
}
+ public RenderableDomainArchitecture( final DomainArchitecture domain_structure, final String node_name ) {
+ _domain_structure = domain_structure;
+ _node_name = node_name;
+ }
+
public static void setColorMap( final Map<String, Color> domain_colors ) {
_domain_colors = domain_colors;
}
}
}
+ private final void drawDomainGrey( final double x,
+ final double y,
+ final double width,
+ final double heigth,
+ final String name,
+ final Graphics2D g,
+ final boolean to_pdf ) {
+ final double h2 = heigth / 2.0;
+ final Color color_one = Color.GRAY;
+ final Color color_two = getColorTwo( color_one );
+ double step = 1;
+ if ( to_pdf ) {
+ step = 0.05;
+ }
+ for( double i = 0; i < heigth; i += step ) {
+ g.setColor( org.forester.util.ForesterUtil
+ .calcColor( i >= h2 ? heigth - i : i, 0, h2, color_one, color_two ) );
+ _rectangle.setFrame( x, i + y, width, step );
+ g.fill( _rectangle );
+ }
+ }
+
private final Color getColorOne( final String name ) {
Color c = _domain_colors.get( name );
if ( c == null ) {
}
_rectangle.setFrame( start, y - 0.5, _domain_structure.getTotalLength() * f, 1 );
g.fill( _rectangle );
+ short special_domain_count = 0;
for( int i = 0; i < _domain_structure.getDomains().size(); ++i ) {
final ProteinDomain d = _domain_structure.getDomain( i );
- if ( d.getConfidence() <= Math.pow( 10, _e_value_threshold_exp ) ) {
+ if ( ( d.getConfidence() <= Math.pow( 10, _e_value_threshold_exp ) )
+ || ( TreePanel.SPECIAL_DOMAIN_COLORING && ( d.getName().equals( SPECIAL_DOMAIN ) ) && ( ( d
+ .getConfidence() <= 1 ) ) ) ) {
+ if ( TreePanel.SPECIAL_DOMAIN_COLORING && ( d.getName().equals( SPECIAL_DOMAIN ) ) ) {
+ special_domain_count++;
+ }
final float xa = start + ( d.getFrom() * f );
final float xb = xa + ( d.getLength() * f );
if ( tree_panel.getMainPanel().getOptions().isShowDomainLabels()
+ tree_panel.getMainPanel().getTreeFontSet().getFontMetricsSmall().getAscent()
+ _rendering_height );
}
- drawDomain( xa, y1, xb - xa, _rendering_height, d.getName(), g, to_pdf );
+ if ( TreePanel.SPECIAL_DOMAIN_COLORING && ( _node_name.indexOf( "~" ) > 1 )
+ && ( d.getName().equals( SPECIAL_DOMAIN ) )
+ && ( _node_name.indexOf( "~" + special_domain_count + "-" ) < 1 ) ) {
+ drawDomainGrey( xa, y1, xb - xa, _rendering_height, d.getName(), g, to_pdf );
+ }
+ else {
+ drawDomain( xa, y1, xb - xa, _rendering_height, d.getName(), g, to_pdf );
+ }
}
}
g.setStroke( s );