public class rio {
final static private String PRG_NAME = "rio";
- final static private String PRG_VERSION = "4.000 beta 1";
- final static private String PRG_DATE = "2012.12.11";
+ final static private String PRG_VERSION = "4.000 beta 2";
+ final static private String PRG_DATE = "2012.12.14";
final static private String E_MAIL = "czmasek@burnham.org";
final static private String WWW = "www.phylosoft.org/forester/";
final static private String HELP_OPTION_1 = "help";
AptxUtil.unexpectedException( e );
return;
}
- final Phylogeny result_gene_tree = gsdir.getMinDuplicationsSumGeneTrees().get( 0 );
+ 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 );
- //_mainpanel.getCurrentTreePanel().setTree( gene_tree );
- // _mainpanel.getCurrentTreePanel().setEdited( true );
getControlPanel().setShowEvents( true );
showWhole();
final int selected = _mainpanel.getTabbedPane().getSelectedIndex();
showWhole();
_mainpanel.getCurrentTreePanel().setEdited( true );
JOptionPane.showMessageDialog( this,
- "Duplications: " + gsdir.getMinDuplicationsSum() + "\n" + "Speciations: "
+ "Duplications (min): " + gsdir.getMinDuplicationsSum() + "\n" + "Speciations: "
+ gsdir.getSpeciationsSum() + "\n"
+ "Number of root positions minimizing duplications sum: "
- + gsdir.getMinDuplicationsSumGeneTrees().size(),
+ + gsdir.getMinDuplicationsSumGeneTrees().size() + "\n"
+ + "Number of shortest trees: " + shortests.size(),
"GSDIR successfully completed",
JOptionPane.INFORMATION_MESSAGE );
}
break;
}
case GSDIR: {
- // System.out.println( "gene/species tree size before: " + gene_tree.getNumberOfExternalNodes() + "/"
- // + species_tree.getNumberOfExternalNodes() );
final GSDIR gsdir = new GSDIR( gene_tree, species_tree, true, i == 0 );
- // System.out.println( "gene/species tree size before: " + gene_tree.getNumberOfExternalNodes() + "/"
- // + species_tree.getNumberOfExternalNodes() );
- assigned_tree = gsdir.getMinDuplicationsSumGeneTrees().get( 0 );
+ final List<Phylogeny> assigned_trees = gsdir.getMinDuplicationsSumGeneTrees();
if ( i == 0 ) {
_removed_gene_tree_nodes = gsdir.getStrippedExternalGeneTreeNodes();
for( final PhylogenyNode r : _removed_gene_tree_nodes ) {
}
}
}
+ final List<Integer> shortests = GSDIR.getIndexesOfShortestTree( assigned_trees );
+ assigned_tree = assigned_trees.get( shortests.get( 0 ) );
if ( _produce_log ) {
- writeStatsToLog( i, gsdir );
+ writeStatsToLog( i, gsdir, shortests );
}
_gsdir_tax_comp_base = gsdir.getTaxCompBase();
break;
_log.append( "min" );
_log.append( "-" );
_log.append( "max" );
- _log.append( "]" );
+ _log.append( "]\t<" );
+ _log.append( "shortest" );
+ _log.append( ">" );
_log.append( ForesterUtil.LINE_SEPARATOR );
}
- private final void writeStatsToLog( final int i, final GSDIR gsdir ) {
+ 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( ( int ) stats.getMin() );
_log.append( "-" );
_log.append( ( int ) stats.getMax() );
- _log.append( "]" );
+ _log.append( "]\t<" );
+ _log.append( shortests.size() );
+ _log.append( ">" );
_log.append( ForesterUtil.LINE_SEPARATOR );
}
public TaxonomyComparisonBase getTaxCompBase() {\r
return _tax_comp_base;\r
}\r
+\r
+ public final static List<Integer> getIndexesOfShortestTree( final List<Phylogeny> assigned_trees ) {\r
+ final List<Integer> shortests = new ArrayList<Integer>();\r
+ boolean depth = true;\r
+ double x = Double.MAX_VALUE;\r
+ for( int i = 0; i < assigned_trees.size(); ++i ) {\r
+ final Phylogeny phy = assigned_trees.get( i );\r
+ if ( i == 0 ) {\r
+ if ( PhylogenyMethods.calculateMaxDistanceToRoot( phy ) > 0 ) {\r
+ depth = false;\r
+ }\r
+ }\r
+ final double d;\r
+ if ( depth ) {\r
+ d = PhylogenyMethods.calculateMaxDepth( phy );\r
+ }\r
+ else {\r
+ d = PhylogenyMethods.calculateMaxDistanceToRoot( phy );\r
+ }\r
+ if ( d < x ) {\r
+ x = d;\r
+ shortests.clear();\r
+ shortests.add( i );\r
+ }\r
+ else if ( d == x ) {\r
+ shortests.add( i );\r
+ }\r
+ }\r
+ return shortests;\r
+ }\r
}\r
public final class ForesterConstants {
- public final static String FORESTER_VERSION = "1.010";
- public final static String FORESTER_DATE = "121211";
+ public final static String FORESTER_VERSION = "1.011";
+ public final static String FORESTER_DATE = "121214";
public final static String PHYLO_XML_VERSION = "1.10";
public final static String PHYLO_XML_LOCATION = "http://www.phyloxml.org";
public final static String PHYLO_XML_XSD = "phyloxml.xsd";