inprogress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainFrameApplication.java
index 95b23cb..b50cbf2 100644 (file)
@@ -22,7 +22,7 @@
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 //
 // Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.archaeopteryx;
 
@@ -302,7 +302,6 @@ public final class MainFrameApplication extends MainFrame {
         _save_filechooser.setCurrentDirectory( new File( "." ) );
         _save_filechooser.setMultiSelectionEnabled( false );
         _save_filechooser.setFileFilter( MainFrameApplication.xmlfilter );
-        _save_filechooser.addChoosableFileFilter( MainFrameApplication.nhxfilter );
         _save_filechooser.addChoosableFileFilter( MainFrameApplication.nhfilter );
         _save_filechooser.addChoosableFileFilter( MainFrameApplication.nexusfilter );
         _save_filechooser.addChoosableFileFilter( _save_filechooser.getAcceptAllFileFilter() );
@@ -963,7 +962,10 @@ public final class MainFrameApplication extends MainFrame {
         _options_jmenu
                 .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
         _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) );
-        _options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL ) );
+        _options_jmenu
+                .add( _show_default_node_shapes_internal_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_INT ) );
+        _options_jmenu
+                .add( _show_default_node_shapes_external_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_EXT ) );
         _options_jmenu
                 .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
         _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
@@ -1034,7 +1036,10 @@ public final class MainFrameApplication extends MainFrame {
         customizeJMenuItem( _print_size_mi );
         customizeJMenuItem( _choose_pdf_width_mi );
         customizeJMenuItem( _overview_placment_mi );
-        customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
+        customizeCheckBoxMenuItem( _show_default_node_shapes_external_cbmi, getOptions()
+                .isShowDefaultNodeShapesExternal() );
+        customizeCheckBoxMenuItem( _show_default_node_shapes_internal_cbmi, getOptions()
+                .isShowDefaultNodeShapesInternal() );
         customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
         customizeJMenuItem( _cycle_node_shape_mi );
         customizeJMenuItem( _cycle_node_fill_mi );
@@ -1130,17 +1135,17 @@ public final class MainFrameApplication extends MainFrame {
                 .setToolTipText( "To collapse branches with confidence values below a threshold into multifurcations (in the case of multiple confidences per branch: without at least one confidence value above a threshold)" );
         _tools_menu.addSeparator();
         _tools_menu
+                .add( _extract_tax_code_from_node_names_jmi = new JMenuItem( "Extract Taxonomic Data from Node Names" ) );
+        customizeJMenuItem( _extract_tax_code_from_node_names_jmi );
+        _extract_tax_code_from_node_names_jmi
+                .setToolTipText( "To extract SwissProt/Uniprot taxonomic codes (mnemonics) from nodes names in the form of 'xyz_CAEEL', Uniprot/NCBI identifiers form of 'xyz_6239', or scientific names form of 'xyz_Caenorhabditis_elegans'" );
+        _tools_menu
                 .add( _move_node_names_to_tax_sn_jmi = new JMenuItem( "Transfer Node Names to Taxonomic Scientific Names" ) );
         customizeJMenuItem( _move_node_names_to_tax_sn_jmi );
         _move_node_names_to_tax_sn_jmi.setToolTipText( "To interpret node names as taxonomic scientific names" );
         _tools_menu.add( _move_node_names_to_seq_names_jmi = new JMenuItem( "Transfer Node Names to Sequence Names" ) );
         customizeJMenuItem( _move_node_names_to_seq_names_jmi );
         _move_node_names_to_seq_names_jmi.setToolTipText( "To interpret node names as sequence (protein, gene) names" );
-        _tools_menu
-                .add( _extract_tax_code_from_node_names_jmi = new JMenuItem( "Extract Taxonomic Codes or Ids from Node Names" ) );
-        customizeJMenuItem( _extract_tax_code_from_node_names_jmi );
-        _extract_tax_code_from_node_names_jmi
-                .setToolTipText( "To extract taxonomic codes (mnemonics) from nodes names in the form of 'xyz_ECOLI', or Uniprot identifiers from nodes names in the form of 'xyz_1234567'" );
         _tools_menu.addSeparator();
         _tools_menu
                 .add( _obtain_detailed_taxonomic_information_jmi = new JMenuItem( OBTAIN_DETAILED_TAXONOMIC_INFORMATION ) );
@@ -1898,7 +1903,7 @@ public final class MainFrameApplication extends MainFrame {
                             if ( counter_failed < 15 ) {
                                 sb_failed.append( name + "\n" );
                             }
-                            else if (  counter_failed == 15 ) {
+                            else if ( counter_failed == 15 ) {
                                 sb_failed.append( "...\n" );
                             }
                             counter_failed++;
@@ -1907,22 +1912,27 @@ public final class MainFrameApplication extends MainFrame {
                 }
                 if ( counter > 0 ) {
                     String failed = "";
+                    String all = "all ";
                     if ( counter_failed > 0 ) {
-                        failed = "\nDid not extract taxonomic data for "  + counter_failed + " (named) external nodes:\n" + sb_failed;
-                        
+                        all = "";
+                        failed = "\nCould not extract taxonomic data for " + counter_failed
+                                + " named external nodes:\n" + sb_failed;
                     }
                     JOptionPane.showMessageDialog( this,
-                                                   "Successfully extracted taxonomic data from " + counter
-                                                           + " external nodes:\n" + sb.toString() + failed,
-                                                   "Taxonomic Data Extraction Successfully Completed",
-                                                   JOptionPane.INFORMATION_MESSAGE );
+                                                   "Extracted taxonomic data from " + all + counter
+                                                           + " named external nodes:\n" + sb.toString() + failed,
+                                                   "Taxonomic Data Extraction Completed",
+                                                   counter_failed > 0 ? JOptionPane.WARNING_MESSAGE
+                                                           : JOptionPane.INFORMATION_MESSAGE );
                 }
                 else {
                     JOptionPane
                             .showMessageDialog( this,
-                                                "Could not extract any taxonomic data, maybe node names are empty\nor not in the form \"XYZ_CAEEL\", \"XYZ_CAEEL/12-394\", or \"XYZ_1234567\"?",
+                                                "Could not extract any taxonomic data.\nMaybe node names are empty\n"
+                                                        + "or not in the forms \"XYZ_CAEEL\", \"XYZ_6239\", or \"XYZ_Caenorhabditis_elegans\"\n"
+                                                        + "or nodes already have taxonomic data?\n",
                                                 "No Taxonomic Data Extracted",
-                                                JOptionPane.WARNING_MESSAGE );
+                                                JOptionPane.ERROR_MESSAGE );
                 }
             }
         }
