X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fmsa_compactor%2FMsaCompactor.java;h=8a13b5cc6bdb2ff28954e78fdb04751ad8c850d9;hb=3b40e07c1b3964dee89b5d24209946ac54a5e21f;hp=687951ced1c9103722c09f3ad5901dc0ae721cbd;hpb=02bf2b081aed88622e3279e816f0aeb45cba546e;p=jalview.git diff --git a/forester/java/src/org/forester/msa_compactor/MsaCompactor.java b/forester/java/src/org/forester/msa_compactor/MsaCompactor.java index 687951c..8a13b5c 100644 --- a/forester/java/src/org/forester/msa_compactor/MsaCompactor.java +++ b/forester/java/src/org/forester/msa_compactor/MsaCompactor.java @@ -82,7 +82,7 @@ public class MsaCompactor { // private String _maffts_opts = "--auto"; private DeleteableMsa _msa = null; - private boolean _norm = true; + private boolean _normalize_for_effective_seq_length = true; private File _out_file_base = null; private MSA_FORMAT _output_format = MSA_FORMAT.FASTA; private String _path_to_mafft = null; @@ -130,9 +130,9 @@ public class MsaCompactor { return phy; } - public final List chart( final int step, final boolean realign, final boolean norm ) + public final List chart( final int step, final boolean realign, final boolean normalize_for_effective_seq_length ) throws IOException, InterruptedException { - final GapContribution stats[] = calcGapContribtionsStats( norm ); + final GapContribution stats[] = calcGapContribtionsStats( normalize_for_effective_seq_length ); final List to_remove_ids = new ArrayList(); final List msa_props = new ArrayList(); for( final GapContribution gap_gontribution : stats ) { @@ -179,6 +179,7 @@ public class MsaCompactor { } ++i; } + if ( _phylogentic_inference ) { decorateTree( phy, msa_props, true ); displayTree( phy ); @@ -245,14 +246,14 @@ public class MsaCompactor { } else { n.getNodeData() - .getNodeVisualData() - .setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(), - min, - max, - mean, - min_color, - max_color, - mean_color ) ); + .getNodeVisualData() + .setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(), + min, + max, + mean, + min_color, + max_color, + mean_color ) ); } } } @@ -272,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 ); @@ -302,8 +304,8 @@ public class MsaCompactor { } public final List removeViaGapAverage( final double mean_gapiness ) throws IOException, - InterruptedException { - final GapContribution stats[] = calcGapContribtionsStats( _norm ); + InterruptedException { + final GapContribution stats[] = calcGapContribtionsStats( _normalize_for_effective_seq_length ); final List to_remove_ids = new ArrayList(); final List msa_props = new ArrayList(); for( final GapContribution gap_gontribution : stats ) { @@ -349,12 +351,19 @@ public class MsaCompactor { if ( _phylogentic_inference ) { 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; } public List removeViaLength( final int length ) throws IOException, InterruptedException { - final GapContribution stats[] = calcGapContribtionsStats( _norm ); + final GapContribution stats[] = calcGapContribtionsStats( _normalize_for_effective_seq_length ); final List to_remove_ids = new ArrayList(); final List msa_props = new ArrayList(); for( final GapContribution gap_gontribution : stats ) { @@ -400,13 +409,19 @@ public class MsaCompactor { if ( _phylogentic_inference ) { 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; } public final List removeWorstOffenders( final int to_remove ) throws IOException, - InterruptedException { - final GapContribution stats[] = calcGapContribtionsStats( _norm ); + InterruptedException { + final GapContribution stats[] = calcGapContribtionsStats( _normalize_for_effective_seq_length ); final List to_remove_ids = new ArrayList(); final List msa_props = new ArrayList(); for( int j = 0; j < to_remove; ++j ) { @@ -455,7 +470,8 @@ public class MsaCompactor { final Phylogeny phy2 = calcTree(); addSeqs2Tree( _msa, phy2 ); displayTree( phy2 ); - } + } + return msa_props; } @@ -471,8 +487,8 @@ public class MsaCompactor { _maffts_opts = maffts_opts; } - public final void setNorm( final boolean norm ) { - _norm = norm; + public final void setNorm( final boolean normalize_for_effective_seq_length ) { + _normalize_for_effective_seq_length = normalize_for_effective_seq_length; } final public void setOutFileBase( final File out_file_base ) { @@ -568,8 +584,8 @@ public class MsaCompactor { return stats; } - final private GapContribution[] calcGapContribtionsStats( final boolean norm ) { - final GapContribution stats[] = calcGapContribtions( norm ); + final private GapContribution[] calcGapContribtionsStats( final boolean normalize_for_effective_seq_length ) { + final GapContribution stats[] = calcGapContribtions( normalize_for_effective_seq_length ); Arrays.sort( stats ); return stats; } @@ -637,7 +653,7 @@ public class MsaCompactor { sb.append( "\t" ); sb.append( NF_4.format( msa_properties.getGapRatio() ) ); sb.append( "\t" ); - sb.append( NF_1.format( msa_properties.getAvgNumberOfGapsPer100() ) ); + sb.append( NF_1.format( msa_properties.getAvgNumberOfGaps() ) ); if ( _calculate_shannon_entropy ) { sb.append( "\t" ); sb.append( NF_4.format( msa_properties.getEntropy7() ) );