@Override public StringBuffer asSimpleText() { return new StringBuffer().append( ForesterUtil.FORMATTER_6.format( getValue() ) ); }
@Override public StringBuffer toNHX() { final StringBuffer sb = new StringBuffer(); sb.append( NHXtags.SUPPORT ); sb.append( FORMATTER.format( ForesterUtil.round( getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ) ); return sb; }
@Override public boolean isEqual( final PhylogenyData confidence ) { if ( confidence == null ) { return false; } if ( !( confidence instanceof Confidence ) ) { return false; } final Confidence s = ( Confidence ) confidence; if ( s.getValue() != getValue() ) { return false; } if ( !s.getType().equals( getType() ) ) { return false; } return true; }
@Override public StringBuffer toNHX() { final StringBuffer sb = new StringBuffer(); if ( isHasConfidences() && ( getConfidence( 0 ).getValue() != Confidence.CONFIDENCE_DEFAULT_VALUE ) ) { sb.append( ":" ); sb.append( getConfidence( 0 ).toNHX() ); } return sb; }
@Override public StringBuffer asText() { final StringBuffer sb = new StringBuffer(); if ( !ForesterUtil.isEmpty( getType() ) ) { sb.append( "[" ); sb.append( getType() ); sb.append( "] " ); } sb.append( ForesterUtil.FORMATTER_6.format( getValue() ) ); if ( getStandardDeviation() != CONFIDENCE_DEFAULT_VALUE ) { sb.append( " (sd=" ); sb.append( getStandardDeviation() ); sb.append( ")" ); } return sb; }
@Override public PhylogenyData copy() { return new Confidence( getValue(), getType(), getStandardDeviation() ); }
/** * Convenience method */ public static double getConfidenceValue( final PhylogenyNode node ) { if ( !node.getBranchData().isHasConfidences() ) { return Confidence.CONFIDENCE_DEFAULT_VALUE; } return node.getBranchData().getConfidence( 0 ).getValue(); }
@Override public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException { if ( getValue() == CONFIDENCE_DEFAULT_VALUE ) { return; } writer.write( ForesterUtil.LINE_SEPARATOR ); writer.write( indentation ); if ( getStandardDeviation() != CONFIDENCE_DEFAULT_VALUE ) { PhylogenyDataUtil .appendElement( writer, PhyloXmlMapping.CONFIDENCE, FORMATTER.format( ForesterUtil .round( getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ), PhyloXmlMapping.CONFIDENCE_TYPE_ATTR, ForesterUtil.isEmpty( getType() ) ? "unknown" : getType(), PhyloXmlMapping.CONFIDENCE_SD_ATTR, String.valueOf( ForesterUtil .round( getStandardDeviation(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ) ); } else { PhylogenyDataUtil .appendElement( writer, PhyloXmlMapping.CONFIDENCE, FORMATTER.format( ForesterUtil .round( getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ), PhyloXmlMapping.CONFIDENCE_TYPE_ATTR, ForesterUtil.isEmpty( getType() ) ? "unknown" : getType() ); } }
/** * Convenience method */ public static double[] getConfidenceValuesAsArray( final PhylogenyNode node ) { if ( !node.getBranchData().isHasConfidences() ) { return new double[ 0 ]; } final double[] values = new double[ node.getBranchData().getConfidences().size() ]; int i = 0; for( final Confidence c : node.getBranchData().getConfidences() ) { values[ i++ ] = c.getValue(); } return values; }
public static List<DescriptiveStatistics> calculateConfidenceStatistics( final Phylogeny phy ) { final List<DescriptiveStatistics> stats = new ArrayList<DescriptiveStatistics>(); for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) { final PhylogenyNode n = iter.next(); if ( !n.isExternal() && !n.isRoot() ) { if ( n.getBranchData().isHasConfidences() ) { for( int i = 0; i < n.getBranchData().getConfidences().size(); ++i ) { final Confidence c = n.getBranchData().getConfidences().get( i ); if ( ( i > ( stats.size() - 1 ) ) || ( stats.get( i ) == null ) ) { stats.add( i, new BasicDescriptiveStatistics() ); } if ( !ForesterUtil.isEmpty( c.getType() ) ) { if ( !ForesterUtil.isEmpty( stats.get( i ).getDescription() ) ) { if ( !stats.get( i ).getDescription().equalsIgnoreCase( c.getType() ) ) { throw new IllegalArgumentException( "support values in node [" + n.toString() + "] appear inconsistently ordered" ); } } stats.get( i ).setDescription( c.getType() ); } stats.get( i ).addValue( ( ( c != null ) && ( c.getValue() >= 0 ) ) ? c.getValue() : 0 ); } } } } return stats; }
if ( phylogeny_node.getBranchData().isHasConfidences() ) { for( int i = phylogeny_node.getBranchData().getConfidences().size() - 1; i >= 0; i-- ) { if ( phylogeny_node.getBranchData().getConfidences().get( i ).getValue() == Confidence.CONFIDENCE_DEFAULT_VALUE ) { phylogeny_node.getBranchData().getConfidences().remove( i ); addSubelementEditable( category, NodePanel.CONFIDENCE + " [" + counter + "]", ForesterUtil.FORMATTER_6.format( my_conf.getValue() ), PHYLOXML_TAG.CONFIDENCE_VALUE, NodePanel.CONFIDENCE_TYPE,
|| ( !ForesterUtil.isEmpty( confidence.getType() ) && confidence.getType() .equalsIgnoreCase( SHOW_ONLY_THIS_CONF_TYPE ) ) ) { final double value = confidence.getValue(); if ( value != Confidence.CONFIDENCE_DEFAULT_VALUE ) { if ( value < getOptions().getMinConfidenceValue() ) {
new NHXParser() ); ConfidenceAssessor.evaluate( "bootstrap", ev0, t0, false, 1, 0, 2 ); if ( !isEqual( t0.getNode( "ab" ).getBranchData().getConfidence( 0 ).getValue(), 3 ) ) { return false; if ( !isEqual( t0.getNode( "abc" ).getBranchData().getConfidence( 0 ).getValue(), 3 ) ) { return false; new NHXParser() ); ConfidenceAssessor.evaluate( "bootstrap", ev1, t1, false, 1 ); if ( !isEqual( t1.getNode( "ab" ).getBranchData().getConfidence( 1 ).getValue(), 7 ) ) { return false; if ( !isEqual( t1.getNode( "abc" ).getBranchData().getConfidence( 0 ).getValue(), 7 ) ) { return false; new NHXParser() ); ConfidenceAssessor.evaluate( "bootstrap", ev_b, t_b, false, 1 ); if ( !isEqual( t_b.getNode( "ac" ).getBranchData().getConfidence( 0 ).getValue(), 4 ) ) { return false; if ( !isEqual( t_b.getNode( "acd" ).getBranchData().getConfidence( 0 ).getValue(), 1 ) ) { return false; new NHXParser() ); ConfidenceAssessor.evaluate( "bootstrap", ev1x, t1x, true, 1 ); if ( !isEqual( t1x.getNode( "ab" ).getBranchData().getConfidence( 0 ).getValue(), 7 ) ) { return false;
if ( ( svs == NH_CONVERSION_SUPPORT_VALUE_STYLE.AS_INTERNAL_NODE_NAMES ) && !isExternal() ) { if ( getBranchData().isHasConfidences() && ( getBranchData().getConfidence( 0 ).getValue() != Confidence.CONFIDENCE_DEFAULT_VALUE ) ) { data = Confidence.FORMATTER.format( ForesterUtil .round( getBranchData().getConfidence( 0 ).getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ); && ( getBranchData().getConfidence( 0 ).getValue() != Confidence.CONFIDENCE_DEFAULT_VALUE ) ) { sb.append( "[" ); sb.append( Confidence.FORMATTER.format( ForesterUtil .round( getBranchData().getConfidence( 0 ).getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ) ); sb.append( "]" );
final double linePosX = node.getXcoord() + 2 + half_box_size; final String sConfidence = ( !getControlPanel().isShowSequenceRelationConfidence() || ( seqRelation .getConfidence() == null ) ) ? null : " (" + seqRelation.getConfidence().getValue() + ")"; if ( sConfidence != null ) {
final Confidence c = ConfidenceAssessor.obtainConfidence( node, confidence_type ); if ( s.match( ex_descs ) ) { c.setValue( c.getValue() + value );
t2.reRoot( t2.getNode( "ABC" ) ); t2.reRoot( t2.getNode( "D" ) ); if ( !isEqual( t2.getNode( "AB" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false; if ( !isEqual( t2.getNode( "ABC" ).getBranchData().getConfidence( 0 ).getValue(), 33 ) ) { return false; if ( !isEqual( t2.getNode( "AB" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false; if ( !isEqual( t2.getNode( "ABC" ).getBranchData().getConfidence( 0 ).getValue(), 33 ) ) { return false; if ( !isEqual( t2.getNode( "AB" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false; if ( !isEqual( t2.getNode( "ABC" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false; if ( !isEqual( t2.getNode( "D" ).getBranchData().getConfidence( 0 ).getValue(), 33 ) ) { return false; if ( !isEqual( t2.getNode( "AB" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false; if ( !isEqual( t2.getNode( "ABC" ).getBranchData().getConfidence( 0 ).getValue(), 55 ) ) { return false;