--- /dev/null
+
+package org.forester.application;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.SortedMap;
+
+import org.forester.io.parsers.GeneralMsaParser;
+import org.forester.msa.Msa;
+import org.forester.msa.MsaMethods;
+import org.forester.util.CommandLineArguments;
+
+public class msa_quality {
+
+ public static void main( final String args[] ) {
+ CommandLineArguments cla = null;
+ try {
+ cla = new CommandLineArguments( args );
+ }
+ catch ( final Exception e ) {
+ // ForesterUtil.fatalError( PRG_NAME, e.getMessage() );
+ }
+ // if ( cla.isOptionSet( HELP_OPTION_1 ) || cla.isOptionSet( HELP_OPTION_2 ) || ( args.length == 0 ) ) {
+ // printHelp();
+ // System.exit( 0 );
+ // }
+ final File in = cla.getFile( 0 );
+ Msa msa = null;
+ try {
+ msa = GeneralMsaParser.parse( new FileInputStream( in ) );
+ }
+ catch ( final FileNotFoundException e ) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch ( final IOException e ) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ final int end = 2;
+ final int start = 6;
+ for( int c = start; c <= end; ++c ) {
+ final SortedMap<Character, Integer> dist = MsaMethods.calculateResidueDestributionPerColumn( msa, c );
+ final char majority_char = ' ';
+ final int majority_count = 0;
+ }
+ }
+}
import org.forester.msa.Mafft;
import org.forester.msa.Msa;
import org.forester.msa.MsaInferrer;
-import org.forester.msa.MsaTools;
+import org.forester.msa.MsaMethods;
import org.forester.msa.ResampleableMsa;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
return;
}
System.out.println( msa.toString() );
- System.out.println( MsaTools.calcBasicGapinessStatistics( msa ).toString() );
- final MsaTools msa_tools = MsaTools.createInstance();
+ System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+ final MsaMethods msa_tools = MsaMethods.createInstance();
if ( _options.isExecuteMsaProcessing() ) {
msa = msa_tools.removeGapColumns( _options.getMsaProcessingMaxAllowedGapRatio(),
_options.getMsaProcessingMinAllowedLength(),
}
System.out.println( msa_tools.getIgnoredSequenceIds() );
System.out.println( msa.toString() );
- System.out.println( MsaTools.calcBasicGapinessStatistics( msa ).toString() );
+ System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
_msa = msa;
}
final int n = _options.getBootstrapSamples();
import java.io.IOException;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.List;
import org.forester.sequence.Sequence;
}
return msa;
}
+
+ @Override
+ public List<Character> getColumnAt( final int col ) {
+ final List<Character> column = new ArrayList<Character>();
+ for( int row = 0; row < getNumberOfSequences(); ++row ) {
+ column.add( getResidueAt( row, col ) );
+ }
+ return column;
+ }
}
import java.io.IOException;
import java.io.Writer;
+import java.util.List;
import org.forester.sequence.Sequence.TYPE;
public char getResidueAt( int row, int col );
+ public List<Character> getColumnAt( int col );
+
public StringBuffer getSequenceAsString( int row );
public abstract TYPE getType();
import java.util.ArrayList;
import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
import org.forester.sequence.BasicSequence;
import org.forester.sequence.Sequence;
import org.forester.util.BasicDescriptiveStatistics;
import org.forester.util.DescriptiveStatistics;
-public final class MsaTools {
+public final class MsaMethods {
private ArrayList<String> _ignored_seqs_ids;
return _ignored_seqs_ids;
}
- synchronized public static MsaTools createInstance() {
- return new MsaTools();
+ synchronized public static MsaMethods createInstance() {
+ return new MsaMethods();
}
- private MsaTools() {
+ private MsaMethods() {
init();
}
return BasicMsa.createInstance( seqs );
}
+ public static SortedMap<Character, Integer> calculateResidueDestributionPerColumn( final Msa msa, final int c ) {
+ final SortedMap<Character, Integer> map = new TreeMap<Character, Integer>();
+ for( final Character r : msa.getColumnAt( c ) ) {
+ if ( !map.containsKey( r ) ) {
+ map.put( r, 1 );
+ }
+ else {
+ map.put( r, map.get( r ) + 1 );
+ }
+ }
+ return map;
+ }
+
public static DescriptiveStatistics calcBasicGapinessStatistics( final Msa msa ) {
final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
for( int i = 0; i < msa.getLength(); ++i ) {