else if ( key.equals( "width_branches" ) ) {
key_index = Configuration.width_branches;
}
- else if ( key.equals( "color_orthologous" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
- "configuration key [color_orthologous] is deprecated" );
- }
- else if ( key.equals( "color_subtree_neighbors" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
- "configuration key [color_subtree_neighbors] is deprecated" );
- }
- else if ( key.equals( "color_super_orthologous" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
- "configuration key [color_super_orthologous] is deprecated" );
- }
else if ( key.equals( "mark_nodes_with_box" ) ) {
ForesterUtil.printWarningMessage( Constants.PRG_NAME,
"configuration key [mark_nodes_with_box] is deprecated" );
}
}
else if ( key.equals( "species_color" ) ) {
- getSpeciesColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
+ getSpeciesColors().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() ) );
}
final Color calculateTaxonomyBasedColor( final Taxonomy tax ) {
- String species = tax.getTaxonomyCode();
- if ( ForesterUtil.isEmpty( species ) ) {
- species = tax.getScientificName();
- if ( ForesterUtil.isEmpty( species ) ) {
- species = tax.getCommonName();
- }
- }
- if ( ForesterUtil.isEmpty( species ) ) {
+ if ( ForesterUtil.isEmpty( tax.getTaxonomyCode() ) && ForesterUtil.isEmpty( tax.getScientificName() ) ) {
return getTreeColorSet().getTaxonomyColor();
}
- // Look in species hash
- Color c = getControlPanel().getSpeciesColors().get( species );
+ Color c = null;
+ if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+ c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() );
+ }
+ if ( c == null && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+ c = getControlPanel().getSpeciesColors().get( tax.getScientificName() );
+ }
if ( c == null ) {
- c = AptxUtil.calculateColorFromString( species );
- getControlPanel().getSpeciesColors().put( species, c );
+ if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+ c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode() );
+ getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
+ }
+ else {
+ c = AptxUtil.calculateColorFromString( tax.getScientificName() );
+ getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
+ }
}
return c;
}