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 );
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";
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 );
_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 );
}
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 ) {
}
}
}
- 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();
}
}
}
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() {
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
}\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
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
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
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";