X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fapplication%2Fmsa_compactor.java;h=e555593a94468ac63332e0a5b9b509d3142075d2;hb=8aadbec1b0627ebd71e57e60e06621d4038bb79a;hp=15c2d4c7e164cd1284fb9c41309bfd89d64a06bb;hpb=02bf2b081aed88622e3279e816f0aeb45cba546e;p=jalview.git diff --git a/forester/java/src/org/forester/application/msa_compactor.java b/forester/java/src/org/forester/application/msa_compactor.java index 15c2d4c..e555593 100644 --- a/forester/java/src/org/forester/application/msa_compactor.java +++ b/forester/java/src/org/forester/application/msa_compactor.java @@ -105,7 +105,7 @@ public class msa_compactor { int length = -1; int step = 1; boolean realign = false; - boolean norm = true; + boolean normalize_for_effective_seq_length = true; String path_to_mafft = null; int step_for_diagnostics = 1; int min_length = -1; @@ -223,7 +223,7 @@ public class msa_compactor { path_to_mafft = cla.getOptionValueAsCleanString( PATH_TO_MAFFT_OPTION ); } if ( cla.isOptionSet( DO_NOT_NORMALIZE_FOR_EFF_LENGTH_OPTION ) ) { - norm = false; + normalize_for_effective_seq_length = false; } if ( cla.isOptionSet( STEP_FOR_DIAGNOSTICS_OPTION ) ) { step_for_diagnostics = cla.getOptionValueAsInt( STEP_FOR_DIAGNOSTICS_OPTION ); @@ -346,8 +346,11 @@ public class msa_compactor { } System.out.println( "Step for diagnostics reports : " + step_for_diagnostics ); System.out.println( "Calculate normalized Shannon Entropy : " + report_entropy ); - if ( !norm ) { - System.out.println( "Normalize : " + norm ); + if ( normalize_for_effective_seq_length ) { + System.out.println( "Normalize : with individual, effective sequence lenghts" ); + } + else { + System.out.println( "Normalize : with MSA length" ); } System.out.println( "Realign with MAFFT : " + realign ); if ( realign ) { @@ -372,7 +375,7 @@ public class msa_compactor { if ( removed_seqs_out_base != null ) { mc.setRemovedSeqsOutBase( removed_seqs_out_base ); } - mc.setNorm( norm ); + mc.setNorm( normalize_for_effective_seq_length ); mc.setRealign( realign ); if ( realign ) { mc.setPathToMafft( path_to_mafft ); @@ -391,9 +394,12 @@ public class msa_compactor { msa_props = mc.removeViaLength( length ); } else { - msa_props = mc.chart( step, realign, norm ); + msa_props = mc.chart( step, realign, normalize_for_effective_seq_length ); } Chart.display( msa_props, initial_number_of_seqs, report_entropy, in.getName() ); + System.out.println(); + System.out.println( "Final MSA properties" ); + printMsaInfo( msa, MsaMethods.calculateEffectiveLengthStatistics( msa )); } } catch ( final IllegalArgumentException iae ) { @@ -418,20 +424,24 @@ public class msa_compactor { WWW, ForesterUtil.getForesterLibraryInformation() ); System.out.println( "Input MSA : " + in ); - System.out.println( " MSA length : " + msa.getLength() ); - System.out.println( " Number of sequences : " + msa.getNumberOfSequences() ); - System.out.println( " Median sequence length : " + NF_1.format( initial_msa_stats.median() ) ); - System.out.println( " Mean sequence length : " - + NF_1.format( initial_msa_stats.arithmeticMean() ) ); - System.out.println( " Max sequence length : " + ( ( int ) initial_msa_stats.getMax() ) ); - System.out.println( " Min sequence length : " + ( ( int ) initial_msa_stats.getMin() ) ); - System.out.println( " Gap ratio : " + printMsaInfo( msa, initial_msa_stats ); + } + + private static void printMsaInfo( DeleteableMsa msa, final DescriptiveStatistics msa_stats ) { + System.out.println( "MSA length : " + msa.getLength() ); + System.out.println( "Number of sequences : " + msa.getNumberOfSequences() ); + System.out.println( "Median sequence length : " + NF_1.format( msa_stats.median() ) ); + System.out.println( "Mean sequence length : " + + NF_1.format( msa_stats.arithmeticMean() ) ); + System.out.println( "Max sequence length : " + ( ( int ) msa_stats.getMax() ) ); + System.out.println( "Min sequence length : " + ( ( int ) msa_stats.getMin() ) ); + System.out.println( "Gap ratio : " + NF_4.format( MsaMethods.calcGapRatio( msa ) ) ); - System.out.println( " Mean gap count per 100 residues : " - + NF_1.format( MsaMethods.calcNumberOfGapsPer100Stats( msa ).arithmeticMean() ) ); - System.out.println( " Normalized Shannon Entropy (entn7) : " + System.out.println( "Mean gap count per sequence : " + + NF_1.format( MsaMethods.calcNumberOfGapsStats( msa ).arithmeticMean() ) ); + System.out.println( "Normalized Shannon Entropy (entn7) : " + NF_4.format( MsaMethods.calcNormalizedShannonsEntropy( 7, msa ) ) ); - System.out.println( " Normalized Shannon Entropy (entn21): " + System.out.println( "Normalized Shannon Entropy (entn21) : " + NF_4.format( MsaMethods.calcNormalizedShannonsEntropy( 21, msa ) ) ); } @@ -493,6 +503,9 @@ public class msa_compactor { + "= maximal allowed gap ratio per column (for deleting of columms) (0.0-1.0)" ); System.out.println( " -" + PERFORM_PHYLOGENETIC_INFERENCE + " to calculate a simple phylogenetic tree (Kimura distances, NJ)" ); + System.out.println( " -" + DO_NOT_NORMALIZE_FOR_EFF_LENGTH_OPTION + + " to normalize gap-contributions with MSA length, instead of individual effective sequence lenghts" ); + System.out.println(); System.out.println(); System.out.println();