// ------------------
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" },
+ { "Colorize by Sequence", "display", "no" },
{ "Visual Styles/Branch Colors", "display", "no" }, { "Branch Widths", "display", "no" },
- { "Protein Domains", "nodisplay", "no" }, { "Binary Characters", "nodisplay", "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", "nodisplay", "no" },
+ { "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", "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 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;
public void setShowScale( final boolean show_scale ) {
_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;
}
}
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;
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;
}
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() ) );
}
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.9891 beta";
- final static String PRG_DATE = "140605";
+ final static String VERSION = "0.9892 beta";
+ final static String PRG_DATE = "140623";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Arial", "Helvetica",
"Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
private List<String> _click_to_names;
private int _collapse_cb_item;
private JCheckBox _color_acc_species;
+ private JCheckBox _color_acc_sequence;
private JCheckBox _color_according_to_annotation;
private boolean _color_branches;
private JCheckBox _use_visual_styles_cb;
private JButton _show_whole;
private int _sort_descendents_item;
private Map<String, Color> _species_colors;
+ private Map<String, Color> _sequence_colors;
private int _subtree_cb_item;
private int _swap_cb_item;
private JButton _uncollapse_all;
@Override
public void actionPerformed( final ActionEvent e ) {
try {
+ if ( e.getSource() == _color_acc_sequence ) {
+ if ( _color_acc_species != null ) {
+ _color_acc_species.setSelected( false );
+ }
+ }
+ else if ( e.getSource() == _color_acc_species ) {
+ if ( _color_acc_sequence != null ) {
+ _color_acc_sequence.setSelected( false );
+ }
+
+ }
+
+
final TreePanel tp = getMainPanel().getCurrentTreePanel();
if ( tp == null ) {
return;
search1();
displayedPhylogenyMightHaveChanged( true );
}
+
+
+
+
else {
displayedPhylogenyMightHaveChanged( true );
}
public JCheckBox getColorAccSpeciesCb() {
return _color_acc_species;
}
+
+ public JCheckBox getColorAccSequenceCb() {
+ return _color_acc_sequence;
+ }
public JCheckBox getUseVisualStylesCb() {
return _use_visual_styles_cb;
case Configuration.color_according_to_species:
_color_acc_species = new JCheckBox( title );
_color_acc_species
- .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
+ .setToolTipText( "To colorize node labels as a function of taxonomy" );
addJCheckBox( _color_acc_species, ch_panel );
add( ch_panel );
break;
+ case Configuration.color_according_to_sequence:
+ _color_acc_sequence = new JCheckBox( title );
+ _color_acc_sequence
+ .setToolTipText( "To colorize node labels as a function of sequence name" );
+ addJCheckBox( _color_acc_sequence, ch_panel );
+ add( ch_panel );
+ break;
case Configuration.color_according_to_annotation:
_color_according_to_annotation = new JCheckBox( title );
_color_according_to_annotation
Map<String, Color> getSpeciesColors() {
return _species_colors;
}
+
+ Map<String, Color> getSequenceColors() {
+ return _sequence_colors;
+ }
boolean isAntialiasScreenText() {
return true;
boolean isColorAccordingToTaxonomy() {
return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
}
+
+ boolean isColorAccordingToSequence() {
+ return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
+ }
boolean isUseVisualStyles() {
return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
_color_acc_species.setSelected( state );
}
break;
+ case Configuration.color_according_to_sequence:
+ if ( _color_acc_sequence != null ) {
+ _color_acc_sequence.setSelected( state );
+ }
+ break;
case Configuration.color_according_to_annotation:
if ( _color_according_to_annotation != null ) {
_color_according_to_annotation.setSelected( state );
void setSpeciesColors( final Map<String, Color> species_colors ) {
_species_colors = species_colors;
}
+
+ void setSequenceColors( final Map<String, Color> sequence_colors ) {
+ _sequence_colors = sequence_colors;
+ }
/* GUILHEM_END */
/*
if ( _color_acc_species != null ) {
_color_acc_species.setSelected( false );
}
+ if ( _color_acc_sequence != null ) {
+ _color_acc_sequence.setSelected( false );
+ }
_mainpanel.getCurrentTreePanel().repaint();
}
private void init() {
_draw_phylogram = new ArrayList<Boolean>();
setSpeciesColors( new HashMap<String, Color>() );
+ setSequenceColors( new HashMap<String, Color>() );
setAnnotationColors( new HashMap<String, Color>() );
}
setCheckbox( Configuration.display_internal_data,
_configuration.doCheckOption( Configuration.display_internal_data ) );
}
+
+
+ if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
+ addCheckbox( Configuration.color_according_to_sequence,
+ _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
+ setCheckbox( Configuration.color_according_to_sequence,
+ _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
+ }
+
+
+
+
if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
addCheckbox( Configuration.color_according_to_species,
_configuration.getDisplayTitle( Configuration.color_according_to_species ) );
void setupTreeGraphic( final Configuration config_settings, final ControlPanel control ) {
control.setSpeciesColors( config_settings.getSpeciesColors() );
+ control.setSequenceColors( config_settings.getSequenceColors() );
control.setAnnotationColors( config_settings.getAnnotationColors() );
RenderableDomainArchitecture.setColorMap( config_settings.getDomainColors() );
}
return c;
}
}
+
+ final Color calculateSequenceBasedColor( final Sequence seq ) {
+ if ( ForesterUtil.isEmpty( seq.getName() ) ) {
+ return getTreeColorSet().getSequenceColor();
+ }
+ Color c = null;
+ final String seq_name = seq.getName();
+ c = getControlPanel().getSequenceColors().get( seq_name );
+ if ( c == null ) {
+ c = TreePanelUtil.calculateColorFromString( seq_name, false );
+ getControlPanel().getSequenceColors().put( seq_name, c );
+ }
+ return c;
+ }
void checkForVectorProperties( final Phylogeny phy ) {
final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
if ( _control_panel.getColorAccSpeciesCb() != null ) {
_control_panel.getColorAccSpeciesCb().setSelected( false );
}
+
_options.setColorLabelsSameAsParentBranch( true );
_control_panel.repaint();
}
return _statistics_for_vector_data;
}
- /**
- * Find a color for this species name.
- *
- * @param species
- * @return the species color
- */
+
final Color getTaxonomyBasedColor( final PhylogenyNode node ) {
if ( node.getNodeData().isHasTaxonomy() ) {
return calculateTaxonomyBasedColor( node.getNodeData().getTaxonomy() );
// return non-colorized color
return getTreeColorSet().getTaxonomyColor();
}
+
+
+ final Color getSequenceBasedColor( final PhylogenyNode node ) {
+ if ( node.getNodeData().isHasSequence() ) {
+ return calculateSequenceBasedColor( node.getNodeData().getSequence() );
+ }
+ // return non-colorized color
+ return getTreeColorSet().getSequenceColor();
+ }
+
/**
* @return pointer to colorset for tree drawing
else if ( is_in_found_nodes ) {
c = getColorForFoundNode( node );
}
+ else if ( getControlPanel().isColorAccordingToSequence() ) {
+ c = getSequenceBasedColor( node );
+ }
else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
c = getTaxonomyBasedColor( node );
}
&& ( node.getNodeData().getNodeVisualData().getFontColor() != null ) ) {
g.setColor( node.getNodeData().getNodeVisualData().getFontColor() );
}
+ else if ( getControlPanel().isColorAccordingToSequence() ) {
+ g.setColor( getSequenceBasedColor( node ) );
+ }
else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
g.setColor( getTaxonomyBasedColor( node ) );
}
else if ( isInFoundNodes0( node ) && isInFoundNodes1( node ) ) {
_rollover_popup.setForeground( getTreeColorSet().getFoundColor0and1() );
}
- else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
- _rollover_popup.setForeground( getTaxonomyBasedColor( node ) );
- }
else {
_rollover_popup.setForeground( getTreeColorSet().getSequenceColor() );
}