if ( sd >= 0.0 ) { node_to_annotate.getBranchData() .addConfidence( new Confidence( prob, "posterior probability", sd ) ); node_to_annotate.getBranchData().addConfidence( new Confidence( prob, "posterior probability" ) );
private static void transferInternalNodeNameToConfidence( final String confidence_type, final PhylogenyNode n ) { if ( !n.isExternal() && !n.getBranchData().isHasConfidences() ) { if ( !ForesterUtil.isEmpty( n.getName() ) ) { double d = -1.0; try { d = Double.parseDouble( n.getName() ); } catch ( final Exception e ) { d = -1.0; } if ( d >= 0.0 ) { n.getBranchData().addConfidence( new Confidence( d, confidence_type ) ); n.setName( "" ); } } } }
final static public void transferInternalNamesToBootstrapSupport( final Phylogeny phy ) { final PhylogenyNodeIterator it = phy.iteratorPostorder(); while ( it.hasNext() ) { final PhylogenyNode n = it.next(); if ( !n.isExternal() && !ForesterUtil.isEmpty( n.getName() ) ) { double value = -1; try { value = Double.parseDouble( n.getName() ); } catch ( final NumberFormatException e ) { throw new IllegalArgumentException( "failed to parse number from [" + n.getName() + "]: " + e.getLocalizedMessage() ); } if ( value >= 0.0 ) { n.getBranchData().addConfidence( new Confidence( value, "bootstrap" ) ); n.setName( "" ); } } } }
/** * Convenience method. * Sets value for the first confidence value (created if not present, values overwritten otherwise). */ public static void setConfidence( final PhylogenyNode node, final double confidence_value, final String type ) { Confidence c = null; if ( node.getBranchData().getNumberOfConfidences() > 0 ) { c = node.getBranchData().getConfidence( 0 ); } else { c = new Confidence(); node.getBranchData().addConfidence( c ); } c.setType( type ); c.setValue( confidence_value ); }
@Override public PhylogenyData copy() { final BranchData new_bd = new BranchData(); if ( isHasBranchColor() ) { new_bd.setBranchColor( ( BranchColor ) getBranchColor().copy() ); } if ( isHasBranchWidth() ) { new_bd.setBranchWidth( ( BranchWidth ) getBranchWidth().copy() ); } if ( isHasConfidences() ) { for( final Confidence confidence : getConfidences() ) { new_bd.addConfidence( ( Confidence ) confidence.copy() ); } } return new_bd; }
node.getBranchData().addConfidence( ( Confidence ) ConfidenceParser.getInstance().parse( element ) );