private JMenuItem _cycle_node_fill_mi;
private JMenuItem _choose_node_size_mi;
private JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
+ private JCheckBoxMenuItem _show_confidence_stddev_cbmi;
@Override
public void actionPerformed( final ActionEvent e ) {
else if ( o == _show_branch_length_values_cbmi ) {
updateOptions( getOptions() );
}
+ else if ( o == _show_confidence_stddev_cbmi ) {
+ updateOptions( getOptions() );
+ }
else if ( o == _label_direction_cbmi ) {
updateOptions( getOptions() );
}
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
- //
+ _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
+ _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
+ _options_jmenu
+ .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
+ _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_CONF_STDDEV_LABEL ) );
_options_jmenu
.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
_options_jmenu
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
_options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
_options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
- //
- _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
- _options_jmenu
- .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
- _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
_options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( MainFrame.LABEL_DIRECTION_LABEL ) );
_options_jmenu
.add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( MainFrame.COLOR_LABELS_LABEL ) );
customizeCheckBoxMenuItem( _show_overview_cbmi, getOptions().isShowOverview() );
customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
+ customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );
_jmenubar.add( _options_jmenu );
}
}
}
options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
+ options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )
+ && _show_confidence_stddev_cbmi.isSelected() );
if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
}
final static int show_vector_data = 23;
final static int show_taxonomy_images = 24;
final static int show_properties = 25;
- final static int write_confidence_values_sd = 26;
// ------------------
// Click-to options
// ------------------
{ "Taxonomy Common", "display", "no" }, { "Annotation Colorize", "nodisplay", "no" },
{ "Prot/Gene Symbol", "display", "yes" }, { "Rollover", "display", "yes" },
{ "Relation Confidence", "display", "no" }, { "Vector Data", "display", "no" },
- { "Taxonomy Images", "display", "no" }, { "Properties", "display", "no" },
- { "Confidence StdDev", "display", "no" } };
+ { "Taxonomy Images", "display", "no" }, { "Properties", "display", "no" } };
final static String clickto_options[][] = {
{ "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
{ "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree", "display" },
private JCheckBox _show_node_names;
private JCheckBox _show_taxo_code;
private JCheckBox _write_confidence;
- private JCheckBox _write_confidence_sd;
private JCheckBox _show_events;
private JCheckBox _color_acc_species;
private JCheckBox _color_branches_cb;
addJCheckBox( getWriteConfidenceCb(), ch_panel );
add( ch_panel );
break;
- case Configuration.write_confidence_values_sd:
- _write_confidence_sd = new JCheckBox( title );
- addJCheckBox( getWriteConfidenceSDCb(), ch_panel );
- add( ch_panel );
- break;
case Configuration.write_events:
_show_events = new JCheckBox( title );
addJCheckBox( getShowEventsCb(), ch_panel );
return _write_confidence;
}
- public JCheckBox getWriteConfidenceSDCb() {
- return _write_confidence_sd;
- }
-
private void init() {
_draw_phylogram = new ArrayList<Boolean>();
setSpeciesColors( new HashMap<String, Color>() );
return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
}
- boolean isShowConfidenceSDValues() {
- return ( ( getWriteConfidenceSDCb() != null ) && getWriteConfidenceSDCb().isSelected() );
- }
-
boolean isShowDomainArchitectures() {
return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
}
getWriteConfidenceCb().setSelected( state );
}
break;
- case Configuration.write_confidence_values_sd:
- if ( getWriteConfidenceSDCb() != null ) {
- getWriteConfidenceSDCb().setSelected( state );
- }
- break;
case Configuration.write_events:
if ( getShowEventsCb() != null ) {
getShowEventsCb().setSelected( state );
_configuration.getDisplayTitle( Configuration.write_confidence_values ) );
setCheckbox( Configuration.write_confidence_values,
_configuration.doCheckOption( Configuration.write_confidence_values ) );
- addCheckbox( Configuration.write_confidence_values_sd,
- _configuration.getDisplayTitle( Configuration.write_confidence_values_sd ) );
- setCheckbox( Configuration.write_confidence_values_sd,
- _configuration.doCheckOption( Configuration.write_confidence_values_sd ) );
}
if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
static final String SCREEN_ANTIALIAS_LABEL = "Antialias";
static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch";
static final String BG_GRAD_LABEL = "Background Color Gradient";
- static final String DISPLAY_NODE_BOXES_LABEL = "Display Node Shapes";
+ static final String DISPLAY_NODE_BOXES_LABEL = "Show Node Shapes";
static final String SHOW_OVERVIEW_LABEL = "Show Overview";
static final String FONT_SIZE_MENU_LABEL = "Font Size";
static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms";
static final String CYCLE_NODE_SHAPE_LABEL = "Cycle Node Shapes";
static final String CYCLE_NODE_FILL_LABEL = "Cycle Node Fill Type";
static final String CHOOSE_NODE_SIZE_LABEL = "Choose Node Shape Size";
+ static final String SHOW_CONF_STDDEV_LABEL = "Show Confidence Standard Deviations";
+ static final String USE_BRACKETS_FOR_CONF_IN_NH_LABEL = "Brackets for Confidences in NH/Nexus Output";
JMenuBar _jmenubar;
JMenu _file_jmenu;
JMenu _tools_menu;
JMenuItem _cycle_node_fill_mi;
JMenuItem _choose_node_size_mi;
JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
+ JCheckBoxMenuItem _show_confidence_stddev_cbmi;
// _ print
JCheckBoxMenuItem _graphics_export_visible_only_cbmi;
JCheckBoxMenuItem _antialias_print_cbmi;
JCheckBoxMenuItem _internal_number_are_confidence_for_nh_parsing_cbmi;
JCheckBoxMenuItem _extract_pfam_style_tax_codes_cbmi;
JCheckBoxMenuItem _replace_underscores_cbmi;
+ JCheckBoxMenuItem _use_brackets_for_conf_in_nh_export_cbmi;
// _ search
JCheckBoxMenuItem _search_case_senstive_cbmi;
JCheckBoxMenuItem _search_whole_words_only_cbmi;
else if ( o == _show_branch_length_values_cbmi ) {
updateOptions( getOptions() );
}
+ else if ( o == _show_confidence_stddev_cbmi ) {
+ updateOptions( getOptions() );
+ }
+ else if ( o == _use_brackets_for_conf_in_nh_export_cbmi ) {
+ updateOptions( getOptions() );
+ }
else if ( o == _label_direction_cbmi ) {
updateOptions( getOptions() );
}
}
}
options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
+ options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )
+ && _show_confidence_stddev_cbmi.isSelected() );
if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
}
options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )
&& ( _graphics_export_using_actual_size_cbmi.isSelected() ) );
options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );
+ options.setUseBracketsForConfInNhExport( ( _use_brackets_for_conf_in_nh_export_cbmi != null )
+ && _use_brackets_for_conf_in_nh_export_cbmi.isSelected() );
options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )
&& _print_black_and_white_cbmi.isSelected() );
options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
+ _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
+ _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
+ _options_jmenu
+ .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
+ _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) );
_options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL ) );
_options_jmenu
.add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
_options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
_options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
- _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
- _options_jmenu
- .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
- _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
_options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( LABEL_DIRECTION_LABEL ) );
_label_direction_cbmi.setToolTipText( LABEL_DIRECTION_TIP );
_options_jmenu.add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( COLOR_LABELS_LABEL ) );
getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
+ customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );
_jmenubar.add( _options_jmenu );
}
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
+ _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( SHOW_OVERVIEW_LABEL ) );
+ _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( DISPLAY_SCALE_LABEL ) );
+ _options_jmenu
+ .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
+ _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) );
_options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL ) );
_options_jmenu
.add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
_options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
_options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
- _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( DISPLAY_SCALE_LABEL ) );
- _options_jmenu
- .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
- _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( SHOW_OVERVIEW_LABEL ) );
_options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( LABEL_DIRECTION_LABEL ) );
_label_direction_cbmi.setToolTipText( LABEL_DIRECTION_TIP );
_options_jmenu.add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( COLOR_LABELS_LABEL ) );
_options_jmenu.add( _print_size_mi = new JMenuItem( "" ) );
_options_jmenu.add( _choose_pdf_width_mi = new JMenuItem( "" ) );
_options_jmenu.addSeparator();
- _options_jmenu
- .add( customizeMenuItemAsLabel( new JMenuItem( "Newick/NHX/Nexus Parsing:" ), getConfiguration() ) );
+ _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( "Newick/NHX/Nexus Input/Output:" ),
+ getConfiguration() ) );
_options_jmenu
.add( _internal_number_are_confidence_for_nh_parsing_cbmi = new JCheckBoxMenuItem( "Internal Numbers Are Confidence Values" ) );
_options_jmenu.add( _replace_underscores_cbmi = new JCheckBoxMenuItem( "Replace Underscores with Spaces" ) );
_options_jmenu
.add( _extract_pfam_style_tax_codes_cbmi = new JCheckBoxMenuItem( "Extract Taxonomy Codes from Pfam-style Labels" ) );
+ _options_jmenu
+ .add( _use_brackets_for_conf_in_nh_export_cbmi = new JCheckBoxMenuItem( USE_BRACKETS_FOR_CONF_IN_NH_LABEL ) );
customizeJMenuItem( _choose_font_mi );
customizeJMenuItem( _choose_minimal_confidence_mi );
customizeJMenuItem( _switch_colors_mi );
customizeCheckBoxMenuItem( _print_using_actual_size_cbmi, getOptions().isPrintUsingActualSize() );
customizeCheckBoxMenuItem( _graphics_export_using_actual_size_cbmi, getOptions()
.isGraphicsExportUsingActualSize() );
+ customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );
+ customizeCheckBoxMenuItem( _use_brackets_for_conf_in_nh_export_cbmi, getOptions()
+ .isUseBracketsForConfInNhExport() );
_jmenubar.add( _options_jmenu );
}
private boolean writeAsNewHampshire( final Phylogeny t, boolean exception, final File file ) {
try {
final PhylogenyWriter writer = new PhylogenyWriter();
- writer.toNewHampshire( t, false, true, file );
+ writer.toNewHampshire( t, false, true, getOptions().isUseBracketsForConfInNhExport(), file );
}
catch ( final Exception e ) {
exception = true;
private short _default_node_shape_size;
private boolean _taxonomy_colorize_node_shapes;
private boolean _show_default_node_shapes;
+ private boolean _show_confidence_stddev;
+ private boolean _use_brackets_for_conf_in_nh_export;
private Options() {
init();
_show_domain_labels = true;
setAbbreviateScientificTaxonNames( false );
_color_labels_same_as_parent_branch = false;
+ _show_confidence_stddev = true;
+ _use_brackets_for_conf_in_nh_export = false;
+ }
+
+ boolean isShowConfidenceStddev() {
+ return _show_confidence_stddev;
+ }
+
+ void setShowConfidenceStddev( final boolean show_confidence_stddev ) {
+ _show_confidence_stddev = show_confidence_stddev;
+ }
+
+ boolean isUseBracketsForConfInNhExport() {
+ return _use_brackets_for_conf_in_nh_export;
+ }
+
+ void setUseBracketsForConfInNhExport( final boolean use_brackets_for_conf_in_nh_export ) {
+ _use_brackets_for_conf_in_nh_export = use_brackets_for_conf_in_nh_export;
}
final boolean isAbbreviateScientificTaxonNames() {
final PhylogenyNode node,
final boolean to_pdf,
final boolean to_graphics_file ) {
- String conf_str = "";
final List<Confidence> confidences = node.getBranchData().getConfidences();
// if ( confidences.size() == 1 ) {
// final double value = node.getBranchData().getConfidence( 0 ).getValue();
boolean not_first = false;
Collections.sort( confidences );
final StringBuilder sb = new StringBuilder();
+ String conf_str = "";
for( final Confidence confidence : confidences ) {
final double value = confidence.getValue();
if ( value != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
}
sb.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( value, getOptions()
.getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
- if ( getControlPanel().isShowConfidenceSDValues() ) {
+ if ( getOptions().isShowConfidenceStddev() ) {
if ( confidence.getStandardDeviation() != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
sb.append( "(" );
sb.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( confidence.getStandardDeviation(),
public final static Pattern UC_LETTERS_NUMBERS_PATTERN = Pattern
.compile( "^[A-Z0-9]+$" );
public final static Pattern NUMBERS_ONLY_PATTERN = Pattern
- .compile( "^[0-9]+$" );
+ .compile( "^[0-9\\.]+$" );
public final static Pattern MB_PROB_PATTERN = Pattern
.compile( "prob=([^,]+)" );
public final static Pattern MB_PROB_SD_PATTERN = Pattern
private Stack<PostOrderStackObject> _stack;
private boolean _simple_nh;
private boolean _nh_write_distance_to_parent;
+ private boolean _write_conf_values_in_branckets_in_nh;
private boolean _indent_phyloxml;
private int _node_level;
private int _phyloxml_level;
public PhylogenyWriter() {
setIndentPhyloxml( INDENT_PHYLOXML_DEAFULT );
+ setWriteConfidenceValuesInBracketsInNH( false );
}
private void appendPhylogenyLevelPhyloXml( final Writer writer, final Phylogeny tree ) throws IOException {
public StringBuffer toNewHampshire( final Phylogeny tree,
final boolean simple_nh,
+ final boolean nh_write_distance_to_parent,
+ final boolean write_conf_values_in_branckets_in_nh ) throws IOException {
+ setOutputFormt( FORMAT.NH );
+ setWriteConfidenceValuesInBracketsInNH( write_conf_values_in_branckets_in_nh );
+ setSimpleNH( simple_nh );
+ setWriteDistanceToParentInNH( nh_write_distance_to_parent );
+ return getOutput( tree );
+ }
+
+ public StringBuffer toNewHampshire( final Phylogeny tree,
+ final boolean simple_nh,
final boolean nh_write_distance_to_parent ) throws IOException {
setOutputFormt( FORMAT.NH );
setSimpleNH( simple_nh );
writeToFile( toNewHampshire( tree, simple_nh, write_distance_to_parent ), out_file );
}
+ public void toNewHampshire( final Phylogeny tree,
+ final boolean simple_nh,
+ final boolean write_distance_to_parent,
+ final boolean use_brackets_for_confidence,
+ final File out_file ) throws IOException {
+ writeToFile( toNewHampshire( tree, simple_nh, write_distance_to_parent, use_brackets_for_confidence ), out_file );
+ }
+
public void toNewHampshire( final Phylogeny[] trees,
final boolean simple_nh,
final boolean write_distance_to_parent,
getBuffer().append( node.toNewHampshireX() );
}
else if ( getOutputFormt() == FORMAT.NH ) {
- getBuffer().append( node.toNewHampshire( isSimpleNH(), isWriteDistanceToParentInNH() ) );
+ getBuffer().append( node.toNewHampshire( isSimpleNH(),
+ isWriteDistanceToParentInNH(),
+ isWriteConfidenceValuesInBracketsInNH() ) );
}
}
+ private boolean isWriteConfidenceValuesInBracketsInNH() {
+ return _write_conf_values_in_branckets_in_nh;
+ }
+
+ private void setWriteConfidenceValuesInBracketsInNH( final boolean write_conf_values_in_branckets_in_nh ) {
+ _write_conf_values_in_branckets_in_nh = write_conf_values_in_branckets_in_nh;
+ }
+
private void writeOpenClade( final PhylogenyNode node ) throws IOException {
if ( !isSawComma() ) {
if ( !node.isRoot() && node.isFirstChildNode() ) {
import org.forester.io.parsers.nhx.NHXFormatException;
import org.forester.io.parsers.nhx.NHXParser;
import org.forester.phylogeny.data.BranchData;
+import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.NodeData;
import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.iterators.ChildNodeIteratorForward;
// ---------------------------------------------------------
// Writing of Nodes to Strings
// ---------------------------------------------------------
- final public String toNewHampshire( final boolean simple_nh, final boolean write_distance_to_parent ) {
+ final public String toNewHampshire( final boolean simple_nh,
+ final boolean write_distance_to_parent,
+ final boolean write_support_values_in_brackets ) {
final StringBuilder sb = new StringBuilder();
String data = "";
if ( !ForesterUtil.isEmpty( getName() ) ) {
sb.append( data );
}
}
- if ( ( getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) && write_distance_to_parent ) {
+ if ( write_distance_to_parent && ( getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) ) {
sb.append( ":" );
sb.append( getDistanceToParent() );
}
+ if ( write_support_values_in_brackets && !isExternal()
+ && ( getBranchData().getConfidence( 0 ).getValue() != Confidence.CONFIDENCE_DEFAULT_VALUE ) ) {
+ sb.append( "[" );
+ sb.append( getBranchData().getConfidence( 0 ).getValue() );
+ sb.append( "]" );
+ }
return sb.toString();
}