X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainFrame.java;h=505918e7e984a5cd15d14464cf26f48a17cc771c;hb=4d33637f6bc5a76ca65dea7e21c9e2f7267ab2a3;hp=8bbedf1e28edbeaae8c000de4aaab55eb242038f;hpb=6ebad4e2283f33540c6ed4a9b1c8efc839d62637;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index 8bbedf1..505918e 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -33,12 +33,10 @@ import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.NoSuchElementException; -import java.util.Set; import javax.swing.Box; import javax.swing.JApplet; @@ -67,6 +65,7 @@ import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE; import org.forester.phylogeny.data.Annotation; +import org.forester.phylogeny.data.NodeDataField; import org.forester.phylogeny.data.NodeVisualData.NodeFill; import org.forester.phylogeny.data.NodeVisualData.NodeShape; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; @@ -79,7 +78,7 @@ import org.forester.util.ForesterUtil; public abstract class MainFrame extends JFrame implements ActionListener { static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]"; - static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME + static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE; private static final long serialVersionUID = 3655000897845508358L; final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(), @@ -92,26 +91,28 @@ public abstract class MainFrame extends JFrame implements ActionListener { static final String TRIANGULAR_TYPE_CBMI_LABEL = "Triangular"; static final String CONVEX_TYPE_CBMI_LABEL = "Convex"; static final String ROUNDED_TYPE_CBMI_LABEL = "Rounded"; - static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO - static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO + static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO + static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO static final String OPTIONS_HEADER = "Options"; static final String SEARCH_SUBHEADER = "Search:"; static final String DISPLAY_SUBHEADER = "Display:"; static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only"; + static final String SEARCH_REGEX_LABEL = "Search with Regular Expressions"; static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive"; static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result"; - static final String DISPLAY_BRANCH_LENGTH_VALUES_LABEL = "Branch Length Values"; static final String COLOR_BY_TAXONOMIC_GROUP = "Colorize by Taxonomic Group"; static final String DISPLAY_SCALE_LABEL = "Scale"; static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms"; static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms"; static final String LABEL_DIRECTION_LABEL = "Radial Labels"; static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types"; + 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."; static final String SCREEN_ANTIALIAS_LABEL = "Antialias"; static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch"; static final String BG_GRAD_LABEL = "Background Color Gradient"; - static final String DISPLAY_NODE_BOXES_LABEL_EXT = "External Node Shapes"; - static final String DISPLAY_NODE_BOXES_LABEL_INT = "Internal Node Shapes"; + static final String DISPLAY_NODE_BOXES_LABEL_EXT = "Shapes for External Nodes"; + static final String DISPLAY_NODE_BOXES_LABEL_INT = "Shapes for Internal Nodes"; + static final String DISPLAY_NODE_BOXES_LABEL_MARKED = "Shapes for Nodes with Visual Data"; static final String SHOW_OVERVIEW_LABEL = "Overview"; static final String FONT_SIZE_MENU_LABEL = "Font Size"; static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms"; @@ -127,6 +128,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { static final String USE_BRACKETS_FOR_CONF_IN_NH_LABEL = "Use Brackets for Confidence Values"; static final String USE_INTERNAL_NAMES_FOR_CONF_IN_NH_LABEL = "Use Internal Node Names for Confidence Values"; static final String SHOW_BASIC_TREE_INFORMATION_LABEL = "Basic Tree Information"; + static final String RIGHT_LINE_UP_DOMAINS = "Right-align Domain Architectures"; + static final String LINE_UP_RENDERABLE_DATA = "Line Up Diagrams (such as Domain Architectures)"; JMenuBar _jmenubar; JMenu _file_jmenu; JMenu _tools_menu; @@ -155,7 +158,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _confcolor_item; JMenuItem _color_rank_jmi; JMenuItem _collapse_species_specific_subtrees; - JMenuItem _collapse_below_threshold; //TODO implememt me JMenuItem _obtain_detailed_taxonomic_information_jmi; JMenuItem _obtain_detailed_taxonomic_information_deleting_jmi; JMenuItem _obtain_seq_information_jmi; @@ -165,8 +167,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _annotate_item; JMenuItem _remove_branch_color_item; JMenuItem _remove_visual_styles_item; - JMenuItem _deleted_selected_nodes_item; - JMenuItem _deleted_not_selected_nodes_item; + JMenuItem _delete_selected_nodes_item; + JMenuItem _delete_not_selected_nodes_item; // font size menu: JMenuItem _super_tiny_fonts_item; JMenuItem _tiny_fonts_item; @@ -184,9 +186,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { JRadioButtonMenuItem _non_lined_up_cladograms_rbmi; JRadioButtonMenuItem _uniform_cladograms_rbmi; JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi; - JCheckBoxMenuItem _show_branch_length_values_cbmi; JCheckBoxMenuItem _color_by_taxonomic_group_cbmi; - JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me + JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me JCheckBoxMenuItem _show_overview_cbmi; JCheckBoxMenuItem _show_domain_labels; JCheckBoxMenuItem _show_annotation_ref_source; @@ -196,10 +197,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _choose_minimal_confidence_mi; JCheckBoxMenuItem _show_default_node_shapes_internal_cbmi; JCheckBoxMenuItem _show_default_node_shapes_external_cbmi; + JCheckBoxMenuItem _show_default_node_shapes_for_marked_cbmi; JMenuItem _cycle_node_shape_mi; JMenuItem _cycle_node_fill_mi; JMenuItem _choose_node_size_mi; + JMenuItem _cycle_data_return; JCheckBoxMenuItem _show_confidence_stddev_cbmi; + JCheckBoxMenuItem _right_line_up_domains_cbmi; + JCheckBoxMenuItem _line_up_renderable_data_cbmi; // _ print JCheckBoxMenuItem _graphics_export_visible_only_cbmi; JCheckBoxMenuItem _antialias_print_cbmi; @@ -222,6 +227,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { JCheckBoxMenuItem _search_case_senstive_cbmi; JCheckBoxMenuItem _search_whole_words_only_cbmi; JCheckBoxMenuItem _inverse_search_result_cbmi; + JCheckBoxMenuItem _search_with_regex_cbmi; // type menu: JMenu _type_menu; JCheckBoxMenuItem _rectangular_type_cbmi; @@ -249,7 +255,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { // Handy pointers to child components: MainPanel _mainpanel; Container _contentpane; - final LinkedList _textframes = new LinkedList(); ; + final LinkedList _textframes = new LinkedList(); ; Configuration _configuration; Options _options; private Phylogeny _species_tree; @@ -325,13 +331,13 @@ public abstract class MainFrame extends JFrame implements ActionListener { } midpointRoot(); } - else if ( o == _deleted_selected_nodes_item ) { + else if ( o == _delete_selected_nodes_item ) { if ( isSubtreeDisplayed() ) { return; } deleteSelectedNodes( true ); } - else if ( o == _deleted_not_selected_nodes_item ) { + else if ( o == _delete_not_selected_nodes_item ) { if ( isSubtreeDisplayed() ) { return; } @@ -344,7 +350,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { switchColors(); } else if ( o == _display_basic_information_item ) { - displayBasicInformation( getCurrentTreePanel().getTreeFile() ); + if ( getCurrentTreePanel() != null ) { + displayBasicInformation( getCurrentTreePanel().getTreeFile() ); + } } else if ( o == _view_as_NH_item ) { viewAsNH(); @@ -398,10 +406,13 @@ public abstract class MainFrame extends JFrame implements ActionListener { MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() ); } else if ( o == _cycle_node_fill_mi ) { - MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() ); + MainFrame.cycleNodeFill( getOptions() ); } else if ( o == _cycle_node_shape_mi ) { - MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() ); + MainFrame.cycleNodeShape( getOptions() ); + } + else if ( o == _cycle_data_return ) { + MainFrame.cycleNodeDataReturn( getOptions(), getConfiguration() ); } else if ( o == _screen_antialias_cbmi ) { updateOptions( getOptions() ); @@ -428,6 +439,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { else if ( o == _show_default_node_shapes_external_cbmi ) { updateOptions( getOptions() ); } + else if ( o == _show_default_node_shapes_for_marked_cbmi ) { + updateOptions( getOptions() ); + } else if ( o == _non_lined_up_cladograms_rbmi ) { updateOptions( getOptions() ); showWhole(); @@ -446,6 +460,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { getMainPanel().getControlPanel().search1(); } else if ( o == _search_whole_words_only_cbmi ) { + if ( ( _search_with_regex_cbmi != null ) && _search_whole_words_only_cbmi.isSelected() ) { + _search_with_regex_cbmi.setSelected( false ); + } updateOptions( getOptions() ); getMainPanel().getControlPanel().search0(); getMainPanel().getControlPanel().search1(); @@ -455,10 +472,18 @@ public abstract class MainFrame extends JFrame implements ActionListener { getMainPanel().getControlPanel().search0(); getMainPanel().getControlPanel().search1(); } - else if ( o == _show_scale_cbmi ) { + else if ( o == _search_with_regex_cbmi ) { + if ( ( _search_whole_words_only_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) { + _search_whole_words_only_cbmi.setSelected( false ); + } + if ( ( _search_case_senstive_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) { + _search_case_senstive_cbmi.setSelected( true ); + } updateOptions( getOptions() ); + getMainPanel().getControlPanel().search0(); + getMainPanel().getControlPanel().search1(); } - else if ( o == _show_branch_length_values_cbmi ) { + else if ( o == _show_scale_cbmi ) { updateOptions( getOptions() ); } else if ( o == _color_by_taxonomic_group_cbmi ) { @@ -488,6 +513,18 @@ public abstract class MainFrame extends JFrame implements ActionListener { getCurrentTreePanel().updateOvSizes(); } } + else if ( o == _line_up_renderable_data_cbmi ) { + if ( !_line_up_renderable_data_cbmi.isSelected() ) { + _right_line_up_domains_cbmi.setSelected( false ); + } + updateOptions( getOptions() ); + } + else if ( o == _right_line_up_domains_cbmi ) { + if ( _right_line_up_domains_cbmi.isSelected() ) { + _line_up_renderable_data_cbmi.setSelected( true ); + } + updateOptions( getOptions() ); + } else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi ) || ( o == _convex_type_cbmi ) || ( o == _euro_type_cbmi ) || ( o == _rounded_type_cbmi ) || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) { @@ -497,7 +534,12 @@ public abstract class MainFrame extends JFrame implements ActionListener { about(); } else if ( o == _help_item ) { - help(); + try { + AptxUtil.openWebsite( Constants.APTX_DOC_SITE, is_applet, applet ); + } + catch ( final IOException e1 ) { + ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() ); + } } else if ( o == _website_item ) { try { @@ -543,14 +585,19 @@ public abstract class MainFrame extends JFrame implements ActionListener { _contentpane.repaint(); } - private void deleteSelectedNodes( boolean delete ) { + private void deleteSelectedNodes( final boolean delete ) { final Phylogeny phy = getMainPanel().getCurrentPhylogeny(); - if ( phy == null || phy.getNumberOfExternalNodes() < 2 ) { + if ( ( phy == null ) || ( phy.getNumberOfExternalNodes() < 2 ) ) { return; } - List nodes = null; + final List nodes = new ArrayList(); if ( ( getCurrentTreePanel().getFoundNodes0() != null ) || ( getCurrentTreePanel().getFoundNodes1() != null ) ) { - nodes = getCurrentTreePanel().getFoundNodesAsListOfPhylogenyNodes(); + final List all_selected_nodes = getCurrentTreePanel().getFoundNodesAsListOfPhylogenyNodes(); + for( final PhylogenyNode n : all_selected_nodes ) { + if ( n.isExternal() ) { + nodes.add( n ); + } + } } String function = "Retain"; if ( delete ) { @@ -558,10 +605,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, - "Need to select external nodes, either via direct selection or via the \"Search\" function", - "No external nodes selected to " + function.toLowerCase(), - JOptionPane.ERROR_MESSAGE ); + .showMessageDialog( this, + "Need to select external nodes, either via direct selection or via the \"Search\" function", + "No external nodes selected to " + function.toLowerCase(), + JOptionPane.ERROR_MESSAGE ); return; } final int todo = nodes.size(); @@ -570,7 +617,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { if ( delete ) { res = ext - todo; } - if ( res < 1 ) { JOptionPane.showMessageDialog( this, "Cannot delete all nodes", @@ -578,9 +624,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { JOptionPane.ERROR_MESSAGE ); return; } - final int result = JOptionPane.showConfirmDialog( null, "OK to " + function.toLowerCase() + " " + todo - + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res - + " nodes", function + " external nodes", JOptionPane.OK_CANCEL_OPTION ); + final int result = JOptionPane.showConfirmDialog( null, function + " " + todo + + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res + + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION ); if ( result == JOptionPane.OK_OPTION ) { if ( !delete ) { final List to_delete = new ArrayList(); @@ -634,7 +680,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { * has been selected by the user by clicking the "Return ..." * menu item. This method is expected to be called from Javascript or * something like it. - * + * * @return current external node data as String */ public String getCurrentExternalNodesDataBuffer() { @@ -719,9 +765,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { void buildHelpMenu() { _help_jmenu = createMenu( "Help", getConfiguration() ); - _help_jmenu.add( _help_item = new JMenuItem( "Help" ) ); + _help_jmenu.add( _help_item = new JMenuItem( "Documentation" ) ); + _help_jmenu.addSeparator(); _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) ); - _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); + _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); //TODO need to add this... _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) ); _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) ); _help_jmenu.addSeparator(); @@ -948,8 +995,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdi.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDI successfully completed", - JOptionPane.WARNING_MESSAGE ); + "GSDI successfully completed", + JOptionPane.WARNING_MESSAGE ); } else { JOptionPane.showMessageDialog( this, @@ -961,8 +1008,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdi.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDI successfully completed", - JOptionPane.INFORMATION_MESSAGE ); + "GSDI successfully completed", + JOptionPane.INFORMATION_MESSAGE ); } } @@ -1021,8 +1068,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdir.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDIR successfully completed", - JOptionPane.WARNING_MESSAGE ); + "GSDIR successfully completed", + JOptionPane.WARNING_MESSAGE ); } else { JOptionPane.showMessageDialog( this, @@ -1032,8 +1079,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdir.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDIR successfully completed", - JOptionPane.INFORMATION_MESSAGE ); + "GSDIR successfully completed", + JOptionPane.INFORMATION_MESSAGE ); } } @@ -1077,96 +1124,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { return _species_tree; } - void help() { - final StringBuilder sb = new StringBuilder(); - sb.append( "Display options\n" ); - sb.append( "-------------------\n" ); - sb.append( "Use the checkboxes to select types of information to display on the tree.\n\n" ); - sb.append( "Clickable tree nodes\n" ); - sb.append( "--------------------\n" ); - sb.append( "Tree nodes can be clicked, the action is determined by the 'click on node to' menu\n" ); - sb.append( "or by right clicking:\n" ); - sb.append( "o Display Node Data -- display information for a node\n" ); - sb.append( "o Collapse/Uncollapse -- collapse and uncollapse subtree from clicked node\n" ); - sb.append( "o Root/Reroot -- change tree root to clicked node\n" ); - sb.append( "o Sub/Super Tree -- toggle between subtree from clicked node and whole tree\n" ); - sb.append( "o Swap Descendants -- switch descendant on either side of clicked node\n" ); - sb.append( "o Colorize Subtree -- color a subtree\n" ); - sb.append( "o Open Sequence Web -- launch a web browser to display sequence information\n" ); - sb.append( "o Open Taxonomy Web -- launch a web browser to display taxonomy information\n" ); - sb.append( "- there may be additional choices depending on this particular setup\n\n" ); - sb.append( "Right clicking on a node always displays the information of a node.\n\n" ); - sb.append( "Zooming\n" ); - sb.append( "---------\n" ); - sb.append( "The mouse wheel and the plus and minus keys control zooming.\n" ); - sb.append( "Mouse wheel+Ctrl changes the text size.\n" ); - sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" ); - sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" ); - sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" ); - sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" ); - sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" ); - sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" ); - sb.append( "Quick tree manipulation:\n" ); - sb.append( "------------------------\n" ); - sb.append( "Order Subtrees -- order the tree by branch length\n" ); - sb.append( "Uncollapse All -- uncollapse any and all collapsed branches\n\n" ); - sb.append( "Memory problems (Java heap space error)\n" ); - sb.append( "---------------------------------------\n" ); - sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" ); - sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" ); - sb.append( "the '-Xmx' Java command line option. For example:\n" ); - sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" ); - // + "General remarks\n" - // + "---------------\n" - // + - // "o The application version permits copying to the clipboard \n" - // + - // " in the \"View\"|\"View as ...\" frame (either by control-c or button press).\n" - // + - // "o Changes made to a subtree affect this subtree and its subtrees,\n" - // + " but not any of its parent tree(s).\n" - // + - // "o Archaeopteryx tries to detect whether the numerical values in a NH tree\n" - // + - // " are likely to be bootstrap values instead of branch length values.\n\n" - // + - // " Remarks regarding SDI (Speciation Duplication Inference):\n" - // + - // "o Each external node of the gene tree (in display) needs to be associated with\n" - // + - // " a species: either directly through the \"Species\" field, or the species\n" - // + - // " is part of the sequence name in the form \"XXXX_SPECIES\"\n" - // + - // " (e.g. \"ACON_DROME\" or \"ACON_DROME/123-4489\" which is also acceptable).\n" - // + - // "o A species tree for each species of the gene tree needs to be loaded with\n" - // + - // " \"SDI\"|\"Load species tree\" prior the SDI execution.\n" - // + - // "o !External nodes of the gene tree associated with species not present in\n" - // + - // " the species tree are REMOVED prior to SDI execution!\n" - // + - // "o Both the gene tree and the species tree must be completely binary.\n" - // + - // "o Duplications and speciations are a function of the position of the root.\n" - // + - // " Hence, after each manual \"Root/Reroot\"ing some duplications will be\n" - // + " incorrect and need to be inferred again\n" - // + - // " with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n" - sb.append( "phyloXML\n" ); - sb.append( "-------------------\n" ); - sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" ); - sb.append( "Website: " + Constants.PHYLOXML_WEB_SITE + "\n" ); - sb.append( "Version: " + ForesterConstants.PHYLO_XML_VERSION + "\n" ); - sb.append( "\n" ); - sb.append( "For more information: https://sites.google.com/site/cmzmasek/home/software/archaeopteryx\n" ); - sb.append( "Email: " + Constants.AUTHOR_EMAIL + "\n\n" ); - TextFrame.instantiate( sb.toString(), "Help", _textframes ); - } - void initializeTypeMenu( final Options options ) { setTypeMenuToAllUnselected(); switch ( options.getPhylogenyGraphicsType() ) { @@ -1231,10 +1188,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { if ( getCurrentTreePanel() != null ) { if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) { JOptionPane - .showMessageDialog( this, - "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.", - "Operation can not be exectuted on a sub-tree", - JOptionPane.WARNING_MESSAGE ); + .showMessageDialog( this, + "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.", + "Operation can not be exectuted on a sub-tree", + JOptionPane.WARNING_MESSAGE ); return true; } } @@ -1366,18 +1323,20 @@ public abstract class MainFrame extends JFrame implements ActionListener { void updateOptions( final Options options ) { options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() ); options.setBackgroundColorGradient( ( _background_gradient_cbmi != null ) - && _background_gradient_cbmi.isSelected() ); + && _background_gradient_cbmi.isSelected() ); options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() ); options.setShowAnnotationRefSource( ( _show_annotation_ref_source != null ) - && _show_annotation_ref_source.isSelected() ); + && _show_annotation_ref_source.isSelected() ); options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null ) - && _abbreviate_scientific_names.isSelected() ); + && _abbreviate_scientific_names.isSelected() ); options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null ) - && _color_labels_same_as_parent_branch.isSelected() ); + && _color_labels_same_as_parent_branch.isSelected() ); options.setShowDefaultNodeShapesInternal( ( _show_default_node_shapes_internal_cbmi != null ) - && _show_default_node_shapes_internal_cbmi.isSelected() ); + && _show_default_node_shapes_internal_cbmi.isSelected() ); options.setShowDefaultNodeShapesExternal( ( _show_default_node_shapes_external_cbmi != null ) - && _show_default_node_shapes_external_cbmi.isSelected() ); + && _show_default_node_shapes_external_cbmi.isSelected() ); + options.setShowDefaultNodeShapesForMarkedNodes( ( _show_default_node_shapes_for_marked_cbmi != null ) + && _show_default_node_shapes_for_marked_cbmi.isSelected() ); if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) { options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP ); } @@ -1388,7 +1347,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP ); } options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null ) - && _search_case_senstive_cbmi.isSelected() ); + && _search_case_senstive_cbmi.isSelected() ); if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) { options.setShowScale( _show_scale_cbmi.isSelected() ); } @@ -1402,17 +1361,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { } options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() ); options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null ) - && _show_confidence_stddev_cbmi.isSelected() ); - if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) { - options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() ); - } + && _show_confidence_stddev_cbmi.isSelected() ); if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) { options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() ); } options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null ) - && ( _print_using_actual_size_cbmi.isSelected() ) ); + && ( _print_using_actual_size_cbmi.isSelected() ) ); options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null ) - && ( _graphics_export_using_actual_size_cbmi.isSelected() ) ); + && ( _graphics_export_using_actual_size_cbmi.isSelected() ) ); options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() ); if ( ( _use_brackets_for_conf_in_nh_export_cbmi != null ) && _use_brackets_for_conf_in_nh_export_cbmi.isSelected() ) { @@ -1426,9 +1382,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setNhConversionSupportValueStyle( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ); } options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null ) - && _print_black_and_white_cbmi.isSelected() ); + && _print_black_and_white_cbmi.isSelected() ); options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null ) - && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() ); + && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() ); if ( ( _extract_taxonomy_pfam_strict_rbmi != null ) && _extract_taxonomy_pfam_strict_rbmi.isSelected() ) { options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT ); } @@ -1442,13 +1398,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO ); } options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null ) - && _replace_underscores_cbmi.isSelected() ); + && _replace_underscores_cbmi.isSelected() ); options.setAllowErrorsInDistanceToParent( ( _allow_errors_in_distance_to_parent_cbmi != null ) - && _allow_errors_in_distance_to_parent_cbmi.isSelected() ); + && _allow_errors_in_distance_to_parent_cbmi.isSelected() ); options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null ) - && _search_whole_words_only_cbmi.isSelected() ); + && _search_whole_words_only_cbmi.isSelected() ); + options.setSearchWithRegex( ( _search_with_regex_cbmi != null ) && _search_with_regex_cbmi.isSelected() ); options.setInverseSearchResult( ( _inverse_search_result_cbmi != null ) - && _inverse_search_result_cbmi.isSelected() ); + && _inverse_search_result_cbmi.isSelected() ); if ( _graphics_export_visible_only_cbmi != null ) { options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() ); if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) { @@ -1483,6 +1440,12 @@ public abstract class MainFrame extends JFrame implements ActionListener { else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) { options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ); } + if ( ( _right_line_up_domains_cbmi != null ) && _right_line_up_domains_cbmi.isEnabled() ) { + options.setRightLineUpDomains( _right_line_up_domains_cbmi.isSelected() ); + } + if ( ( _line_up_renderable_data_cbmi != null ) && _line_up_renderable_data_cbmi.isEnabled() ) { + options.setLineUpRendarableNodeData( _line_up_renderable_data_cbmi.isSelected() ); + } } void updateTypeCheckboxes( final Options options, final Object o ) { @@ -1508,8 +1471,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { title = "\"" + getMainPanel().getCurrentPhylogeny().getName() + "\" in " + title; } showTextFrame( _mainpanel.getCurrentPhylogeny().toNewHampshire( getOptions() - .getNhConversionSupportValueStyle() ), - title ); + .getNhConversionSupportValueStyle() ), + title ); } } @@ -1532,10 +1495,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, - "Need to select nodes, either via direct selection or via the \"Search\" function", - "No nodes selected for annotation", - JOptionPane.ERROR_MESSAGE ); + .showMessageDialog( this, + "Need to select nodes, either via direct selection or via the \"Search\" function", + "No nodes selected for annotation", + JOptionPane.ERROR_MESSAGE ); return; } final Phylogeny phy = getMainPanel().getCurrentPhylogeny(); @@ -1554,7 +1517,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { my_panel, "Enter the sequence annotation(s) for the " + nodes.size() + " selected nodes", - JOptionPane.OK_CANCEL_OPTION ); + JOptionPane.OK_CANCEL_OPTION ); if ( result == JOptionPane.OK_OPTION ) { String ref = ref_field.getText(); String desc = desc_filed.getText(); @@ -1581,7 +1544,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { for( final PhylogenyNode n : nodes ) { ForesterUtil.ensurePresenceOfSequence( n ); final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation() - : new Annotation( ref ); + : new Annotation( ref ); if ( !ForesterUtil.isEmpty( desc ) ) { ann.setDesc( desc ); } @@ -1606,11 +1569,11 @@ public abstract class MainFrame extends JFrame implements ActionListener { .showInputDialog( this, "Please enter the minimum for confidence values to be displayed.\n" + "[current value: " + getOptions().getMinConfidenceValue() + "]\n", - "Minimal Confidence Value", - JOptionPane.QUESTION_MESSAGE, - null, - null, - getOptions().getMinConfidenceValue() ); + "Minimal Confidence Value", + JOptionPane.QUESTION_MESSAGE, + null, + null, + getOptions().getMinConfidenceValue() ); if ( !ForesterUtil.isEmpty( s ) ) { boolean success = true; double m = 0.0; @@ -1683,7 +1646,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { */ static void about() { final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" ); - about.append( "Copyright (C) 2013 Christian M. Zmasek\n" ); + about.append( "Copyright (C) 2014 Christian M Zmasek\n" ); about.append( "All Rights Reserved\n" ); about.append( "License: GNU Lesser General Public License (LGPL)\n" ); about.append( "Last modified: " + Constants.PRG_DATE + "\n" ); @@ -1707,6 +1670,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" ); about.append( "For more information & download:\n" ); about.append( Constants.APTX_WEB_SITE + "\n" ); + about.append( "Documentation:\n" ); + about.append( Constants.APTX_DOC_SITE + "\n" ); about.append( "Comments: " + Constants.AUTHOR_EMAIL ); JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE ); } @@ -1716,11 +1681,11 @@ public abstract class MainFrame extends JFrame implements ActionListener { "Please enter the default size for node shapes.\n" + "[current value: " + options.getDefaultNodeShapeSize() + "]\n", - "Node Shape Size", - JOptionPane.QUESTION_MESSAGE, - null, - null, - options.getDefaultNodeShapeSize() ); + "Node Shape Size", + JOptionPane.QUESTION_MESSAGE, + null, + null, + options.getDefaultNodeShapeSize() ); if ( !ForesterUtil.isEmpty( s ) ) { boolean success = true; double m = 0.0; @@ -1771,7 +1736,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { return label; } - static void cycleNodeFill( final Options op, final TreePanel tree_panel ) { + static void cycleNodeFill( final Options op ) { switch ( op.getDefaultNodeFill() ) { case GRADIENT: op.setDefaultNodeFill( NodeFill.SOLID ); @@ -1787,7 +1752,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } - static void cycleNodeShape( final Options op, final TreePanel tree_panel ) { + static void cycleNodeShape( final Options op ) { switch ( op.getDefaultNodeShape() ) { case CIRCLE: op.setDefaultNodeShape( NodeShape.RECTANGLE ); @@ -1800,6 +1765,42 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } + private static void cycleNodeDataReturn( final Options op, Configuration conf ) { + switch ( op.getExtDescNodeDataToReturn() ) { + case UNKNOWN: + op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_ALL ); + break; + case DOMAINS_ALL: + op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN ); + break; + case DOMAINS_COLLAPSED_PER_PROTEIN: + op.setExtDescNodeDataToReturn( NodeDataField.SEQ_ANNOTATIONS ); + break; + case SEQ_ANNOTATIONS: + op.setExtDescNodeDataToReturn( NodeDataField.GO_TERM_IDS ); + break; + case GO_TERM_IDS: + op.setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_MOL_SEQ_FASTA ); + break; + case SEQUENCE_MOL_SEQ_FASTA: + if ( conf != null && conf.getExtDescNodeDataToReturn() != null + && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_ALL + && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN + && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQ_ANNOTATIONS + && conf.getExtDescNodeDataToReturn() != NodeDataField.GO_TERM_IDS + && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQUENCE_MOL_SEQ_FASTA + ) { + op.setExtDescNodeDataToReturn( conf.getExtDescNodeDataToReturn() ); + } + else { + op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN ); + } + break; + default: + op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN ); + } + } + static void cycleOverview( final Options op, final TreePanel tree_panel ) { switch ( op.getOvPlacement() ) { case LOWER_LEFT: @@ -1842,6 +1843,16 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } + static void setCycleDataReturnMenuItem( final JMenuItem mi, final Options options ) { + if ( ( options != null ) && ( options.getExtDescNodeDataToReturn() != null ) ) { + mi.setText( "Cycle Node Return Data... (current: " + + options.getExtDescNodeDataToReturn().toString() + ")" ); + } + else { + mi.setText( "Cycle Node Return Data..." ); + } + } + static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final Options options ) { if ( ( options != null ) && ( options.getOvPlacement() != null ) ) { mi.setText( "Cycle Overview Placement... (current: " + options.getOvPlacement() + ")" ); @@ -1854,7 +1865,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) { if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) { mi.setText( "Select Color Scheme... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName() - + ")" ); + + ")" ); } else { mi.setText( "Select Color Scheme..." ); @@ -1882,84 +1893,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { mi.setText( "Enter Default Node Shape Size... (current: " + options.getDefaultNodeShapeSize() + ")" ); } - static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel, - final JCheckBoxMenuItem scale, - final JCheckBoxMenuItem branch_lengths, - final JRadioButtonMenuItem non_lined_up, - final JRadioButtonMenuItem uniform_clado, - final JRadioButtonMenuItem nonuniform_clado, - final JCheckBoxMenuItem label_direction_cbmi ) { - final TreePanel tree_panel = main_panel.getCurrentTreePanel(); - final ControlPanel control = main_panel.getControlPanel(); - final Options options = main_panel.getOptions(); - scale.setSelected( options.isShowScale() ); - branch_lengths.setSelected( options.isShowBranchLengthValues() ); - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - if ( ( tree_panel != null ) && ( !tree_panel.isPhyHasBranchLengths() ) ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - else if ( ( tree_panel != null ) && !control.isDrawPhylogram() ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setEnabled( true ); - } - else { - scale.setEnabled( true ); - branch_lengths.setEnabled( true ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.ROUNDED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) - || ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) { - non_lined_up.setEnabled( false ); - uniform_clado.setEnabled( false ); - nonuniform_clado.setEnabled( false ); - } - else { - non_lined_up.setEnabled( true ); - uniform_clado.setEnabled( true ); - nonuniform_clado.setEnabled( true ); - } - } - else { - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( tree_panel - .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) { - non_lined_up.setEnabled( false ); - } - else { - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - non_lined_up.setEnabled( true ); - } - } - label_direction_cbmi.setEnabled( true ); - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { - label_direction_cbmi.setEnabled( false ); - } - if ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) { - scale.setSelected( false ); - scale.setEnabled( false ); - } - } - } - static void updateScreenTextAntialias( final List treepanels ) { for( final TreePanel tree_panel : treepanels ) { tree_panel.setTextAntialias();