- public final Phylogeny calcTree() {
- final Phylogeny phy = inferNJphylogeny( PWD_DISTANCE_METHOD.KIMURA_DISTANCE, _msa, false, "" );
- PhylogenyMethods.midpointRoot( phy );
- PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
- final boolean x = PhylogenyMethods.extractFastaInformation( phy );
- if ( !x ) {
- final PhylogenyNodeIterator it = phy.iteratorExternalForward();
- while ( it.hasNext() ) {
- final PhylogenyNode n = it.next();
- final String name = n.getName().trim();
- if ( !ForesterUtil.isEmpty( name ) ) {
- try {
- ParserUtils.extractTaxonomyDataFromNodeName( n, TAXONOMY_EXTRACTION.AGGRESSIVE );
- }
- catch ( final PhyloXmlDataFormatException e ) {
- // Ignore.
- }
- }
- }
- }
- return phy;
- }
-
- public final void decorateTree( final Phylogeny phy, final List<String> to_remove_ids ) {
- for( int i = 0; i < to_remove_ids.size(); ++i ) {
- final String id = to_remove_ids.get( i );
- final PhylogenyNode n = phy.getNode( id );
- n.setName( n.getName() + " [" + ( i + 1 ) + "]" );
- final NodeVisualData vis = new NodeVisualData();
- vis.setFillType( NodeFill.SOLID );
- vis.setShape( NodeShape.RECTANGLE );
- vis.setSize( 6 );
- vis.setNodeColor( new Color( i > 255 ? 0 : 255 - i, 0, 0 ) );
- n.getNodeData().setNodeVisualData( vis );
- }
- }
-
- public final void decorateTree2( final Phylogeny phy, final List<MsaProperties> msa_props ) {
- final BasicDescriptiveStatistics length_stats = new BasicDescriptiveStatistics();
- 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 ) ) {
- length_stats.addValue( msa_prop.getLength() );
- }
- }
- final double mean = length_stats.arithmeticMean();
- final double min = length_stats.getMin();
- final double max = length_stats.getMax();
- final Color min_color = new Color( 0, 255, 0 );
- final Color max_color = new Color( 255, 0, 0 );
- final Color mean_color = new Color( 255, 255, 0 );
- final PhylogenyNodeIterator it = phy.iteratorExternalForward();
- while ( it.hasNext() ) {
- final NodeVisualData vis = new NodeVisualData();
- vis.setFillType( NodeFill.SOLID );
- vis.setShape( NodeShape.RECTANGLE );
- vis.setSize( 6 );
- vis.setNodeColor( min_color );
- 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 + "]" );
- n.getNodeData()
- .getNodeVisualData()
- .setNodeColor( ForesterUtil.calcColor( msa_prop.getLength(),
- min,
- max,
- mean,
- min_color,
- max_color,
- mean_color ) );
- }
- }
- }
-
- public final void displayTree( final Phylogeny phy ) {
- final Configuration config = new Configuration();
- config.setDisplayAsPhylogram( true );
- config.setUseStyle( true );
- config.setDisplayTaxonomyCode( false );
- config.setDisplayTaxonomyCommonNames( false );
- config.setDisplayTaxonomyScientificNames( false );
- config.setDisplaySequenceNames( false );
- config.setDisplaySequenceSymbols( false );
- config.setDisplayGeneNames( false );
- config.setShowScale( true );
- config.setAddTaxonomyImagesCB( false );
- config.setBaseFontSize( 9 );
- config.setBaseFontFamilyName( "Arial" );
- Archaeopteryx.createApplication( phy, config, _infile_name );
- }
-
- private final void printMsaProperties( final String id, final MsaProperties msa_properties ) {