- public static void midpointRootOLD( final Phylogeny phylogeny ) {
- // if ( phylogeny.getNumberOfExternalNodes() < 2 ) {
- // return;
- // }
- // final PhylogenyMethods methods = getInstance();
- //final double farthest_d = methods.calculateFurthestDistance( phylogeny );
- // final PhylogenyNode f1 = methods.getFarthestNode1();
- // final PhylogenyNode f2 = methods.getFarthestNode2();
- // if ( farthest_d <= 0.0 ) {
- // return;
- // }
- // double x = farthest_d / 2.0;
- // PhylogenyNode n = f1;
- // if ( PhylogenyMethods.getDistance( f1, phylogeny.getRoot() ) < PhylogenyMethods.getDistance( f2, phylogeny
- // .getRoot() ) ) {
- // n = f2;
- // }
- // while ( ( x > n.getDistanceToParent() ) && !n.isRoot() ) {
- // x -= ( n.getDistanceToParent() > 0 ? n.getDistanceToParent() : 0 );
- // n = n.getParent();
- // }
- // phylogeny.reRoot( n, x );
- // phylogeny.recalculateNumberOfExternalDescendants( true );
- // final PhylogenyNode a = getFurthestDescendant( phylogeny.getRoot().getChildNode1() );
- // final PhylogenyNode b = getFurthestDescendant( phylogeny.getRoot().getChildNode2() );
- // final double da = getDistance( a, phylogeny.getRoot() );
- // final double db = getDistance( b, phylogeny.getRoot() );
- // if ( Math.abs( da - db ) > 0.000001 ) {
- // throw new FailedConditionCheckException( "this should not have happened: midpoint rooting failed: da="
- // + da + ", db=" + db + ", diff=" + Math.abs( da - db ) );
- // }
- }
-