cleanup
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 13 Mar 2014 19:52:46 +0000 (19:52 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 13 Mar 2014 19:52:46 +0000 (19:52 +0000)
forester/java/src/org/forester/evoinference/TestPhylogenyReconstruction.java
forester/java/src/org/forester/evoinference/distance/CopyOfNeighborJoiningR.java
forester/java/src/org/forester/evoinference/distance/NeighborJoining.java
forester/java/src/org/forester/evoinference/distance/NeighborJoiningR.java

index f6d3975..3b4ac8d 100644 (file)
@@ -91,7 +91,7 @@ public class TestPhylogenyReconstruction {
         else {
             System.out.println( "  failed." );
         }
-       // timeNeighborJoining();
+        // timeNeighborJoining();
     }
 
     public static boolean test( final File test_dir ) {
@@ -2504,7 +2504,7 @@ public class TestPhylogenyReconstruction {
             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;
index 692287e..2a0e6ee 100644 (file)
@@ -347,7 +347,7 @@ public final class CopyOfNeighborJoiningR {
     }
 
     public final static CopyOfNeighborJoiningR createInstance( final boolean verbose,
-                                                         final int maximum_fraction_digits_for_distances ) {
+                                                               final int maximum_fraction_digits_for_distances ) {
         return new CopyOfNeighborJoiningR( verbose, maximum_fraction_digits_for_distances );
     }
 }
index b4f42ea..7bccea2 100644 (file)
@@ -138,24 +138,21 @@ public final class NeighborJoining {
             if ( otu1 < i ) {
                 if ( otu2 > i ) {
                     _d_values[ m_otu1 ][ m_i ] = ( _d_values[ m_otu1 ][ m_i ] + _d_values[ m_i ][ m_otu2 ] - d ) / 2;
-                   System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] )  );
+                    System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] ) );
                 }
                 else {
                     _d_values[ m_otu1 ][ m_i ] = ( _d_values[ m_otu1 ][ m_i ] + _d_values[ m_otu2 ][ m_i ] - d ) / 2;
-                    System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] )  );
-                    
+                    System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] ) );
                 }
             }
             else {
                 if ( otu2 > i ) {
                     _d_values[ m_i ][ m_otu1 ] = ( _d_values[ m_i ][ m_otu1 ] + _d_values[ m_i ][ m_otu2 ] - d ) / 2;
-                    System.out.print( DF.format(  _d_values[ m_i ][ m_otu1 ] )  );
-                    
+                    System.out.print( DF.format( _d_values[ m_i ][ m_otu1 ] ) );
                 }
                 else {
                     _d_values[ m_i ][ m_otu1 ] = ( _d_values[ m_i ][ m_otu1 ] + _d_values[ m_otu2 ][ m_i ] - d ) / 2;
-                    System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] )  );
-                    
+                    System.out.print( DF.format( _d_values[ m_otu1 ][ m_i ] ) );
                 }
             }
             System.out.print( " " );
index 384b6e9..db146ed 100644 (file)
@@ -87,7 +87,7 @@ public final class NeighborJoiningR {
             final PhylogenyNode node = new PhylogenyNode();
             //final double d = getDvalueUnmapped( otu1, _mappings[ otu2 ] );
             final double d = _d_values[ otu1 ][ _mappings[ otu2 ] ];
-            final double d1 = ( d / 2 ) + ( ( _r[  _rev_mappings[ otu1 ] ] - _r[ otu2 ] ) / ( 2 * ( _n - 2 ) ) );
+            final double d1 = ( d / 2 ) + ( ( _r[ _rev_mappings[ otu1 ] ] - _r[ otu2 ] ) / ( 2 * ( _n - 2 ) ) );
             final double d2 = d - d1;
             if ( _df == null ) {
                 _external_nodes[ otu1 ].setDistanceToParent( d1 );
@@ -149,7 +149,7 @@ public final class NeighborJoiningR {
             if ( j == otu2 ) {
                 continue;
             }
-            if ( otu1  < _mappings[ j ] ) {
+            if ( otu1 < _mappings[ j ] ) {
                 updateDvalue( otu1, otu2, j, d );
             }
         }
@@ -159,28 +159,22 @@ public final class NeighborJoiningR {
     private final void updateDvalue( final int otu1, final int otu2, final int j, final double d ) {
         final double new_d = ( getDvalueUnmapped( otu1, _mappings[ j ] ) + getDvalue( j, otu2 ) - d ) / 2;
         System.out.print( DF.format( new_d ) + " " );
-       // System.out.println( "going to remove: " + getDvalueUnmapped( otu1, _mappings[ j ] ) + ", " + otu1 + ", "
-       //         + _mappings[ j ] );
-        
-        if (  otu1< _mappings[ j ] ) {
+        // System.out.println( "going to remove: " + getDvalueUnmapped( otu1, _mappings[ j ] ) + ", " + otu1 + ", "
+        //         + _mappings[ j ] );
+        if ( otu1 < _mappings[ j ] ) {
             _s.removePairing( getDvalueUnmapped( otu1, _mappings[ j ] ), otu1, _mappings[ j ] );
         }
         else {
-            _s.removePairing( getDvalueUnmapped( otu1, _mappings[ j ] ), _mappings[ j ] ,  otu1 );
+            _s.removePairing( getDvalueUnmapped( otu1, _mappings[ j ] ), _mappings[ j ], otu1 );
         }
-        
-       
-      //  System.out.println( "going to remove: " + getDvalue( j, otu2 ) + ", " +_mappings[ otu2 ] + ", "
-      //          + _mappings[ j ] );
-        
-        if (   _mappings[ otu2  ] < _mappings[ j ] ) {
-            _s.removePairing( getDvalue( j, otu2 ),    _mappings[ otu2  ] , _mappings[ j ] );
+        //  System.out.println( "going to remove: " + getDvalue( j, otu2 ) + ", " +_mappings[ otu2 ] + ", "
+        //          + _mappings[ j ] );
+        if ( _mappings[ otu2 ] < _mappings[ j ] ) {
+            _s.removePairing( getDvalue( j, otu2 ), _mappings[ otu2 ], _mappings[ j ] );
         }
         else {
-            _s.removePairing( getDvalue( j, otu2 )   , _mappings[ j ],   _mappings[ otu2  ] );
-            
+            _s.removePairing( getDvalue( j, otu2 ), _mappings[ j ], _mappings[ otu2 ] );
         }
-       
         _s.addPairing( new_d, otu1, _mappings[ j ] );
         setDvalueU( otu1, j, new_d );
     }
@@ -189,7 +183,7 @@ public final class NeighborJoiningR {
         if ( i < _mappings[ j ] ) {
             _d_values[ i ][ _mappings[ j ] ] = d;
         }
-        _d_values[_mappings[ j] ][  i  ] = d;
+        _d_values[ _mappings[ j ] ][ i ] = d;
     }
 
     private double getDvalue( final int i, final int j ) {