messed up at the moment
[jalview.git] / forester / java / src / org / forester / rio / RIO.java
index 10db8cd..0cbe6dd 100644 (file)
@@ -224,7 +224,7 @@ public final class RIO {
             }
             else if ( gene_tree_ext_nodes != gt.getNumberOfExternalNodes() ) {
                 throw new RIOException( "gene tree #" + i + " has a different number of external nodes ("
-                        + gt.getNumberOfExternalNodes() + ") than the preceding gene trees (" + gene_tree_ext_nodes
+                        + gt.getNumberOfExternalNodes() + ") than the preceding gene tree(s) (" + gene_tree_ext_nodes
                         + ")" );
             }
             if ( algorithm == ALGORITHM.SDIR ) {
@@ -284,8 +284,8 @@ public final class RIO {
                 }
                 else if ( gene_tree_ext_nodes != gt.getNumberOfExternalNodes() ) {
                     throw new RIOException( "gene tree #" + i + " has a different number of external nodes ("
-                            + gt.getNumberOfExternalNodes() + ") than the preceding gene trees (" + gene_tree_ext_nodes
-                            + ")" );
+                            + gt.getNumberOfExternalNodes() + ") than the preceding gene tree(s) ("
+                            + gene_tree_ext_nodes + ")" );
                 }
                 if ( algorithm == ALGORITHM.SDIR ) {
                     // Removes from gene_tree all species not found in species_tree.
@@ -374,9 +374,9 @@ public final class RIO {
             _int_nodes = assigned_tree.getNumberOfInternalNodes();
         }
         else if ( _ext_nodes != assigned_tree.getNumberOfExternalNodes() ) {
-            throw new RIOException( "after stripping gene tree #" + ( i + 1 )
-                    + " has a different number of external nodes (" + assigned_tree.getNumberOfExternalNodes()
-                    + ") than the preceding gene trees (" + _ext_nodes + ")" );
+            throw new RIOException( "after stripping gene tree #" + i + " has a different number of external nodes ("
+                    + assigned_tree.getNumberOfExternalNodes() + ") than the preceding gene tree(s) (" + _ext_nodes
+                    + ")" );
         }
         return assigned_tree;
     }
@@ -388,21 +388,16 @@ public final class RIO {
         final Phylogeny assigned_tree;
         if ( _rerooting == REROOTING.BY_ALGORITHM ) {
             final GSDIR gsdir = new GSDIR( gene_tree, species_tree, true, i == 0 );
-            final List<Phylogeny> assigned_trees = gsdir.getMinDuplicationsSumGeneTrees();
+            assigned_tree = gsdir.getMinDuplicationsSumGeneTree();
             if ( i == 0 ) {
                 _removed_gene_tree_nodes = gsdir.getStrippedExternalGeneTreeNodes();
                 for( final PhylogenyNode r : _removed_gene_tree_nodes ) {
                     if ( !r.getNodeData().isHasTaxonomy() ) {
-                        throw new RIOException( "node with no (appropriate) taxonomic information found in gene tree #1: "
-                                + r.toString() );
+                        throw new RIOException( "node with no (appropriate) taxonomic information found in gene tree #"
+                                + i + ": " + r.toString() );
                     }
                 }
             }
-            final List<Integer> shortests = GSDIR.getIndexesOfShortestTree( assigned_trees );
-            assigned_tree = assigned_trees.get( shortests.get( 0 ) );
-            if ( log() ) {
-                writeStatsToLog( i, gsdir, shortests );
-            }
             if ( i == 0 ) {
                 _gsdir_tax_comp_base = gsdir.getTaxCompBase();
             }
@@ -420,8 +415,8 @@ public final class RIO {
             _removed_gene_tree_nodes = gsdi.getStrippedExternalGeneTreeNodes();
             for( final PhylogenyNode r : _removed_gene_tree_nodes ) {
                 if ( !r.getNodeData().isHasTaxonomy() ) {
-                    throw new RIOException( "node with no (appropriate) taxonomic information found in gene tree #1: "
-                            + r.toString() );
+                    throw new RIOException( "node with no (appropriate) taxonomic information found in gene tree #" + i
+                            + ": " + r.toString() );
                 }
             }
             assigned_tree = gene_tree;
@@ -501,41 +496,6 @@ public final class RIO {
             }
         }
         log( "Re-rooting                                      : " + rs );
-        if ( _rerooting == REROOTING.BY_ALGORITHM ) {
-            writeLogSubHeader();
-        }
-    }
-
-    private final void writeLogSubHeader() {
-        _log.append( ForesterUtil.LINE_SEPARATOR );
-        _log.append( "Some information about duplication numbers in gene trees:" );
-        _log.append( ForesterUtil.LINE_SEPARATOR );
-        _log.append( "#" );
-        _log.append( "\t" );
-        _log.append( "re-rootings with minimal number of duplications" );
-        _log.append( "/" );
-        _log.append( "total root placements" );
-        _log.append( "\t" );
-        _log.append( "duplications range" );
-        _log.append( "\t" );
-        _log.append( "mininal duplication re-rootings with shortest tree heigth" );
-        _log.append( ForesterUtil.LINE_SEPARATOR );
-    }
-
-    private final void writeStatsToLog( final int i, final GSDIR gsdir, final List<Integer> shortests ) {
-        final BasicDescriptiveStatistics stats = gsdir.getDuplicationsSumStats();
-        _log.append( i );
-        _log.append( "\t" );
-        _log.append( gsdir.getMinDuplicationsSumGeneTrees().size() );
-        _log.append( "/" );
-        _log.append( stats.getN() );
-        _log.append( "\t" );
-        _log.append( ( int ) stats.getMin() );
-        _log.append( "-" );
-        _log.append( ( int ) stats.getMax() );
-        _log.append( "\t" );
-        _log.append( shortests.size() );
-        _log.append( ForesterUtil.LINE_SEPARATOR );
     }
 
     public final IntMatrix getOrthologTable() {