From: cmzmasek@gmail.com Date: Thu, 15 Dec 2011 21:17:37 +0000 (+0000) Subject: in progress X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=89d7b6ec1ddc3a3c1e953cf389c24ba7aae7fbfe;p=jalview.git in progress --- diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java index a24176c..d190da0 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java @@ -117,6 +117,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { 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 ) { @@ -236,6 +237,9 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { 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() ); } @@ -442,7 +446,11 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { _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 @@ -450,11 +458,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { _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 ) ); @@ -506,6 +509,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { 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 ); } @@ -1018,6 +1022,8 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { } } 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() ); } diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index 0b8b7fc..c715858 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -122,7 +122,6 @@ public final class Configuration { 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 // ------------------ @@ -162,8 +161,7 @@ public final class Configuration { { "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" }, diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index 8a15e5a..471ca78 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -87,7 +87,6 @@ final class ControlPanel extends JPanel implements ActionListener { 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; @@ -438,11 +437,6 @@ final class ControlPanel extends JPanel implements ActionListener { 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 ); @@ -762,10 +756,6 @@ final class ControlPanel extends JPanel implements ActionListener { return _write_confidence; } - public JCheckBox getWriteConfidenceSDCb() { - return _write_confidence_sd; - } - private void init() { _draw_phylogram = new ArrayList(); setSpeciesColors( new HashMap() ); @@ -824,10 +814,6 @@ final class ControlPanel extends JPanel implements ActionListener { return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() ); } - boolean isShowConfidenceSDValues() { - return ( ( getWriteConfidenceSDCb() != null ) && getWriteConfidenceSDCb().isSelected() ); - } - boolean isShowDomainArchitectures() { return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() ); } @@ -1054,11 +1040,6 @@ final class ControlPanel extends JPanel implements ActionListener { 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 ); @@ -1603,10 +1584,6 @@ final class ControlPanel extends JPanel implements ActionListener { _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 ) ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index 0410fed..89dd29b 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -85,7 +85,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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"; @@ -96,6 +96,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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; @@ -156,6 +158,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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; @@ -168,6 +171,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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; @@ -381,6 +385,12 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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() ); } @@ -956,6 +966,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } 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() ); } @@ -964,6 +976,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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 ) diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java index cf9a672..b056ac8 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java @@ -180,16 +180,17 @@ public final class MainFrameApplet extends MainFrame { _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 ) ); @@ -239,6 +240,7 @@ public final class MainFrameApplet extends MainFrame { 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 ); } diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 5053d83..efbd7ae 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -784,16 +784,17 @@ public final class MainFrameApplication extends MainFrame { _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 ) ); @@ -827,13 +828,15 @@ public final class MainFrameApplication extends MainFrame { _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 ); @@ -875,6 +878,9 @@ public final class MainFrameApplication extends MainFrame { 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 ); } @@ -2312,7 +2318,7 @@ public final class MainFrameApplication extends MainFrame { 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; diff --git a/forester/java/src/org/forester/archaeopteryx/Options.java b/forester/java/src/org/forester/archaeopteryx/Options.java index 594c9ab..80be186 100644 --- a/forester/java/src/org/forester/archaeopteryx/Options.java +++ b/forester/java/src/org/forester/archaeopteryx/Options.java @@ -75,6 +75,8 @@ final public class Options { 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(); @@ -184,6 +186,24 @@ final public class Options { _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() { diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 0ca4955..c69971a 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -2705,7 +2705,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final PhylogenyNode node, final boolean to_pdf, final boolean to_graphics_file ) { - String conf_str = ""; final List confidences = node.getBranchData().getConfidences(); // if ( confidences.size() == 1 ) { // final double value = node.getBranchData().getConfidence( 0 ).getValue(); @@ -2719,6 +2718,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee 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 ) { @@ -2733,7 +2733,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } 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(), diff --git a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java index 8dba277..7725ee5 100644 --- a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java +++ b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java @@ -87,7 +87,7 @@ public final class NHXParser implements PhylogenyParser { 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 diff --git a/forester/java/src/org/forester/io/writers/PhylogenyWriter.java b/forester/java/src/org/forester/io/writers/PhylogenyWriter.java index c443842..be4c24e 100644 --- a/forester/java/src/org/forester/io/writers/PhylogenyWriter.java +++ b/forester/java/src/org/forester/io/writers/PhylogenyWriter.java @@ -73,6 +73,7 @@ public final class PhylogenyWriter { private Stack _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; @@ -80,6 +81,7 @@ public final class PhylogenyWriter { public PhylogenyWriter() { setIndentPhyloxml( INDENT_PHYLOXML_DEAFULT ); + setWriteConfidenceValuesInBracketsInNH( false ); } private void appendPhylogenyLevelPhyloXml( final Writer writer, final Phylogeny tree ) throws IOException { @@ -336,6 +338,17 @@ public final class PhylogenyWriter { 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 ); @@ -350,6 +363,14 @@ public final class PhylogenyWriter { 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, @@ -556,10 +577,20 @@ public final class PhylogenyWriter { 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() ) { diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java index 58ac6c7..a65de7c 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java @@ -33,6 +33,7 @@ import java.util.List; 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; @@ -922,7 +923,9 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable // --------------------------------------------------------- // 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() ) ) { @@ -961,10 +964,16 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable 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(); }