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