import java.util.List;
import java.util.Set;
-import org.forester.archaeopteryx.Archaeopteryx;
import org.forester.evoinference.distance.NeighborJoining;
import org.forester.evoinference.distance.NeighborJoiningF;
import org.forester.evoinference.distance.NeighborJoiningR;
public class TestPhylogenyReconstruction {
- private final static double ZERO_DIFF = 1.0E-9;
+ private final static double ZERO_DIFF = 1.0E-9;
+ private final static boolean VERBOSE = false;
public static boolean isEqual( final double a, final double b ) {
return ( ( Math.abs( a - b ) ) < ZERO_DIFF );
public static void main( final String[] args ) {
System.out.println( "NJ" );
- if ( testNeighborJoining() ) {
+ if ( testNeighborJoining( VERBOSE ) ) {
System.out.println( " OK." );
}
else {
}
System.out.println( "OK." );
System.out.print( " Neighbor Joining: " );
- if ( !testNeighborJoining() ) {
+ if ( !testNeighborJoining( VERBOSE ) ) {
System.out.println( "failed." );
return false;
}
private static boolean testDistanceCalculationMethods( final File test_dir ) {
try {
- final Msa msa0 = GeneralMsaParser.parse( new FileInputStream( test_dir + ForesterUtil.FILE_SEPARATOR
+ final Msa msa0 = GeneralMsaParser.parseMsa( new FileInputStream( test_dir + ForesterUtil.FILE_SEPARATOR
+ "bcl.aln" ) );
- final BasicSymmetricalDistanceMatrix pwd0 = PairwiseDistanceCalculator.calcKimuraDistances( msa0 );
+ final DistanceMatrix pwd0 = PairwiseDistanceCalculator.calcKimuraDistances( msa0 );
if ( pwd0.getSize() != 120 ) {
return false;
}
return true;
}
- private static boolean testNeighborJoining() {
+ private static boolean testNeighborJoining( final boolean verbose ) {
try {
NeighborJoining nj = NeighborJoining.createInstance();
final BasicSymmetricalDistanceMatrix m0 = new BasicSymmetricalDistanceMatrix( 4 );
m.setRow( "1.60430 1.43890 0.61790 0.50610 0.34840 0.00000 0.26920", 5 );
m.setRow( "1.59050 1.46290 0.55830 0.47100 0.30830 0.26920 0.00000", 6 );
//NeighborJoiningR njr = NeighborJoiningR.createInstance( true, 6 );
- nj = NeighborJoining.createInstance( true, 6 );
+ nj = NeighborJoining.createInstance( verbose, 6 );
final Phylogeny p2 = nj.execute( m );
- Archaeopteryx.createApplication( p2 );
+ //Archaeopteryx.createApplication( p2 );
p2.reRoot( p2.getNode( "Bovine" ) );
if ( isUnequal( p2.getNode( "Chimp" ).getDistanceToParent(), 0.151675 ) ) {
return false;
m.setRow( "1.52430 1.44650 0.59580 0.46310 0.00000 0.34840 0.30830", 4 );
m.setRow( "1.60430 1.43890 0.61790 0.50610 0.34840 0.00000 0.26920", 5 );
m.setRow( "1.59050 1.46290 0.55830 0.47100 0.30830 0.26920 0.00000", 6 );
- njf = NeighborJoiningF.createInstance( true, 5 );
+ njf = NeighborJoiningF.createInstance( verbose, 5 );
final Phylogeny p2f = njf.execute( m );
p2f.reRoot( p2f.getNode( "Bovine" ) );
if ( isUnequal( p2f.getNode( "Chimp" ).getDistanceToParent(), 0.15168 ) ) {
m2.setRow( "1.59050 1.46290 0.55830 0.47100 0.30830 0.26920 0.00000", 6 );
final NeighborJoiningR nj2 = NeighborJoiningR.createInstance( true, 6 );
final Phylogeny p2 = nj2.execute( m2 );
- Archaeopteryx.createApplication( p2 );
+ // Archaeopteryx.createApplication( p2 );
p2.reRoot( p2.getNode( "Bovine" ) );
if ( isUnequal( p2.getNode( "Chimp" ).getDistanceToParent(), 0.151675 ) ) {
System.out.println( p2.getNode( "Chimp" ).getDistanceToParent() );