kepp only one dup min gt
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 9 Jan 2013 06:10:00 +0000 (06:10 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 9 Jan 2013 06:10:00 +0000 (06:10 +0000)
forester/java/src/org/forester/application/gsdi.java
forester/java/src/org/forester/application/rio.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java
forester/java/src/org/forester/rio/RIO.java
forester/java/src/org/forester/sdi/GSDIR.java
forester/java/src/org/forester/util/ForesterConstants.java

index 9e3f326..17dbf7e 100644 (file)
@@ -288,10 +288,7 @@ public final class gsdi {
         try {
             final PhylogenyWriter writer = new PhylogenyWriter();
             if ( base_algorithm == ALGORITHM.GSDIR ) {
-                writer.toPhyloXML( out_file,
-                                   ( ( GSDIR ) gsdii ).getMinDuplicationsSumGeneTrees(),
-                                   0,
-                                   ForesterUtil.LINE_SEPARATOR );
+                writer.toPhyloXML( out_file, ( ( GSDIR ) gsdii ).getMinDuplicationsSumGeneTree(), 0 );
             }
             else {
                 writer.toPhyloXML( out_file, gene_tree, 0 );
index 59553e6..c371af5 100644 (file)
@@ -53,7 +53,7 @@ import org.forester.util.ForesterUtil;
 public class rio {
 
     final static private String PRG_NAME      = "rio";
-    final static private String PRG_VERSION   = "4.000 beta 6";
+    final static private String PRG_VERSION   = "4.000 beta 7";
     final static private String PRG_DATE      = "2013.01.08";
     final static private String E_MAIL        = "phyloxml@gmail.com";
     final static private String WWW           = "https://sites.google.com/site/cmzmasek/home/software/forester";
index b50cbf2..d0b7949 100644 (file)
@@ -1270,9 +1270,7 @@ public final class MainFrameApplication extends MainFrame {
             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 ) );
+        final Phylogeny result_gene_tree = gsdir.getMinDuplicationsSumGeneTree();
         result_gene_tree.setRerootable( false );
         result_gene_tree.clearHashIdToNodeMap();
         result_gene_tree.recalculateNumberOfExternalDescendants( true );
@@ -1287,10 +1285,7 @@ public final class MainFrameApplication extends MainFrame {
         _mainpanel.getCurrentTreePanel().setEdited( true );
         JOptionPane.showMessageDialog( this,
                                        "Duplications (min): " + gsdir.getMinDuplicationsSum() + "\n" + "Speciations: "
-                                               + gsdir.getSpeciationsSum() + "\n"
-                                               + "Number of root positions minimizing duplications sum: "
-                                               + gsdir.getMinDuplicationsSumGeneTrees().size() + "\n"
-                                               + "Number of shortest trees: " + shortests.size(),
+                                               + gsdir.getSpeciationsSum(),
                                        "GSDIR successfully completed",
                                        JOptionPane.INFORMATION_MESSAGE );
     }
index 771d5e7..0cbe6dd 100644 (file)
@@ -388,7 +388,7 @@ 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 ) {
@@ -398,11 +398,6 @@ public final class RIO {
                     }
                 }
             }
-            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();
             }
@@ -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() {
index 602e9e2..8ada705 100644 (file)
@@ -42,7 +42,7 @@ public class GSDIR implements GSDII {
     private final int                        _min_duplications_sum;\r
     private final int                        _speciations_sum;\r
     private final BasicDescriptiveStatistics _duplications_sum_stats;\r
-    private final List<Phylogeny>            _min_duplications_sum_gene_trees;\r
+    private Phylogeny                        _min_duplications_sum_gene_tree;\r
     private final List<PhylogenyNode>        _stripped_gene_tree_nodes;\r
     private final List<PhylogenyNode>        _stripped_species_tree_nodes;\r
     private final Set<PhylogenyNode>         _mapped_species_tree_nodes;\r
@@ -72,7 +72,6 @@ public class GSDIR implements GSDII {
         }\r
         int min_duplications_sum = Integer.MAX_VALUE;\r
         int speciations_sum = 0;\r
-        _min_duplications_sum_gene_trees = new ArrayList<Phylogeny>();\r
         _duplications_sum_stats = new BasicDescriptiveStatistics();\r
         for( final PhylogenyBranch branch : gene_tree_branches_post_order ) {\r
             gene_tree.reRoot( branch );\r
@@ -88,12 +87,16 @@ public class GSDIR implements GSDII {
             if ( gsdi_result.getDuplicationsSum() < min_duplications_sum ) {\r
                 min_duplications_sum = gsdi_result.getDuplicationsSum();\r
                 speciations_sum = gsdi_result.getSpeciationsSum();\r
-                _min_duplications_sum_gene_trees.clear();\r
-                _min_duplications_sum_gene_trees.add( gene_tree.copy() );\r
-                //_speciations_sum\r
+                _min_duplications_sum_gene_tree = gene_tree.copy();\r
             }\r
             else if ( gsdi_result.getDuplicationsSum() == min_duplications_sum ) {\r
-                _min_duplications_sum_gene_trees.add( gene_tree.copy() );\r
+                final List<Phylogeny> l = new ArrayList<Phylogeny>();\r
+                l.add( _min_duplications_sum_gene_tree );\r
+                l.add( gene_tree );\r
+                final int index = getIndexesOfShortestTree( l ).get( 0 );\r
+                if ( index == 1 ) {\r
+                    _min_duplications_sum_gene_tree = gene_tree.copy();\r
+                }\r
             }\r
             _duplications_sum_stats.addValue( gsdi_result.getDuplicationsSum() );\r
         }\r
@@ -114,8 +117,8 @@ public class GSDIR implements GSDII {
         return _min_duplications_sum;\r
     }\r
 \r
-    public List<Phylogeny> getMinDuplicationsSumGeneTrees() {\r
-        return _min_duplications_sum_gene_trees;\r
+    public Phylogeny getMinDuplicationsSumGeneTree() {\r
+        return _min_duplications_sum_gene_tree;\r
     }\r
 \r
     @Override\r
index 1f551d6..f147188 100644 (file)
@@ -27,7 +27,7 @@ package org.forester.util;
 
 public final class ForesterConstants {
 
-    public final static String  FORESTER_VERSION            = "1.017";
+    public final static String  FORESTER_VERSION            = "1.018";
     public final static String  FORESTER_DATE               = "130108";
     public final static String  PHYLO_XML_VERSION           = "1.10";
     public final static String  PHYLO_XML_LOCATION          = "http://www.phyloxml.org";