import org.forester.phylogeny.PhylogenyNode;\r
import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;\r
import org.forester.phylogeny.data.Annotation;\r
+import org.forester.phylogeny.data.NodeDataField;\r
import org.forester.phylogeny.data.NodeVisualData.NodeFill;\r
import org.forester.phylogeny.data.NodeVisualData.NodeShape;\r
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;\r
public abstract class MainFrame extends JFrame implements ActionListener {\r
\r
static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]";\r
- static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME\r
+ static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME\r
static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE;\r
private static final long serialVersionUID = 3655000897845508358L;\r
final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(),\r
static final String TRIANGULAR_TYPE_CBMI_LABEL = "Triangular";\r
static final String CONVEX_TYPE_CBMI_LABEL = "Convex";\r
static final String ROUNDED_TYPE_CBMI_LABEL = "Rounded";\r
- static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO\r
- static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO\r
+ static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO\r
+ static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO\r
static final String OPTIONS_HEADER = "Options";\r
static final String SEARCH_SUBHEADER = "Search:";\r
static final String DISPLAY_SUBHEADER = "Display:";\r
static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only";\r
- static final String SEARCH_REGEX_LABEL = "Search with Regular Expressions";\r
+ static final String SEARCH_REGEX_LABEL = "Search with Regular Expressions";\r
static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive";\r
static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result";\r
static final String COLOR_BY_TAXONOMIC_GROUP = "Colorize by Taxonomic Group";\r
static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms";\r
static final String LABEL_DIRECTION_LABEL = "Radial Labels";\r
static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types";\r
+ static final String SEARCH_WITH_REGEX_TIP = "To search using regular expressions (~Java/Perl syntax). For example, use \"^B.+\\d{2,}$\" to search for everything starting with a B and ending with at least two digits.";\r
static final String SCREEN_ANTIALIAS_LABEL = "Antialias";\r
static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch";\r
static final String BG_GRAD_LABEL = "Background Color Gradient";\r
JRadioButtonMenuItem _uniform_cladograms_rbmi;\r
JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;\r
JCheckBoxMenuItem _color_by_taxonomic_group_cbmi;\r
- JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me\r
+ JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me\r
JCheckBoxMenuItem _show_overview_cbmi;\r
JCheckBoxMenuItem _show_domain_labels;\r
JCheckBoxMenuItem _show_annotation_ref_source;\r
JMenuItem _cycle_node_shape_mi;\r
JMenuItem _cycle_node_fill_mi;\r
JMenuItem _choose_node_size_mi;\r
+ JMenuItem _cycle_data_return;\r
JCheckBoxMenuItem _show_confidence_stddev_cbmi;\r
JCheckBoxMenuItem _right_line_up_domains_cbmi;\r
JCheckBoxMenuItem _line_up_renderable_data_cbmi;\r
// Handy pointers to child components:\r
MainPanel _mainpanel;\r
Container _contentpane;\r
- final LinkedList<TextFrame> _textframes = new LinkedList<TextFrame>(); ;\r
+ final LinkedList<TextFrame> _textframes = new LinkedList<TextFrame>(); ;\r
Configuration _configuration;\r
Options _options;\r
private Phylogeny _species_tree;\r
MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );\r
}\r
else if ( o == _cycle_node_fill_mi ) {\r
- MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );\r
+ MainFrame.cycleNodeFill( getOptions() );\r
}\r
else if ( o == _cycle_node_shape_mi ) {\r
- MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );\r
+ MainFrame.cycleNodeShape( getOptions() );\r
+ }\r
+ else if ( o == _cycle_data_return ) {\r
+ MainFrame.cycleNodeDataReturn( getOptions(), getConfiguration() );\r
}\r
else if ( o == _screen_antialias_cbmi ) {\r
updateOptions( getOptions() );\r
getMainPanel().getControlPanel().search1();\r
}\r
else if ( o == _search_whole_words_only_cbmi ) {\r
+ if ( ( _search_with_regex_cbmi != null ) && _search_whole_words_only_cbmi.isSelected() ) {\r
+ _search_with_regex_cbmi.setSelected( false );\r
+ }\r
updateOptions( getOptions() );\r
getMainPanel().getControlPanel().search0();\r
getMainPanel().getControlPanel().search1();\r
getMainPanel().getControlPanel().search1();\r
}\r
else if ( o == _search_with_regex_cbmi ) {\r
+ if ( ( _search_whole_words_only_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) {\r
+ _search_whole_words_only_cbmi.setSelected( false );\r
+ }\r
+ if ( ( _search_case_senstive_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) {\r
+ _search_case_senstive_cbmi.setSelected( true );\r
+ }\r
updateOptions( getOptions() );\r
getMainPanel().getControlPanel().search0();\r
getMainPanel().getControlPanel().search1();\r
}\r
if ( ( nodes == null ) || nodes.isEmpty() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "Need to select external nodes, either via direct selection or via the \"Search\" function",\r
- "No external nodes selected to " + function.toLowerCase(),\r
- JOptionPane.ERROR_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "Need to select external nodes, either via direct selection or via the \"Search\" function",\r
+ "No external nodes selected to " + function.toLowerCase(),\r
+ JOptionPane.ERROR_MESSAGE );\r
return;\r
}\r
final int todo = nodes.size();\r
return;\r
}\r
final int result = JOptionPane.showConfirmDialog( null, function + " " + todo\r
- + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res\r
- + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION );\r
+ + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res\r
+ + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION );\r
if ( result == JOptionPane.OK_OPTION ) {\r
if ( !delete ) {\r
final List<PhylogenyNode> to_delete = new ArrayList<PhylogenyNode>();\r
* has been selected by the user by clicking the "Return ..."\r
* menu item. This method is expected to be called from Javascript or\r
* something like it.\r
- * \r
+ *\r
* @return current external node data as String\r
*/\r
public String getCurrentExternalNodesDataBuffer() {\r
+ gsdi.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDI successfully completed",\r
- JOptionPane.WARNING_MESSAGE );\r
+ "GSDI successfully completed",\r
+ JOptionPane.WARNING_MESSAGE );\r
}\r
else {\r
JOptionPane.showMessageDialog( this,\r
+ gsdi.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDI successfully completed",\r
- JOptionPane.INFORMATION_MESSAGE );\r
+ "GSDI successfully completed",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
}\r
}\r
\r
+ gsdir.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDIR successfully completed",\r
- JOptionPane.WARNING_MESSAGE );\r
+ "GSDIR successfully completed",\r
+ JOptionPane.WARNING_MESSAGE );\r
}\r
else {\r
JOptionPane.showMessageDialog( this,\r
+ gsdir.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDIR successfully completed",\r
- JOptionPane.INFORMATION_MESSAGE );\r
+ "GSDIR successfully completed",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
}\r
}\r
\r
if ( getCurrentTreePanel() != null ) {\r
if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",\r
- "Operation can not be exectuted on a sub-tree",\r
- JOptionPane.WARNING_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",\r
+ "Operation can not be exectuted on a sub-tree",\r
+ JOptionPane.WARNING_MESSAGE );\r
return true;\r
}\r
}\r
void updateOptions( final Options options ) {\r
options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );\r
options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )\r
- && _background_gradient_cbmi.isSelected() );\r
+ && _background_gradient_cbmi.isSelected() );\r
options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );\r
options.setShowAnnotationRefSource( ( _show_annotation_ref_source != null )\r
- && _show_annotation_ref_source.isSelected() );\r
+ && _show_annotation_ref_source.isSelected() );\r
options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )\r
- && _abbreviate_scientific_names.isSelected() );\r
+ && _abbreviate_scientific_names.isSelected() );\r
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )\r
- && _color_labels_same_as_parent_branch.isSelected() );\r
+ && _color_labels_same_as_parent_branch.isSelected() );\r
options.setShowDefaultNodeShapesInternal( ( _show_default_node_shapes_internal_cbmi != null )\r
- && _show_default_node_shapes_internal_cbmi.isSelected() );\r
+ && _show_default_node_shapes_internal_cbmi.isSelected() );\r
options.setShowDefaultNodeShapesExternal( ( _show_default_node_shapes_external_cbmi != null )\r
- && _show_default_node_shapes_external_cbmi.isSelected() );\r
+ && _show_default_node_shapes_external_cbmi.isSelected() );\r
options.setShowDefaultNodeShapesForMarkedNodes( ( _show_default_node_shapes_for_marked_cbmi != null )\r
- && _show_default_node_shapes_for_marked_cbmi.isSelected() );\r
+ && _show_default_node_shapes_for_marked_cbmi.isSelected() );\r
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {\r
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );\r
}\r
options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );\r
}\r
options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )\r
- && _search_case_senstive_cbmi.isSelected() );\r
+ && _search_case_senstive_cbmi.isSelected() );\r
if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {\r
options.setShowScale( _show_scale_cbmi.isSelected() );\r
}\r
}\r
options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );\r
options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )\r
- && _show_confidence_stddev_cbmi.isSelected() );\r
+ && _show_confidence_stddev_cbmi.isSelected() );\r
if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) {\r
options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() );\r
}\r
options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )\r
- && ( _print_using_actual_size_cbmi.isSelected() ) );\r
+ && ( _print_using_actual_size_cbmi.isSelected() ) );\r
options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )\r
- && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );\r
+ && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );\r
options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );\r
if ( ( _use_brackets_for_conf_in_nh_export_cbmi != null )\r
&& _use_brackets_for_conf_in_nh_export_cbmi.isSelected() ) {\r
options.setNhConversionSupportValueStyle( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE );\r
}\r
options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )\r
- && _print_black_and_white_cbmi.isSelected() );\r
+ && _print_black_and_white_cbmi.isSelected() );\r
options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )\r
- && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );\r
+ && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );\r
if ( ( _extract_taxonomy_pfam_strict_rbmi != null ) && _extract_taxonomy_pfam_strict_rbmi.isSelected() ) {\r
options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );\r
}\r
options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO );\r
}\r
options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null )\r
- && _replace_underscores_cbmi.isSelected() );\r
+ && _replace_underscores_cbmi.isSelected() );\r
options.setAllowErrorsInDistanceToParent( ( _allow_errors_in_distance_to_parent_cbmi != null )\r
- && _allow_errors_in_distance_to_parent_cbmi.isSelected() );\r
+ && _allow_errors_in_distance_to_parent_cbmi.isSelected() );\r
options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )\r
- && _search_whole_words_only_cbmi.isSelected() );\r
- options.setSearchWithRegex( ( _search_with_regex_cbmi != null )\r
- && _search_with_regex_cbmi.isSelected() );\r
- \r
+ && _search_whole_words_only_cbmi.isSelected() );\r
+ options.setSearchWithRegex( ( _search_with_regex_cbmi != null ) && _search_with_regex_cbmi.isSelected() );\r
options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )\r
- && _inverse_search_result_cbmi.isSelected() );\r
+ && _inverse_search_result_cbmi.isSelected() );\r
if ( _graphics_export_visible_only_cbmi != null ) {\r
options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );\r
if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {\r
title = "\"" + getMainPanel().getCurrentPhylogeny().getName() + "\" in " + title;\r
}\r
showTextFrame( _mainpanel.getCurrentPhylogeny().toNewHampshire( getOptions()\r
- .getNhConversionSupportValueStyle() ),\r
- title );\r
+ .getNhConversionSupportValueStyle() ),\r
+ title );\r
}\r
}\r
\r
}\r
if ( ( nodes == null ) || nodes.isEmpty() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "Need to select nodes, either via direct selection or via the \"Search\" function",\r
- "No nodes selected for annotation",\r
- JOptionPane.ERROR_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "Need to select nodes, either via direct selection or via the \"Search\" function",\r
+ "No nodes selected for annotation",\r
+ JOptionPane.ERROR_MESSAGE );\r
return;\r
}\r
final Phylogeny phy = getMainPanel().getCurrentPhylogeny();\r
my_panel,\r
"Enter the sequence annotation(s) for the "\r
+ nodes.size() + " selected nodes",\r
- JOptionPane.OK_CANCEL_OPTION );\r
+ JOptionPane.OK_CANCEL_OPTION );\r
if ( result == JOptionPane.OK_OPTION ) {\r
String ref = ref_field.getText();\r
String desc = desc_filed.getText();\r
for( final PhylogenyNode n : nodes ) {\r
ForesterUtil.ensurePresenceOfSequence( n );\r
final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation()\r
- : new Annotation( ref );\r
+ : new Annotation( ref );\r
if ( !ForesterUtil.isEmpty( desc ) ) {\r
ann.setDesc( desc );\r
}\r
.showInputDialog( this,\r
"Please enter the minimum for confidence values to be displayed.\n"\r
+ "[current value: " + getOptions().getMinConfidenceValue() + "]\n",\r
- "Minimal Confidence Value",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- getOptions().getMinConfidenceValue() );\r
+ "Minimal Confidence Value",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ getOptions().getMinConfidenceValue() );\r
if ( !ForesterUtil.isEmpty( s ) ) {\r
boolean success = true;\r
double m = 0.0;\r
"Please enter the default size for node shapes.\n"\r
+ "[current value: "\r
+ options.getDefaultNodeShapeSize() + "]\n",\r
- "Node Shape Size",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- options.getDefaultNodeShapeSize() );\r
+ "Node Shape Size",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ options.getDefaultNodeShapeSize() );\r
if ( !ForesterUtil.isEmpty( s ) ) {\r
boolean success = true;\r
double m = 0.0;\r
return label;\r
}\r
\r
- static void cycleNodeFill( final Options op, final TreePanel tree_panel ) {\r
+ static void cycleNodeFill( final Options op ) {\r
switch ( op.getDefaultNodeFill() ) {\r
case GRADIENT:\r
op.setDefaultNodeFill( NodeFill.SOLID );\r
}\r
}\r
\r
- static void cycleNodeShape( final Options op, final TreePanel tree_panel ) {\r
+ static void cycleNodeShape( final Options op ) {\r
switch ( op.getDefaultNodeShape() ) {\r
case CIRCLE:\r
op.setDefaultNodeShape( NodeShape.RECTANGLE );\r
}\r
}\r
\r
+ private static void cycleNodeDataReturn( final Options op, Configuration conf ) {\r
+ switch ( op.getExtDescNodeDataToReturn() ) {\r
+ case UNKNOWN:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_ALL );\r
+ break;\r
+ case DOMAINS_ALL:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN );\r
+ break;\r
+ case DOMAINS_COLLAPSED_PER_PROTEIN:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.SEQ_ANNOTATIONS );\r
+ break;\r
+ case SEQ_ANNOTATIONS:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.GO_TERM_IDS );\r
+ break;\r
+ case GO_TERM_IDS:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_MOL_SEQ_FASTA );\r
+ break;\r
+ case SEQUENCE_MOL_SEQ_FASTA:\r
+ if ( conf != null && conf.getExtDescNodeDataToReturn() != null\r
+ && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_ALL\r
+ && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN\r
+ && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQ_ANNOTATIONS\r
+ && conf.getExtDescNodeDataToReturn() != NodeDataField.GO_TERM_IDS\r
+ && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQUENCE_MOL_SEQ_FASTA\r
+ ) {\r
+ op.setExtDescNodeDataToReturn( conf.getExtDescNodeDataToReturn() );\r
+ }\r
+ else {\r
+ op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN );\r
+ }\r
+ break; \r
+ default:\r
+ op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN );\r
+ }\r
+ }\r
+\r
static void cycleOverview( final Options op, final TreePanel tree_panel ) {\r
switch ( op.getOvPlacement() ) {\r
case LOWER_LEFT:\r
}\r
}\r
\r
+ static void setCycleDataReturnMenuItem( final JMenuItem mi, final Options options ) {\r
+ if ( ( options != null ) && ( options.getExtDescNodeDataToReturn() != null ) ) {\r
+ mi.setText( "Cycle Node Return Data... (current: "\r
+ + options.getExtDescNodeDataToReturn().toString() + ")" );\r
+ }\r
+ else {\r
+ mi.setText( "Cycle Node Return Data..." );\r
+ }\r
+ }\r
+\r
static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final Options options ) {\r
if ( ( options != null ) && ( options.getOvPlacement() != null ) ) {\r
mi.setText( "Cycle Overview Placement... (current: " + options.getOvPlacement() + ")" );\r
static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {\r
if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {\r
mi.setText( "Select Color Scheme... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName()\r
- + ")" );\r
+ + ")" );\r
}\r
else {\r
mi.setText( "Select Color Scheme..." );\r