in progress
[jalview.git] / forester / java / src / org / forester / msa_compactor / MsaCompactor.java
index da74dec..b4d2fe7 100644 (file)
@@ -179,6 +179,7 @@ public class MsaCompactor {
             }
             ++i;
         }
+        
         if ( _phylogentic_inference ) {
             decorateTree( phy, msa_props, true );
             displayTree( phy );
@@ -230,34 +231,32 @@ public class MsaCompactor {
                 it.next().getNodeData().setNodeVisualData( vis );
             }
         }
-      
-                for( int i = 0; i < msa_props.size(); ++i ) {
-                    final MsaProperties msa_prop = msa_props.get( i );
-                    final String id = msa_prop.getRemovedSeq();
-                    if ( !ForesterUtil.isEmpty( id ) ) {
-                        final PhylogenyNode n = phy.getNode( id );
-                        n.setName( n.getName() + " [" + i + "]" );
-                        if ( !chart_only ) {
-                            final NodeVisualData vis = new NodeVisualData();
-                            vis.setFillType( NodeFill.SOLID );
-                            vis.setShape( NodeShape.RECTANGLE );
-                            vis.setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(), min, max, mean_color, max_color ) );
-                            n.getNodeData().setNodeVisualData( vis );
-                        }
-                        else {
-                            n.getNodeData()
-                                    .getNodeVisualData()
-                                    .setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(),
-                                                                           min,
-                                                                           max,
-                                                                           mean,
-                                                                           min_color,
-                                                                           max_color,
-                                                                           mean_color ) );
-                        }
-                    }
-        
+        for( int i = 0; i < msa_props.size(); ++i ) {
+            final MsaProperties msa_prop = msa_props.get( i );
+            final String id = msa_prop.getRemovedSeq();
+            if ( !ForesterUtil.isEmpty( id ) ) {
+                final PhylogenyNode n = phy.getNode( id );
+                n.setName( n.getName() + " [" + i + "]" );
+                if ( !chart_only ) {
+                    final NodeVisualData vis = new NodeVisualData();
+                    vis.setFillType( NodeFill.SOLID );
+                    vis.setShape( NodeShape.RECTANGLE );
+                    vis.setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(), min, max, mean_color, max_color ) );
+                    n.getNodeData().setNodeVisualData( vis );
+                }
+                else {
+                    n.getNodeData()
+                    .getNodeVisualData()
+                    .setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(),
+                                                           min,
+                                                           max,
+                                                           mean,
+                                                           min_color,
+                                                           max_color,
+                                                           mean_color ) );
                 }
+            }
+        }
     }
 
     final public void deleteGapColumns( final double max_allowed_gap_ratio ) {
@@ -274,6 +273,7 @@ public class MsaCompactor {
         config.setDisplaySequenceNames( false );
         config.setDisplaySequenceSymbols( false );
         config.setDisplayGeneNames( false );
+        config.setDisplayMultipleSequenceAlignment( true );
         config.setShowScale( true );
         config.setAddTaxonomyImagesCB( false );
         config.setBaseFontSize( 9 );
@@ -349,9 +349,16 @@ public class MsaCompactor {
             System.out.println( msg );
         }
         if ( _phylogentic_inference ) {
-            decorateTree( phy,  msa_props, false );
+            decorateTree( phy, msa_props, false );
             displayTree( phy );
-        }
+            System.out.println( "calculating phylogentic tree..." );
+            System.out.println();
+            final Phylogeny phy2 = calcTree();
+            addSeqs2Tree( _msa, phy2 );
+            displayTree( phy2 );
+        }   
+      
+       
         return msa_props;
     }
 
@@ -400,9 +407,15 @@ public class MsaCompactor {
             System.out.println( msg );
         }
         if ( _phylogentic_inference ) {
-            decorateTree( phy,  msa_props, false );
+            decorateTree( phy, msa_props, false );
             displayTree( phy );
-        }
+            System.out.println( "calculating phylogentic tree..." );
+            System.out.println();
+            final Phylogeny phy2 = calcTree();
+            addSeqs2Tree( _msa, phy2 );
+            displayTree( phy2 );
+        }   
+       
         return msa_props;
     }
 
@@ -450,17 +463,15 @@ public class MsaCompactor {
             System.out.println( msg );
         }
         if ( _phylogentic_inference ) {
-            decorateTree( phy,  msa_props, false );
+            decorateTree( phy, msa_props, false );
             displayTree( phy );
-            
-           
-                System.out.println( "calculating phylogentic tree..." );
-                System.out.println();
-                Phylogeny phy2 = calcTree();
-                addSeqs2Tree( _msa, phy2 );
-                displayTree( phy2 );
-            
-        }
+            System.out.println( "calculating phylogentic tree..." );
+            System.out.println();
+            final Phylogeny phy2 = calcTree();
+            addSeqs2Tree( _msa, phy2 );
+            displayTree( phy2 );
+        }   
+       
         return msa_props;
     }
 
@@ -641,6 +652,8 @@ public class MsaCompactor {
         sb.append( msa_properties.getLength() );
         sb.append( "\t" );
         sb.append( NF_4.format( msa_properties.getGapRatio() ) );
+        sb.append( "\t" );
+        sb.append( NF_1.format( msa_properties.getAvgNumberOfGaps() ) );
         if ( _calculate_shannon_entropy ) {
             sb.append( "\t" );
             sb.append( NF_4.format( msa_properties.getEntropy7() ) );
@@ -708,6 +721,8 @@ public class MsaCompactor {
         System.out.print( "\t" );
         System.out.print( "Length" );
         System.out.print( "\t" );
+        System.out.print( "Gap R" );
+        System.out.print( "\t" );
         System.out.print( "Gaps" );
         System.out.print( "\t" );
         if ( _calculate_shannon_entropy ) {