in progress
[jalview.git] / forester / java / src / org / forester / evoinference / TestPhylogenyReconstruction.java
index b9d2bb1..f6d3975 100644 (file)
@@ -34,6 +34,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.SortedSet;
 
+import org.forester.archaeopteryx.Archaeopteryx;
 import org.forester.evoinference.distance.NeighborJoining;
 import org.forester.evoinference.distance.NeighborJoiningF;
 import org.forester.evoinference.distance.NeighborJoiningR;
@@ -90,7 +91,7 @@ public class TestPhylogenyReconstruction {
         else {
             System.out.println( "  failed." );
         }
-        //timeNeighborJoining();
+       // timeNeighborJoining();
     }
 
     public static boolean test( final File test_dir ) {
@@ -2480,10 +2481,30 @@ public class TestPhylogenyReconstruction {
             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 );
+            final NeighborJoining nj = NeighborJoining.createInstance( true, 6 );
+            //nj = NeighborJoining.createInstance( true, 6 );
+            final Phylogeny pnj = nj.execute( m );
+            Archaeopteryx.createApplication( pnj );
+            //
+            m = new BasicSymmetricalDistanceMatrix( 7 );
+            m.setIdentifier( 0, "Bovine" );
+            m.setIdentifier( 1, "Mouse" );
+            m.setIdentifier( 2, "Gibbon" );
+            m.setIdentifier( 3, "Orang" );
+            m.setIdentifier( 4, "Gorilla" );
+            m.setIdentifier( 5, "Chimp" );
+            m.setIdentifier( 6, "Human" );
+            m.setRow( "0.00000 1.68660 1.71980 1.66060 1.52430 1.60430 1.59050", 0 );
+            m.setRow( "1.68660 0.00000 1.52320 1.48410 1.44650 1.43890 1.46290", 1 );
+            m.setRow( "1.71980 1.52320 0.00000 0.71150 0.59580 0.61790 0.55830", 2 );
+            m.setRow( "1.66060 1.48410 0.71150 0.00000 0.46310 0.50610 0.47100", 3 );
+            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 );
             final NeighborJoiningR nj2 = NeighborJoiningR.createInstance( true, 6 );
             //nj = NeighborJoining.createInstance( true, 6 );
             final Phylogeny p2 = nj2.execute( m );
-            //  Archaeopteryx.createApplication( p2 );
+              Archaeopteryx.createApplication( p2 );
             p2.reRoot( p2.getNode( "Bovine" ) );
             if ( isUnequal( p2.getNode( "Chimp" ).getDistanceToParent(), 0.151675 ) ) {
                 return false;
@@ -2895,6 +2916,15 @@ public class TestPhylogenyReconstruction {
     }
 
     private static void timeNeighborJoining() {
+        final NeighborJoiningR njr = NeighborJoiningR.createInstance();
+        for( int n = 3; n <= 9; ++n ) {
+            final int x = ( int ) Math.pow( 2, n );
+            final BasicSymmetricalDistanceMatrix mt = new BasicSymmetricalDistanceMatrix( x );
+            mt.randomize( new Date().getTime() );
+            final long start_time = new Date().getTime();
+            njr.execute( mt );
+            System.out.println( "Size: " + x + " -> " + ( new Date().getTime() - start_time ) + "ms" );
+        }
         final NeighborJoiningF njf = NeighborJoiningF.createInstance();
         for( int n = 3; n <= 9; ++n ) {
             final int x = ( int ) Math.pow( 2, n );