+ _mainpanel.getCurrentPhylogeny().clearHashIdToNodeMap();
+ _mainpanel.getCurrentPhylogeny().recalculateNumberOfExternalDescendants( true );
+ _mainpanel.getCurrentTreePanel().resetNodeIdToDistToLeafMap();
+ _mainpanel.getCurrentTreePanel().setEdited( true );
+ getControlPanel().setShowEvents( true );
+ showWhole();
+ final int selected = _mainpanel.getTabbedPane().getSelectedIndex();
+ _mainpanel.addPhylogenyInNewTab( species_tree, getConfiguration(), "species tree", null );
+ showWhole();
+ _mainpanel.getTabbedPane().setSelectedIndex( selected );
+ showWhole();
+ _mainpanel.getCurrentTreePanel().setEdited( true );
+ JOptionPane.showMessageDialog( this, "Duplications: " + gsdi.getDuplicationsSum() + "\n"
+ + "Potential duplications: " + gsdi.getSpeciationOrDuplicationEventsSum() + "\n" + "Speciations: "
+ + gsdi.getSpeciationsSum(), "GSDI successfully completed", JOptionPane.INFORMATION_MESSAGE );
+ }
+
+ void executeGSDIR() {
+ if ( !isOKforSDI( false, true ) ) {
+ return;
+ }
+ final Phylogeny gene_tree = _mainpanel.getCurrentPhylogeny().copy();
+ gene_tree.setAllNodesToNotCollapse();
+ gene_tree.recalculateNumberOfExternalDescendants( false );
+ GSDIR gsdir = null;
+ final Phylogeny species_tree = _species_tree.copy();
+ try {
+ gsdir = new GSDIR( gene_tree, species_tree, true, true );
+ }
+ catch ( final SDIException e ) {
+ JOptionPane.showMessageDialog( this,
+ e.getLocalizedMessage(),
+ "Error during GSDIR",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ catch ( final Exception e ) {
+ AptxUtil.unexpectedException( e );
+ return;
+ }
+ final List<Phylogeny> assigned_trees = gsdir.getMinDuplicationsSumGeneTrees();
+ final List<Integer> shortests = GSDIR.getIndexesOfShortestTree( assigned_trees );
+ final Phylogeny result_gene_tree = assigned_trees.get( shortests.get( 0 ) );
+ result_gene_tree.setRerootable( false );
+ result_gene_tree.clearHashIdToNodeMap();
+ result_gene_tree.recalculateNumberOfExternalDescendants( true );
+ _mainpanel.addPhylogenyInNewTab( result_gene_tree, getConfiguration(), "gene tree", null );