@@ -2469,18 +2479,6 @@ public final class MainFrameApplication extends MainFrame {
         return exception;
     }
 
-    private boolean writeAsNHX( final Phylogeny t, boolean exception, final File file ) {
-        try {
-            final PhylogenyWriter writer = new PhylogenyWriter();
-            writer.toNewHampshireX( t, file );
-        }
-        catch ( final Exception e ) {
-            exception = true;
-            exceptionOccuredDuringSaveAs( e );
-        }
-        return exception;
-    }
-
     private boolean writeAsPhyloXml( final Phylogeny t, boolean exception, final File file ) {
         try {
             final PhylogenyWriter writer = new PhylogenyWriter();
@@ -2555,9 +2553,6 @@ public final class MainFrameApplication extends MainFrame {
             if ( _save_filechooser.getFileFilter() == MainFrameApplication.nhfilter ) {
                 exception = writeAsNewHampshire( t, exception, file );
             }
-            else if ( _save_filechooser.getFileFilter() == MainFrameApplication.nhxfilter ) {
-                exception = writeAsNHX( t, exception, file );
-            }
             else if ( _save_filechooser.getFileFilter() == MainFrameApplication.xmlfilter ) {
                 exception = writeAsPhyloXml( t, exception, file );
             }
@@ -2571,9 +2566,6 @@ public final class MainFrameApplication extends MainFrame {
                         || file_name.endsWith( ".tree" ) ) {
                     exception = writeAsNewHampshire( t, exception, file );
                 }
-                else if ( file_name.endsWith( ".nhx" ) ) {
-                    exception = writeAsNHX( t, exception, file );
-                }
                 else if ( file_name.endsWith( ".nex" ) || file_name.endsWith( ".nexus" ) ) {
                     exception = writeAsNexus( t, exception, file );
                 }
@@ -2811,7 +2803,7 @@ class NHXFilter extends FileFilter {
 
     @Override
     public String getDescription() {
-        return "NHX files (*.nhx)";
+        return "NHX files (*.nhx) [deprecated]";
     }
 }