cleanup
[jalview.git] / forester / java / src / org / forester / archaeopteryx / ArchaeopteryxE.java
index c33a34a..286bf47 100644 (file)
@@ -36,6 +36,7 @@ import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
 import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
 import org.forester.phylogeny.data.SequenceRelation;
 import org.forester.sdi.GSDI;
 import org.forester.sdi.GSDIR;
@@ -96,6 +97,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
     private JMenuItem                   _aptx_ref_item;
     private JMenuItem                   _remove_branch_color_item;
     private JCheckBoxMenuItem           _show_domain_labels;
+    private JCheckBoxMenuItem           _show_annotation_ref_source;
     private JCheckBoxMenuItem           _color_labels_same_as_parent_branch;
     private JCheckBoxMenuItem           _abbreviate_scientific_names;
     private JCheckBoxMenuItem           _screen_antialias_cbmi;
@@ -261,6 +263,9 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         else if ( o == _label_direction_cbmi ) {
             updateOptions( getOptions() );
         }
+        else if ( o == _abbreviate_scientific_names ) {
+            updateOptions( getOptions() );
+        }
         else if ( o == _show_overview_cbmi ) {
             updateOptions( getOptions() );
             if ( getCurrentTreePanel() != null ) {
@@ -461,7 +466,8 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
                                                         getConfiguration().isValidatePhyloXmlAgainstSchema(),
                                                         getConfiguration().isReplaceUnderscoresInNhParsing(),
                                                         getConfiguration().isInternalNumberAreConfidenceForNhParsing(),
-                                                        getConfiguration().getTaxonomyExtraction() );
+                                                        getConfiguration().getTaxonomyExtraction(),
+                                                        getConfiguration().isMidpointReroot() );
             }
             catch ( final Exception e ) {
                 ForesterUtil.printErrorMessage( NAME, e.toString() );
@@ -494,7 +500,8 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
                                                                  configuration.isValidatePhyloXmlAgainstSchema(),
                                                                  configuration.isReplaceUnderscoresInNhParsing(),
                                                                  false,
-                                                                 TAXONOMY_EXTRACTION.NO );
+                                                                 TAXONOMY_EXTRACTION.NO,
+                                                                 false );
             }
             catch ( final IOException e ) {
                 ForesterUtil.printErrorMessage( NAME, "could not read species tree from  [" + species_tree_url_str
@@ -512,6 +519,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
                 }
                 else {
                     setSpeciesTree( species_trees[ 0 ] );
+                    AptxUtil.printAppletMessage( NAME, "species tree OK" );
                 }
             }
         }
@@ -563,6 +571,10 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else {
             AptxUtil.printAppletMessage( NAME, "not using tabbed display" );
+            if ( getSpeciesTree() != null ) {
+                AptxUtil.printAppletMessage( NAME,
+                                             "Warning: gsdi (gene duplication inference) only available tabbed display" );
+            }
             AptxUtil.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
         }
         validate();
@@ -734,6 +746,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
         customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
         customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
+        customizeCheckBoxMenuItem( _show_annotation_ref_source, getOptions().isShowAnnotationRefSource() );
         customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
         customizeCheckBoxMenuItem( _show_default_node_shapes_external_cbmi, getOptions()
                 .isShowDefaultNodeShapesExternal() );
@@ -804,7 +817,8 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
 
     void buildViewMenu() {
         _view_jmenu = MainFrame.createMenu( "View", getConfiguration() );
-        _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
+        _view_jmenu
+                .add( _display_basic_information_item = new JMenuItem( MainFrame.SHOW_BASIC_TREE_INFORMATION_LABEL ) );
         _view_jmenu.addSeparator();
         _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
         _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
@@ -884,7 +898,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         GSDI gsdi = null;
         final Phylogeny species_tree = _species_tree.copy();
         try {
-            gsdi = new GSDI( gene_tree, species_tree, false, true, true );
+            gsdi = new GSDI( gene_tree, species_tree, false, true, true, true );
         }
         catch ( final SDIException e ) {
             JOptionPane.showMessageDialog( this,
@@ -957,7 +971,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         GSDIR gsdir = null;
         final Phylogeny species_tree = _species_tree.copy();
         try {
-            gsdir = new GSDIR( gene_tree, species_tree, true, true );
+            gsdir = new GSDIR( gene_tree, species_tree, true, true, true );
         }
         catch ( final SDIException e ) {
             JOptionPane.showMessageDialog( this,
@@ -974,6 +988,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         result_gene_tree.setRerootable( false );
         result_gene_tree.clearHashIdToNodeMap();
         result_gene_tree.recalculateNumberOfExternalDescendants( true );
+        PhylogenyMethods.orderAppearance( result_gene_tree.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
         _mainpanel.addPhylogenyInNewTab( result_gene_tree, getConfiguration(), "gene tree", null );
         getMainPanel().getControlPanel().setShowEvents( true );
         showWhole();
@@ -1267,6 +1282,8 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
                 && _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() );
         options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
                 && _abbreviate_scientific_names.isSelected() );
         options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )