mb parsing
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 15 Dec 2011 06:01:18 +0000 (06:01 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 15 Dec 2011 06:01:18 +0000 (06:01 +0000)
18 files changed:
forester/java/src/org/forester/application/support_transfer.java
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/Constants.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java
forester/java/src/org/forester/archaeopteryx/NodePanel.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/io/parsers/nhx/NHXParser.java
forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlHandler.java
forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlMapping.java
forester/java/src/org/forester/io/parsers/phyloxml/data/ConfidenceParser.java
forester/java/src/org/forester/io/writers/PhyloXmlNodeWriter.java
forester/java/src/org/forester/phylogeny/Phylogeny.java
forester/java/src/org/forester/phylogeny/PhylogenyMethods.java
forester/java/src/org/forester/phylogeny/PhylogenyNode.java
forester/java/src/org/forester/phylogeny/data/Confidence.java
forester/java/src/org/forester/phylogeny/data/PhylogenyDataUtil.java
forester/java/src/org/forester/test/Test.java

index 82817e9..5eecf55 100644 (file)
@@ -37,6 +37,7 @@ import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Confidence;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
 import org.forester.phylogeny.factories.PhylogenyFactory;
 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
@@ -137,7 +138,7 @@ public final class support_transfer {
             else {
                 PhylogenyMethods.setBootstrapConfidence( node, Confidence.CONFIDENCE_DEFAULT_VALUE );
             }
-            node.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+            node.setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
         }
     } // moveBranchLengthsToBootstrap()
 
index e7c0c2c..0b8b7fc 100644 (file)
@@ -122,6 +122,7 @@ 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
     // ------------------
@@ -151,7 +152,7 @@ public final class Configuration {
     String                                  default_config_filename                                = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
     final static String                     display_options[][]                                    = {
             { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
-            { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" },
+            { "Annotation", "nodisplay", "no" }, { "Confidence Values", "display", "?" }, { "Event", "display", "?" },
             { "Taxonomy Colorize", "display", "no" }, { "Colorize Branches", "display", "no" },
             { "Use Branch-Widths", "display", "no" }, { "Show Custom Nodes", "display", "yes" },
             { "Domains", "nodisplay", "no" }, { "Binary Characters", "nodisplay", "no" },
@@ -161,7 +162,8 @@ 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" }             };
+            { "Taxonomy Images", "display", "no" }, { "Properties", "display", "no" },
+            { "Confidence StdDev", "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" },
index e638abf..fd4b353 100644 (file)
@@ -41,8 +41,8 @@ public final class Constants {
     public final static boolean __SNAPSHOT_RELEASE                                            = true;                                                     // TODO remove me
     public final static boolean __SYNTH_LF                                                    = false;                                                    // TODO remove me
     public final static String  PRG_NAME                                                      = "Archaeopteryx";
-    final static String         VERSION                                                       = "0.964 beta BG";
-    final static String         PRG_DATE                                                      = "2011.12.08";
+    final static String         VERSION                                                       = "0.965 beta T2P";
+    final static String         PRG_DATE                                                      = "2011.12.14";
     final static String         DEFAULT_CONFIGURATION_FILE_NAME                               = "_aptx_configuration_file";
     final static String[]       DEFAULT_FONT_CHOICES                                          = { "Verdana", "Tahoma",
             "Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
index 4945ec2..8a15e5a 100644 (file)
@@ -87,6 +87,7 @@ 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;
@@ -437,6 +438,11 @@ 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 );
@@ -756,6 +762,10 @@ final class ControlPanel extends JPanel implements ActionListener {
         return _write_confidence;
     }
 
+    public JCheckBox getWriteConfidenceSDCb() {
+        return _write_confidence_sd;
+    }
+
     private void init() {
         _draw_phylogram = new ArrayList<Boolean>();
         setSpeciesColors( new HashMap<String, Color>() );
@@ -810,10 +820,14 @@ final class ControlPanel extends JPanel implements ActionListener {
         return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
     }
 
-    boolean isShowBootstrapValues() {
+    boolean isShowConfidenceValues() {
         return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
     }
 
+    boolean isShowConfidenceSDValues() {
+        return ( ( getWriteConfidenceSDCb() != null ) && getWriteConfidenceSDCb().isSelected() );
+    }
+
     boolean isShowDomainArchitectures() {
         return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
     }
@@ -1040,6 +1054,11 @@ 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 );
@@ -1584,6 +1603,10 @@ 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 ) );
index ee5fda2..a7eb07d 100644 (file)
@@ -60,6 +60,7 @@ import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.Identifier;
 import org.forester.phylogeny.data.MultipleUris;
 import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.Point;
 import org.forester.phylogeny.data.Reference;
 import org.forester.phylogeny.data.Sequence;
@@ -153,7 +154,7 @@ class NodeEditPanel extends JPanel {
         top.add( category );
         addSubelementEditable( category, NodePanel.NODE_NAME, phylogeny_node.getName(), PHYLOXML_TAG.NODE_NAME );
         String bl = "";
-        if ( phylogeny_node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+        if ( phylogeny_node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
             bl = ForesterUtil.FORMATTER_6.format( phylogeny_node.getDistanceToParent() );
         }
         addSubelementEditable( category, NodePanel.NODE_BRANCH_LENGTH, bl, PHYLOXML_TAG.NODE_BRANCH_LENGTH );
@@ -651,7 +652,7 @@ class NodeEditPanel extends JPanel {
                 break;
             case NODE_BRANCH_LENGTH:
                 if ( ForesterUtil.isEmpty( value ) ) {
-                    getMyNode().setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+                    getMyNode().setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
                 }
                 else {
                     try {
@@ -713,7 +714,8 @@ class NodeEditPanel extends JPanel {
                 }
                 else {
                     final String type = getMyNode().getBranchData().getConfidences().get( number ).getType();
-                    getMyNode().getBranchData().getConfidences().set( number, new Confidence( confidence, type ) );
+                    final double sd = getMyNode().getBranchData().getConfidences().get( number ).getStandardDeviation();
+                    getMyNode().getBranchData().getConfidences().set( number, new Confidence( confidence, type, sd ) );
                 }
                 break;
             case CONFIDENCE_TYPE:
@@ -727,7 +729,8 @@ class NodeEditPanel extends JPanel {
                 }
                 else {
                     final double v = getMyNode().getBranchData().getConfidences().get( number ).getValue();
-                    getMyNode().getBranchData().getConfidences().set( number, new Confidence( v, value ) );
+                    final double sd = getMyNode().getBranchData().getConfidences().get( number ).getStandardDeviation();
+                    getMyNode().getBranchData().getConfidences().set( number, new Confidence( v, value, sd ) );
                 }
                 break;
             case TAXONOMY_CODE:
index 37810c6..c7a9ce8 100644 (file)
@@ -50,6 +50,7 @@ import org.forester.phylogeny.data.Date;
 import org.forester.phylogeny.data.Distribution;
 import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.Point;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
@@ -237,7 +238,7 @@ class NodePanel extends JPanel implements TreeSelectionListener {
         final DefaultMutableTreeNode category = new DefaultMutableTreeNode( name );
         top.add( category );
         addSubelement( category, NODE_NAME, phylogeny_node.getName() );
-        if ( phylogeny_node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+        if ( phylogeny_node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
             addSubelement( category,
                            NODE_BRANCH_LENGTH,
                            ForesterUtil.FORMATTER_6.format( phylogeny_node.getDistanceToParent() ) );
index 6afa7a7..0ca4955 100644 (file)
@@ -109,6 +109,7 @@ import org.forester.phylogeny.data.NodeVisualization;
 import org.forester.phylogeny.data.NodeVisualization.NodeFill;
 import org.forester.phylogeny.data.NodeVisualization.NodeShape;
 import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
 import org.forester.phylogeny.data.Sequence;
@@ -2706,34 +2707,43 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                                               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();
-            if ( ( value == Confidence.CONFIDENCE_DEFAULT_VALUE ) || ( value < getOptions().getMinConfidenceValue() ) ) {
-                return;
-            }
-            conf_str = FORMATTER_CONFIDENCE.format( value );
-        }
-        else if ( confidences.size() > 1 ) {
-            boolean one_ok = false;
-            boolean not_first = false;
-            Collections.sort( confidences );
-            final StringBuilder sb = new StringBuilder();
-            for( final Confidence confidence : confidences ) {
-                final double value = confidence.getValue();
-                if ( value != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
-                    if ( value >= getOptions().getMinConfidenceValue() ) {
-                        one_ok = true;
-                    }
-                    if ( not_first ) {
-                        sb.append( "/" );
-                    }
-                    else {
-                        not_first = true;
+        //        if ( confidences.size() == 1 ) {
+        //            final double value = node.getBranchData().getConfidence( 0 ).getValue();
+        //            if ( ( value == Confidence.CONFIDENCE_DEFAULT_VALUE ) || ( value < getOptions().getMinConfidenceValue() ) ) {
+        //                return;
+        //            }
+        //            conf_str = FORMATTER_CONFIDENCE.format( value );
+        //        }
+        //        else if ( confidences.size() > 1 ) {
+        boolean one_ok = false;
+        boolean not_first = false;
+        Collections.sort( confidences );
+        final StringBuilder sb = new StringBuilder();
+        for( final Confidence confidence : confidences ) {
+            final double value = confidence.getValue();
+            if ( value != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
+                if ( value >= getOptions().getMinConfidenceValue() ) {
+                    one_ok = true;
+                }
+                if ( not_first ) {
+                    sb.append( "/" );
+                }
+                else {
+                    not_first = true;
+                }
+                sb.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( value, getOptions()
+                        .getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
+                if ( getControlPanel().isShowConfidenceSDValues() ) {
+                    if ( confidence.getStandardDeviation() != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
+                        sb.append( "(" );
+                        sb.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( confidence.getStandardDeviation(),
+                                                                                    getOptions()
+                                                                                            .getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
+                        sb.append( ")" );
                     }
-                    sb.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( value, getOptions()
-                            .getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
                 }
             }
+            //}
             if ( one_ok ) {
                 conf_str = sb.toString();
             }
@@ -2927,7 +2937,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         if ( getOptions().isShowBranchLengthValues()
                 && ( ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR )
                         || ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.ROUNDED ) || ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) )
-                && ( !node.isRoot() ) && ( node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) ) {
+                && ( !node.isRoot() ) && ( node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) ) {
             paintBranchLength( g, node, to_pdf, to_graphics_file );
         }
         if ( !getControlPanel().isShowInternalData() && !node.isExternal() && !node.isCollapse() ) {
@@ -3434,7 +3444,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             ++_external_node_index;
         }
         // Confidence values
-        if ( getControlPanel().isShowBootstrapValues()
+        if ( getControlPanel().isShowConfidenceValues()
                 && !node.isExternal()
                 && !node.isRoot()
                 && ( ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.ROUNDED )
@@ -4737,6 +4747,13 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                                 .append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( confidence.getValue(),
                                                                                           getOptions()
                                                                                                   .getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
+                        if ( confidence.getStandardDeviation() != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
+                            _popup_buffer.append( " (sd=" );
+                            _popup_buffer.append( FORMATTER_CONFIDENCE.format( ForesterUtil.round( confidence
+                                    .getStandardDeviation(), getOptions()
+                                    .getNumberOfDigitsAfterCommaForConfidenceValues() ) ) );
+                            _popup_buffer.append( ")" );
+                        }
                     }
                 }
                 if ( node.getNodeData().isHasProperties() ) {
index e227fee..8dba277 100644 (file)
@@ -46,9 +46,11 @@ import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Accession;
 import org.forester.phylogeny.data.Annotation;
+import org.forester.phylogeny.data.Confidence;
 import org.forester.phylogeny.data.DomainArchitecture;
 import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.Identifier;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
 import org.forester.phylogeny.data.Sequence;
@@ -86,6 +88,12 @@ public final class NHXParser implements PhylogenyParser {
                                                                                                        .compile( "^[A-Z0-9]+$" );
     public final static Pattern                              NUMBERS_ONLY_PATTERN              = Pattern
                                                                                                        .compile( "^[0-9]+$" );
+    public final static Pattern                              MB_PROB_PATTERN                   = Pattern
+                                                                                                       .compile( "prob=([^,]+)" );
+    public final static Pattern                              MB_PROB_SD_PATTERN                = Pattern
+                                                                                                       .compile( "prob_stddev=([^,]+)" );
+    public final static Pattern                              MB_BL_PATTERN                     = Pattern
+                                                                                                       .compile( "length_median=([^,]+)" );
 
     public NHXParser() {
         init();
@@ -301,7 +309,7 @@ public final class NHXParser implements PhylogenyParser {
                     saw_colon = false;
                 }
             }
-            if ( in_open_bracket && c == ']' ) {
+            if ( in_open_bracket && ( c == ']' ) ) {
                 in_open_bracket = false;
             }
             // \n\t is always ignored,
@@ -361,13 +369,13 @@ public final class NHXParser implements PhylogenyParser {
                 // comment consisting just of "[]":
                 saw_open_bracket = false;
             }
-            else if ( c == '(' && !in_open_bracket ) {
+            else if ( ( c == '(' ) && !in_open_bracket ) {
                 processOpenParen();
             }
-            else if ( c == ')' && !in_open_bracket ) {
+            else if ( ( c == ')' ) && !in_open_bracket ) {
                 processCloseParen();
             }
-            else if ( c == ',' && !in_open_bracket ) {
+            else if ( ( c == ',' ) && !in_open_bracket ) {
                 processComma();
             }
             else {
@@ -628,7 +636,7 @@ public final class NHXParser implements PhylogenyParser {
         while ( it.hasNext() ) {
             final PhylogenyNode n = it.next();
             PhylogenyMethods.setBootstrapConfidence( n, n.getDistanceToParent() );
-            n.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+            n.setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
         }
     }
 
@@ -636,8 +644,6 @@ public final class NHXParser implements PhylogenyParser {
                                  final PhylogenyNode node_to_annotate,
                                  final PhylogenyMethods.TAXONOMY_EXTRACTION taxonomy_extraction,
                                  final boolean replace_underscores ) throws NHXFormatException {
-        System.out.println( s );
-        System.out.println();
         if ( ( taxonomy_extraction != PhylogenyMethods.TAXONOMY_EXTRACTION.NO ) && replace_underscores ) {
             throw new IllegalArgumentException( "cannot extract taxonomies and replace under scores at the same time" );
         }
@@ -645,18 +651,12 @@ public final class NHXParser implements PhylogenyParser {
             if ( replace_underscores ) {
                 s = s.replaceAll( "_+", " " );
             }
-            int ob = 0;
-            int cb = 0;
-            String a = "";
-            String b = "";
-            StringTokenizer t = null;
             boolean is_nhx = false;
-            ob = s.indexOf( "[" );
-            cb = s.indexOf( "]" );
+            final int ob = s.indexOf( "[" );
             if ( ob > -1 ) {
-                a = "";
-                b = "";
+                String b = "";
                 is_nhx = true;
+                final int cb = s.indexOf( "]" );
                 if ( cb < 0 ) {
                     throw new NHXFormatException( "error in NHX formatted data: no closing \"]\" in \"" + s + "\"" );
                 }
@@ -670,14 +670,16 @@ public final class NHXParser implements PhylogenyParser {
                     if ( numbers_only.matches() ) {
                         b = ":" + NHXtags.SUPPORT + bracketed;
                     }
+                    else if ( s.indexOf( "prob=" ) > -1 ) {
+                        processMrBayes3Data( s, node_to_annotate );
+                    }
                 }
-                a = s.substring( 0, ob );
-                s = a + b;
+                s = s.substring( 0, ob ) + b;
                 if ( ( s.indexOf( "[" ) > -1 ) || ( s.indexOf( "]" ) > -1 ) ) {
                     throw new NHXFormatException( "error in NHX formatted data: more than one \"]\" or \"[\"" );
                 }
             }
-            t = new StringTokenizer( s, ":" );
+            final StringTokenizer t = new StringTokenizer( s, ":" );
             if ( t.countTokens() > 0 ) {
                 if ( !s.startsWith( ":" ) ) {
                     node_to_annotate.setName( t.nextToken() );
@@ -697,8 +699,6 @@ public final class NHXParser implements PhylogenyParser {
                 }
                 while ( t.hasMoreTokens() ) {
                     s = t.nextToken();
-                    System.out.println( "=>" + s );
-                    System.out.println();
                     if ( s.startsWith( org.forester.io.parsers.nhx.NHXtags.SPECIES_NAME ) ) {
                         if ( !node_to_annotate.getNodeData().isHasTaxonomy() ) {
                             node_to_annotate.getNodeData().setTaxonomy( new Taxonomy() );
@@ -781,7 +781,7 @@ public final class NHXParser implements PhylogenyParser {
                         node_to_annotate.getNodeData().getSequence().setName( s.substring( 2 ) );
                     }
                     else if ( s.indexOf( '=' ) < 0 ) {
-                        if ( node_to_annotate.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+                        if ( node_to_annotate.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                             throw new NHXFormatException( "error in NHX formatted data: more than one distance to parent:"
                                     + "\"" + s + "\"" );
                         }
@@ -792,6 +792,54 @@ public final class NHXParser implements PhylogenyParser {
         }
     }
 
+    private static void processMrBayes3Data( final String s, final PhylogenyNode node_to_annotate )
+            throws NHXFormatException {
+        double sd = -1;
+        final Matcher mb_prob_sd_matcher = MB_PROB_SD_PATTERN.matcher( s );
+        if ( mb_prob_sd_matcher.find() ) {
+            try {
+                sd = Double.parseDouble( mb_prob_sd_matcher.group( 1 ) );
+            }
+            catch ( final NumberFormatException e ) {
+                throw new NHXFormatException( "failed to parse probability standard deviation (Mr Bayes output) from \""
+                        + s + "\"" );
+            }
+        }
+        final Matcher mb_prob_matcher = MB_PROB_PATTERN.matcher( s );
+        if ( mb_prob_matcher.find() ) {
+            double prob = -1;
+            try {
+                prob = Double.parseDouble( mb_prob_matcher.group( 1 ) );
+            }
+            catch ( final NumberFormatException e ) {
+                throw new NHXFormatException( "failed to parse probability (Mr Bayes output) from \"" + s + "\"" );
+            }
+            if ( prob >= 0.0 ) {
+                if ( sd >= 0.0 ) {
+                    node_to_annotate.getBranchData()
+                            .addConfidence( new Confidence( prob, "posterior probability", sd ) );
+                }
+                else {
+                    node_to_annotate.getBranchData().addConfidence( new Confidence( prob, "posterior probability" ) );
+                }
+            }
+        }
+        final Matcher mb_bl_matcher = MB_BL_PATTERN.matcher( s );
+        if ( mb_bl_matcher.find() ) {
+            double bl = -1;
+            try {
+                bl = Double.parseDouble( mb_bl_matcher.group( 1 ) );
+            }
+            catch ( final NumberFormatException e ) {
+                throw new NHXFormatException( "failed to parse median branch length (Mr Bayes output) from \"" + s
+                        + "\"" );
+            }
+            if ( bl >= 0.0 ) {
+                node_to_annotate.setDistanceToParent( bl );
+            }
+        }
+    }
+
     /**
      * Parses String s in the format r.g.b (e.g. "12.34.234" ) into red, green,
      * and blue and returns the corresponding Color.
index a044239..851398a 100644 (file)
@@ -55,6 +55,7 @@ import org.forester.phylogeny.data.Date;
 import org.forester.phylogeny.data.Distribution;
 import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.Identifier;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
 import org.forester.phylogeny.data.Reference;
@@ -260,7 +261,7 @@ public final class PhyloXmlHandler extends DefaultHandler {
             final XmlElement element = xml_element.getChildElement( i );
             final String qualified_name = element.getQualifiedName();
             if ( qualified_name.equals( PhyloXmlMapping.BRANCH_LENGTH ) ) {
-                if ( node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+                if ( node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                     throw new PhylogenyParserException( "ill advised attempt to set distance twice for the same clade (probably via element and via attribute)" );
                 }
                 node.setDistanceToParent( element.getValueAsDouble() );
index 7e2747d..2a8d971 100644 (file)
@@ -73,6 +73,7 @@ public final class PhyloXmlMapping {
     public static final String BINARY_CHARACTERS_LOST_COUNT_ATTR                   = "lost_count";
     public static final String BRANCH_LENGTH                                       = "branch_length";
     public static final String CONFIDENCE                                          = "confidence";
+    public static final String CONFIDENCE_SD_ATTR                                  = "stddev";
     public static final String CONFIDENCE_TYPE_ATTR                                = "type";
     public static final String COLOR                                               = "color";
     public static final String COLOR_RED                                           = "red";
index c18d524..bf34183 100644 (file)
@@ -53,6 +53,16 @@ public class ConfidenceParser implements PhylogenyDataPhyloXmlParser {
         if ( element.isHasAttribute( PhyloXmlMapping.CONFIDENCE_TYPE_ATTR ) ) {
             confidence.setType( element.getAttribute( PhyloXmlMapping.CONFIDENCE_TYPE_ATTR ) );
         }
+        if ( element.isHasAttribute( PhyloXmlMapping.CONFIDENCE_SD_ATTR ) ) {
+            try {
+                confidence.setStandardDeviation( Double.parseDouble( element
+                        .getAttribute( PhyloXmlMapping.CONFIDENCE_SD_ATTR ) ) );
+            }
+            catch ( final NumberFormatException ex ) {
+                throw new PhylogenyParserException( "attempt to parse ["
+                        + element.getAttribute( PhyloXmlMapping.CONFIDENCE_SD_ATTR + "] into double" ) );
+            }
+        }
         return confidence;
     }
 
index 1c11cb0..5860cac 100644 (file)
@@ -45,7 +45,7 @@ public class PhyloXmlNodeWriter {
         if ( !ForesterUtil.isEmpty( node.getName() ) ) {
             PhylogenyDataUtil.appendElement( w, PhyloXmlMapping.NODE_NAME, node.getName(), indentation );
         }
-        if ( node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+        if ( node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
             PhylogenyDataUtil.appendElement( w, PhyloXmlMapping.BRANCH_LENGTH, String.valueOf( ForesterUtil.round( node
                     .getDistanceToParent(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ), indentation );
         }
index 9560dfa..06058ed 100644 (file)
@@ -42,6 +42,7 @@ import org.forester.io.writers.PhylogenyWriter;
 import org.forester.phylogeny.data.BranchData;
 import org.forester.phylogeny.data.Confidence;
 import org.forester.phylogeny.data.Identifier;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.SequenceRelation;
 import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
@@ -111,7 +112,7 @@ public class Phylogeny {
         new_node.setParent( sibling_parent );
         sibling.setParent( new_node );
         sibling_parent.setChildNode( sibling_index, new_node );
-        final double new_dist = sibling.getDistanceToParent() == PhylogenyNode.DISTANCE_DEFAULT ? PhylogenyNode.DISTANCE_DEFAULT
+        final double new_dist = sibling.getDistanceToParent() == PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ? PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT
                 : sibling.getDistanceToParent() / 2;
         new_node.setDistanceToParent( new_dist );
         sibling.setDistanceToParent( new_dist );
@@ -1108,8 +1109,8 @@ public class Phylogeny {
                 b.setBranchData( ( BranchData ) a.getBranchDataDirectly().copy() );
             }
             // New root is always placed in the middle of the branch:
-            if ( a.getDistanceToParent() == PhylogenyNode.DISTANCE_DEFAULT ) {
-                b.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+            if ( a.getDistanceToParent() == PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
+                b.setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
             }
             else {
                 if ( distance_n_to_parent >= 0.0 ) {
@@ -1142,9 +1143,9 @@ public class Phylogeny {
             if ( c.getNumberOfDescendants() == 2 ) {
                 final PhylogenyNode node = c.getChildNode( 1 - b.getChildNodeIndex( c ) );
                 node.setParent( b );
-                if ( ( c.getDistanceToParent() == PhylogenyNode.DISTANCE_DEFAULT )
-                        && ( node.getDistanceToParent() == PhylogenyNode.DISTANCE_DEFAULT ) ) {
-                    node.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+                if ( ( c.getDistanceToParent() == PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT )
+                        && ( node.getDistanceToParent() == PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) ) {
+                    node.setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
                 }
                 else {
                     node.setDistanceToParent( ( c.getDistanceToParent() >= 0.0 ? c.getDistanceToParent() : 0.0 )
index 0d404e8..cbf2885 100644 (file)
@@ -45,6 +45,7 @@ import org.forester.phylogeny.data.BranchWidth;
 import org.forester.phylogeny.data.Confidence;
 import org.forester.phylogeny.data.DomainArchitecture;
 import org.forester.phylogeny.data.Identifier;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.Taxonomy;
 import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
@@ -328,7 +329,7 @@ public class PhylogenyMethods {
         else if ( b >= 0.0 ) {
             return b;
         }
-        return PhylogenyNode.DISTANCE_DEFAULT;
+        return PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT;
     }
 
     // Helper for getUltraParalogousNodes( PhylogenyNode ).
index 7bf60ef..58ac6c7 100644 (file)
@@ -34,6 +34,7 @@ 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.NodeData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.iterators.ChildNodeIteratorForward;
 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.phylogeny.iterators.PreorderTreeIterator;
@@ -41,9 +42,7 @@ import org.forester.util.ForesterUtil;
 
 public class PhylogenyNode implements PhylogenyNodeI, Comparable<PhylogenyNode> {
 
-    /** Value of -99.0 is used as default value. */
-    public final static double       DISTANCE_DEFAULT = -1024.0;
-    private static int               _node_count      = 0;
+    private static int               _node_count = 0;
     private byte                     _indicator;
     private int                      _id;
     private int                      _sum_ext_nodes;
@@ -595,7 +594,7 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable<PhylogenyNode>
         _x = 0;
         _y = 0;
         //_node_name = "";
-        _distance_parent = PhylogenyNode.DISTANCE_DEFAULT;
+        _distance_parent = PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT;
         _collapse = false;
         _link = null;
         _branch_data = null;
@@ -962,7 +961,7 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable<PhylogenyNode>
                 sb.append( data );
             }
         }
-        if ( ( getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) && write_distance_to_parent ) {
+        if ( ( getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) && write_distance_to_parent ) {
             sb.append( ":" );
             sb.append( getDistanceToParent() );
         }
@@ -987,7 +986,7 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable<PhylogenyNode>
                 sb.append( name );
             }
         }
-        if ( getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+        if ( getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
             sb.append( ":" );
             sb.append( getDistanceToParent() );
         }
index f701f80..fe99d12 100644 (file)
@@ -35,9 +35,10 @@ import org.forester.util.ForesterUtil;
 
 public class Confidence implements PhylogenyData, Comparable<Confidence> {
 
-    public final static double CONFIDENCE_DEFAULT_VALUE = -9999.0;
-    private double             _value;
-    private String             _type;
+    public final static int CONFIDENCE_DEFAULT_VALUE = -9999;
+    private double          _value;
+    private double          _sd;
+    private String          _type;
 
     public Confidence() {
         init();
@@ -46,6 +47,13 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
     public Confidence( final double value, final String type ) {
         setValue( value );
         setType( type );
+        setStandardDeviation( CONFIDENCE_DEFAULT_VALUE );
+    }
+
+    public Confidence( final double value, final String type, final double sd ) {
+        setValue( value );
+        setType( type );
+        setStandardDeviation( sd );
     }
 
     @Override
@@ -62,6 +70,11 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
             sb.append( "] " );
         }
         sb.append( ForesterUtil.FORMATTER_6.format( getValue() ) );
+        if ( getStandardDeviation() != CONFIDENCE_DEFAULT_VALUE ) {
+            sb.append( " (sd=" );
+            sb.append( getStandardDeviation() );
+            sb.append( ")" );
+        }
         return sb;
     }
 
@@ -75,7 +88,7 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
 
     @Override
     public PhylogenyData copy() {
-        return new Confidence( getValue(), getType() );
+        return new Confidence( getValue(), getType(), getStandardDeviation() );
     }
 
     public String getType() {
@@ -86,9 +99,14 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
         return _value;
     }
 
+    public double getStandardDeviation() {
+        return _sd;
+    }
+
     public void init() {
         setValue( CONFIDENCE_DEFAULT_VALUE );
         setType( "" );
+        setStandardDeviation( CONFIDENCE_DEFAULT_VALUE );
     }
 
     @Override
@@ -117,6 +135,10 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
         _value = value;
     }
 
+    public void setStandardDeviation( final double sd ) {
+        _sd = sd;
+    }
+
     @Override
     public StringBuffer toNHX() {
         final StringBuffer sb = new StringBuffer();
@@ -132,13 +154,28 @@ public class Confidence implements PhylogenyData, Comparable<Confidence> {
         }
         writer.write( ForesterUtil.LINE_SEPARATOR );
         writer.write( indentation );
-        PhylogenyDataUtil.appendElement( writer,
-                                         PhyloXmlMapping.CONFIDENCE,
-                                         String.valueOf( ForesterUtil
-                                                 .round( getValue(),
-                                                         PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ),
-                                         PhyloXmlMapping.CONFIDENCE_TYPE_ATTR,
-                                         ForesterUtil.isEmpty( getType() ) ? "unknown" : getType() );
+        if ( getStandardDeviation() != CONFIDENCE_DEFAULT_VALUE ) {
+            PhylogenyDataUtil
+                    .appendElement( writer,
+                                    PhyloXmlMapping.CONFIDENCE,
+                                    String.valueOf( 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,
+                                    String.valueOf( ForesterUtil
+                                            .round( getValue(), PhyloXmlUtil.ROUNDING_DIGITS_FOR_PHYLOXML_DOUBLE_OUTPUT ) ),
+                                    PhyloXmlMapping.CONFIDENCE_TYPE_ATTR,
+                                    ForesterUtil.isEmpty( getType() ) ? "unknown" : getType() );
+        }
     }
 
     @Override
index f430477..f129259 100644 (file)
@@ -35,6 +35,9 @@ import org.forester.util.ForesterUtil;
 
 public final class PhylogenyDataUtil {
 
+    /** Value of -99.0 is used as default value. */
+    public final static double BRANCH_LENGTH_DEFAULT = -1024.0;
+
     public static void appendClose( final Writer w, final String element_name ) throws IOException {
         w.write( "</" );
         w.write( element_name );
@@ -101,6 +104,18 @@ public final class PhylogenyDataUtil {
 
     public static void appendElement( final Writer w,
                                       final String element_name,
+                                      final String value,
+                                      final String attribute1_name,
+                                      final String attribute1_value,
+                                      final String attribute2_name,
+                                      final String attribute2_value ) throws IOException {
+        appendOpen( w, element_name, attribute1_name, attribute1_value, attribute2_name, attribute2_value );
+        w.write( replaceIllegalXmlCharacters( value ) );
+        appendClose( w, element_name );
+    }
+
+    public static void appendElement( final Writer w,
+                                      final String element_name,
                                       final String attribute1_name,
                                       final String attribute1_value,
                                       final String attribute2_name,
index c0b1937..a8b4e49 100644 (file)
@@ -70,6 +70,7 @@ import org.forester.phylogeny.data.DomainArchitecture;
 import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.Identifier;
 import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.Polygon;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
@@ -4509,7 +4510,7 @@ public final class Test {
             if ( !n3.getName().equals( "n3" ) ) {
                 return false;
             }
-            if ( n3.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+            if ( n3.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                 return false;
             }
             if ( n3.isDuplication() ) {
@@ -4748,7 +4749,7 @@ public final class Test {
             if ( PhylogenyMethods.getConfidenceValue( n1 ) != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
                 return false;
             }
-            if ( n1.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+            if ( n1.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                 return false;
             }
             if ( n2.getName().compareTo( "" ) != 0 ) {
@@ -4757,7 +4758,7 @@ public final class Test {
             if ( PhylogenyMethods.getConfidenceValue( n2 ) != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
                 return false;
             }
-            if ( n2.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+            if ( n2.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                 return false;
             }
             final PhylogenyNode n00 = PhylogenyNode
@@ -5038,23 +5039,48 @@ public final class Test {
     private static boolean testNHXParsingMB() {
         try {
             final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-            final Phylogeny p1 = factory.create( "(1[&prob=1.000000000000000e+00,prob_stddev=0.000000000000000e+00,"
+            final Phylogeny p1 = factory.create( "(1[&prob=0.9500000000000000e+00,prob_stddev=0.1100000000000000e+00,"
                     + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
                     + "prob+-sd=\"100+-0\"]:4.129000000000000e-02[&length_mean=4.153987461671767e-02,"
                     + "length_median=4.129000000000000e-02,length_95%HPD={3.217800000000000e-02,"
-                    + "5.026800000000000e-02}],2[&prob=1.000000000000000e+00,prob_stddev=0.000000000000000e+00,"
+                    + "5.026800000000000e-02}],2[&prob=0.810000000000000e+00,prob_stddev=0.000000000000000e+00,"
                     + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
                     + "prob+-sd=\"100+-0\"]:6.375699999999999e-02[&length_mean=6.395210411945065e-02,"
                     + "length_median=6.375699999999999e-02,length_95%HPD={5.388600000000000e-02,"
                     + "7.369400000000000e-02}])", new NHXParser() )[ 0 ];
             if ( !isEqual( p1.getNode( "1" ).getDistanceToParent(), 4.129e-02 ) ) {
-                System.out.println( p1.getNode( "1" ).getDistanceToParent() );
-                System.exit( -1 );
                 return false;
             }
-            //  if ( !p1.toNewHampshireX().equals( "(A[&&NHX:S=a_species],B1[&&NHX:S=b_species])" ) ) {
-            //     return false;
-            //  }
+            if ( !isEqual( p1.getNode( "1" ).getBranchData().getConfidence( 0 ).getValue(), 0.9500000000000000e+00 ) ) {
+                return false;
+            }
+            if ( !isEqual( p1.getNode( "1" ).getBranchData().getConfidence( 0 ).getStandardDeviation(),
+                           0.1100000000000000e+00 ) ) {
+                return false;
+            }
+            if ( !isEqual( p1.getNode( "2" ).getDistanceToParent(), 6.375699999999999e-02 ) ) {
+                return false;
+            }
+            if ( !isEqual( p1.getNode( "2" ).getBranchData().getConfidence( 0 ).getValue(), 0.810000000000000e+00 ) ) {
+                return false;
+            }
+            final Phylogeny p2 = factory
+                    .create( "(1[something_else(?)s,prob=0.9500000000000000e+00{}(((,p)rob_stddev=0.110000000000e+00,"
+                                     + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+                                     + "prob+-sd=\"100+-0\"]:4.129000000000000e-02[&length_mean=4.153987461671767e-02,"
+                                     + "length_median=4.129000000000000e-02,length_95%HPD={3.217800000000000e-02,"
+                                     + "5.026800000000000e-02}],2[&prob=0.810000000000000e+00,prob_stddev=0.000000000000000e+00,"
+                                     + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+                                     + "prob+-sd=\"100+-0\"]:6.375699999999999e-02[&length_mean=6.395210411945065e-02,"
+                                     + "length_median=6.375699999999999e-02,length_95%HPD={5.388600000000000e-02,"
+                                     + "7.369400000000000e-02}])",
+                             new NHXParser() )[ 0 ];
+            if ( p2.getNode( "1" ) == null ) {
+                return false;
+            }
+            if ( p2.getNode( "2" ) == null ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );