cleanup
[jalview.git] / forester / java / src / org / forester / test / Test.java
index ac070ff..3753c8b 100644 (file)
@@ -2,8 +2,8 @@
 // FORESTER -- software libraries and applications
 // for evolutionary biology research and applications.
 //
-// Copyright (C) 2008-2009 Christian M. Zmasek
-// Copyright (C) 2008-2009 Burnham Institute for Medical Research
+// Copyright (C) 2014 Christian M. Zmasek
+// Copyright (C) 2014 Sanford-Burnham Medical Research Institute
 // All rights reserved
 //
 // This library is free software; you can redistribute it and/or
@@ -20,7 +20,6 @@
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 //
-// Contact: phylosoft @ gmail . com
 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.test;
@@ -29,6 +28,8 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Date;
@@ -41,6 +42,7 @@ import java.util.SortedSet;
 
 import org.forester.application.support_transfer;
 import org.forester.archaeopteryx.TreePanelUtil;
+import org.forester.archaeopteryx.webservices.WebserviceUtil;
 import org.forester.development.DevelopmentTools;
 import org.forester.evoinference.TestPhylogenyReconstruction;
 import org.forester.evoinference.matrix.character.CharacterStateMatrix;
@@ -61,8 +63,10 @@ import org.forester.io.parsers.util.ParserUtils;
 import org.forester.io.writers.PhylogenyWriter;
 import org.forester.io.writers.SequenceWriter;
 import org.forester.msa.BasicMsa;
+import org.forester.msa.DeleteableMsa;
 import org.forester.msa.Mafft;
 import org.forester.msa.Msa;
+import org.forester.msa.Msa.MSA_FORMAT;
 import org.forester.msa.MsaInferrer;
 import org.forester.msa.MsaMethods;
 import org.forester.pccx.TestPccx;
@@ -135,6 +139,7 @@ public final class Test {
                                                                    + ForesterUtil.getFileSeparator() + "test_data"
                                                                    + ForesterUtil.getFileSeparator();
     private final static boolean PERFORM_DB_TESTS          = false;
+    private static final boolean PERFORM_WEB_TREE_ACCESS   = true;
     private static final String  PHYLOXML_LOCAL_XSD        = PATH_TO_RESOURCES + "phyloxml_schema/"
                                                                    + ForesterConstants.PHYLO_XML_VERSION + "/"
                                                                    + ForesterConstants.PHYLO_XML_XSD;
@@ -256,31 +261,6 @@ public final class Test {
             System.out.println( "failed." );
             failed++;
         }
-        if ( PERFORM_DB_TESTS ) {
-            System.out.print( "Ebi Entry Retrieval: " );
-            if ( Test.testEbiEntryRetrieval() ) {
-                System.out.println( "OK." );
-                succeeded++;
-            }
-            else {
-                System.out.println( "failed." );
-                failed++;
-            }
-        }
-        // System.exit( 0 );
-        if ( PERFORM_DB_TESTS ) {
-            System.out.print( "Sequence DB tools 2: " );
-            if ( testSequenceDbWsTools2() ) {
-                System.out.println( "OK." );
-                succeeded++;
-            }
-            else {
-                System.out.println( "failed." );
-                failed++;
-                System.exit( -1 );
-            }
-        }
-        // System.exit( 0 );
         System.out.print( "Hmmscan output parser: " );
         if ( testHmmscanOutputParser() ) {
             System.out.println( "OK." );
@@ -290,7 +270,6 @@ public final class Test {
             System.out.println( "failed." );
             failed++;
         }
-        //
         System.out.print( "Overlap removal: " );
         if ( !org.forester.test.Test.testOverlapRemoval() ) {
             System.out.println( "failed." );
@@ -309,7 +288,6 @@ public final class Test {
             succeeded++;
         }
         System.out.println( "OK." );
-        //
         System.out.print( "Taxonomy code extraction: " );
         if ( Test.testExtractTaxonomyCodeFromNodeName() ) {
             System.out.println( "OK." );
@@ -880,29 +858,6 @@ public final class Test {
             System.out.println( "failed." );
             failed++;
         }
-        if ( PERFORM_DB_TESTS ) {
-            System.out.print( "Uniprot Entry Retrieval: " );
-            if ( Test.testUniprotEntryRetrieval() ) {
-                System.out.println( "OK." );
-                succeeded++;
-            }
-            else {
-                System.out.println( "failed." );
-                failed++;
-            }
-        }
-        if ( PERFORM_DB_TESTS ) {
-            System.out.print( "Uniprot Taxonomy Search: " );
-            if ( Test.testUniprotTaxonomySearch() ) {
-                System.out.println( "OK." );
-                succeeded++;
-            }
-            else {
-                System.out.println( "failed." );
-                failed++;
-            }
-        }
-        //----
         String path = "";
         final String os = ForesterUtil.OS_NAME.toLowerCase();
         if ( ( os.indexOf( "mac" ) >= 0 ) && ( os.indexOf( "os" ) > 0 ) ) {
@@ -912,16 +867,13 @@ public final class Test {
             path = "C:\\Program Files\\mafft-win\\mafft.bat";
         }
         else {
-            path = "/home/czmasek/bin/mafft";
-        }
-        if ( !MsaInferrer.isInstalled( path ) ) {
             path = "mafft";
-        }
-        if ( !MsaInferrer.isInstalled( path ) ) {
-            path = "/usr/local/bin/mafft";
-        }
-        if ( !MsaInferrer.isInstalled( path ) ) {
-            path = "/home/czmasek/SOFTWARE/MSA/MAFFT/mafft-7.130-without-extensions/scripts/mafft";
+            if ( !MsaInferrer.isInstalled( path ) ) {
+                path = "/usr/bin/mafft";
+            }
+            if ( !MsaInferrer.isInstalled( path ) ) {
+                path = "/usr/local/bin/mafft";
+            }
         }
         if ( MsaInferrer.isInstalled( path ) ) {
             System.out.print( "MAFFT (external program): " );
@@ -933,7 +885,6 @@ public final class Test {
                 System.out.println( "failed [will not count towards failed tests]" );
             }
         }
-        //----
         System.out.print( "Next nodes with collapsed: " );
         if ( Test.testNextNodeWithCollapsing() ) {
             System.out.println( "OK." );
@@ -952,8 +903,8 @@ public final class Test {
             System.out.println( "failed." );
             failed++;
         }
-        System.out.print( "NHX parsing from URL: " );
-        if ( Test.testNHXparsingFromURL() ) {
+        System.out.print( "Deleteable MSA: " );
+        if ( Test.testDeleteableMsa() ) {
             System.out.println( "OK." );
             succeeded++;
         }
@@ -961,14 +912,104 @@ public final class Test {
             System.out.println( "failed." );
             failed++;
         }
-        System.out.print( "phyloXML parsing from URL: " );
-        if ( Test.testPhyloXMLparsingFromURL() ) {
-            System.out.println( "OK." );
-            succeeded++;
+        if ( PERFORM_DB_TESTS ) {
+            System.out.print( "Uniprot Entry Retrieval: " );
+            if ( Test.testUniprotEntryRetrieval() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            System.out.print( "Ebi Entry Retrieval: " );
+            if ( Test.testEbiEntryRetrieval() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            System.out.print( "Sequence DB tools 2: " );
+            if ( testSequenceDbWsTools2() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+                System.exit( -1 );
+            }
+            System.out.print( "Uniprot Taxonomy Search: " );
+            if ( Test.testUniprotTaxonomySearch() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
         }
-        else {
-            System.out.println( "failed." );
-            failed++;
+        if ( PERFORM_WEB_TREE_ACCESS ) {
+            System.out.print( "NHX parsing from URL: " );
+            if ( Test.testNHXparsingFromURL() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            System.out.print( "phyloXML parsing from URL: " );
+            if ( Test.testPhyloXMLparsingFromURL() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            System.out.print( "TreeBase acccess: " );
+            if ( Test.testTreeBaseReading() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            //
+            System.out.print( "ToL access: " );
+            if ( Test.testToLReading() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            //
+            System.out.print( "TreeFam access: " );
+            if ( Test.testTreeFamReading() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
+            //
+            //
+            System.out.print( "Pfam tree access: " );
+            if ( Test.testPfamTreeReading() ) {
+                System.out.println( "OK." );
+                succeeded++;
+            }
+            else {
+                System.out.println( "failed." );
+                failed++;
+            }
         }
         System.out.println();
         final Runtime rt = java.lang.Runtime.getRuntime();
@@ -1087,40 +1128,28 @@ public final class Test {
         return true;
     }
 
-    public static final boolean testPhyloXMLparsingFromURL() {
-        try {
-            final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/archaeopteryx_a/apaf_bcl2.xml";
-            final URL u = new URL( s );
-            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-            final Phylogeny[] phys = factory.create( u.openStream(), PhyloXmlParser.createPhyloXmlParser() );
-            if ( ( phys == null ) || ( phys.length != 2 ) ) {
-                return false;
-            }
-        }
-        catch ( final Exception e ) {
-            e.printStackTrace();
-        }
-        return true;
-    }
-
     public static final boolean testNHXparsingFromURL() {
         try {
             final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/simple/simple_1.nh";
             final URL u = new URL( s );
             final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
             final Phylogeny[] phys = factory.create( u, new NHXParser() );
-            if ( ( phys == null ) || ( phys.length != 1 ) ) {
+            if ( ( phys == null ) || ( phys.length != 5 ) ) {
                 return false;
             }
-            if ( !phys[ 0 ].toNewHampshire().equals( "((a,b),c);" ) ) {
+            if ( !phys[ 0 ].toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
                 System.out.println( phys[ 0 ].toNewHampshire() );
                 return false;
             }
+            if ( !phys[ 1 ].toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) {
+                System.out.println( phys[ 1 ].toNewHampshire() );
+                return false;
+            }
             final Phylogeny[] phys2 = factory.create( u.openStream(), new NHXParser() );
-            if ( ( phys2 == null ) || ( phys2.length != 1 ) ) {
+            if ( ( phys2 == null ) || ( phys2.length != 5 ) ) {
                 return false;
             }
-            if ( !phys2[ 0 ].toNewHampshire().equals( "((a,b),c);" ) ) {
+            if ( !phys2[ 0 ].toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
                 System.out.println( phys2[ 0 ].toNewHampshire() );
                 return false;
             }
@@ -1131,42 +1160,30 @@ public final class Test {
             if ( !p.hasNext() ) {
                 return false;
             }
-            if ( !p.next().toNewHampshire().equals( "((a,b),c);" ) ) {
-                return false;
-            }
-            if ( p.hasNext() ) {
-                return false;
-            }
-            if ( p.next() != null ) {
-                return false;
-            }
-            if ( p.hasNext() ) {
+            if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
                 return false;
             }
-            if ( p.next() != null ) {
+            if ( !p.hasNext() ) {
                 return false;
             }
             p.reset();
             if ( !p.hasNext() ) {
                 return false;
             }
-            if ( !p.next().toNewHampshire().equals( "((a,b),c);" ) ) {
+            if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
                 return false;
             }
-            if ( p.hasNext() ) {
-                return false;
-            }
-            if ( p.next() != null ) {
+            if ( !p.next().toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) {
                 return false;
             }
-            if ( p.hasNext() ) {
+            p.reset();
+            if ( !p.hasNext() ) {
                 return false;
             }
-            if ( p.next() != null ) {
+            if ( !p.next().toNewHampshire().equals( "((((A,B),C),D),(E,F));" ) ) {
                 return false;
             }
-            p.reset();
-            if ( !p.hasNext() ) {
+            if ( !p.next().toNewHampshire().equals( "((1,2,3),(4,5,6),(7,8,9));" ) ) {
                 return false;
             }
         }
@@ -1330,6 +1347,115 @@ public final class Test {
         return true;
     }
 
+    public static final boolean testPfamTreeReading() {
+        try {
+            final URL u = new URL( WebserviceUtil.PFAM_SERVER + "/family/PF" + "01849" + "/tree/download" );
+            final NHXParser parser = new NHXParser();
+            parser.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );
+            parser.setReplaceUnderscores( false );
+            parser.setGuessRootedness( true );
+            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys = factory.create( u.openStream(), parser );
+            if ( ( phys == null ) || ( phys.length != 1 ) ) {
+                return false;
+            }
+            if ( phys[ 0 ].getNumberOfExternalNodes() < 10 ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    public static final boolean testPhyloXMLparsingFromURL() {
+        try {
+            final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/archaeopteryx_a/apaf_bcl2.xml";
+            final URL u = new URL( s );
+            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys = factory.create( u.openStream(), PhyloXmlParser.createPhyloXmlParser() );
+            if ( ( phys == null ) || ( phys.length != 2 ) ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    public static final boolean testToLReading() {
+        try {
+            final URL u = new URL( WebserviceUtil.TOL_URL_BASE + "15079" );
+            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys = factory.create( u.openStream(), new TolParser() );
+            if ( ( phys == null ) || ( phys.length != 1 ) ) {
+                return false;
+            }
+            if ( !phys[ 0 ].getRoot().getNodeData().getTaxonomy().getIdentifier().getValue().equals( "15079" ) ) {
+                return false;
+            }
+            if ( !phys[ 0 ].getRoot().getNodeData().getTaxonomy().getScientificName().equals( "Protacanthopterygii" ) ) {
+                return false;
+            }
+            if ( phys[ 0 ].getNumberOfExternalNodes() < 5 ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    public static final boolean testTreeBaseReading() {
+        try {
+            final URL u = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "825?format=nexus" );
+            final NexusPhylogeniesParser parser = new NexusPhylogeniesParser();
+            parser.setReplaceUnderscores( true );
+            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys = factory.create( u.openStream(), parser );
+            if ( ( phys == null ) || ( phys.length != 1 ) ) {
+                return false;
+            }
+            final URL u2 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "15613?format=nexus" );
+            final NexusPhylogeniesParser parser2 = new NexusPhylogeniesParser();
+            parser2.setReplaceUnderscores( true );
+            final PhylogenyFactory factory2 = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys2 = factory2.create( u2.openStream(), parser2 );
+            if ( ( phys2 == null ) || ( phys2.length != 9 ) ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    public static final boolean testTreeFamReading() {
+        try {
+            final URL u = new URL( WebserviceUtil.TREE_FAM_URL_BASE + "101004" + "/tree/newick" );
+            final NHXParser parser = new NHXParser();
+            parser.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.NO );
+            parser.setReplaceUnderscores( false );
+            parser.setGuessRootedness( true );
+            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+            final Phylogeny[] phys = factory.create( u.openStream(), parser );
+            if ( ( phys == null ) || ( phys.length != 1 ) ) {
+                return false;
+            }
+            if ( phys[ 0 ].getNumberOfExternalNodes() < 10 ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
     private final static Phylogeny createPhylogeny( final String nhx ) throws IOException {
         final Phylogeny p = ParserBasedPhylogenyFactory.getInstance().create( nhx, new NHXParser() )[ 0 ];
         return p;
@@ -3353,7 +3479,7 @@ public final class Test {
             if ( t4.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            String s = w.toNewHampshire( t4, false, true ).toString();
+            String s = w.toNewHampshire( t4, true ).toString();
             if ( !s.equals( "((A,(B11,B12)),(C,D));" ) ) {
                 return false;
             }
@@ -3374,7 +3500,7 @@ public final class Test {
             if ( !n.getName().equals( "D" ) ) {
                 return false;
             }
-            s = w.toNewHampshire( t4, false, true ).toString();
+            s = w.toNewHampshire( t4, true ).toString();
             if ( !s.equals( "((A,B12),D);" ) ) {
                 return false;
             }
@@ -3383,7 +3509,7 @@ public final class Test {
             if ( t5.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t5, false, true ).toString();
+            s = w.toNewHampshire( t5, true ).toString();
             if ( !s.equals( "(((B11,B12),B2),(C,D));" ) ) {
                 return false;
             }
@@ -3392,7 +3518,7 @@ public final class Test {
             if ( t6.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t6, false, false ).toString();
+            s = w.toNewHampshire( t6, false ).toString();
             if ( !s.equals( "((A,(B12,B2)),(C,D));" ) ) {
                 return false;
             }
@@ -3401,7 +3527,7 @@ public final class Test {
             if ( t7.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t7, false, true ).toString();
+            s = w.toNewHampshire( t7, true ).toString();
             if ( !s.equals( "((A,(B11,B2)),(C,D));" ) ) {
                 return false;
             }
@@ -3410,7 +3536,7 @@ public final class Test {
             if ( t8.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t8, false, false ).toString();
+            s = w.toNewHampshire( t8, false ).toString();
             if ( !s.equals( "((A,(B11,B12)),(C,D));" ) ) {
                 return false;
             }
@@ -3419,7 +3545,7 @@ public final class Test {
             if ( t9.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t9, false, true ).toString();
+            s = w.toNewHampshire( t9, true ).toString();
             if ( !s.equals( "((A,((B11,B12),B2)),D);" ) ) {
                 return false;
             }
@@ -3428,7 +3554,7 @@ public final class Test {
             if ( t10.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t10, false, true ).toString();
+            s = w.toNewHampshire( t10, true ).toString();
             if ( !s.equals( "((A,((B11,B12),B2)),C);" ) ) {
                 return false;
             }
@@ -3437,7 +3563,7 @@ public final class Test {
             if ( t11.getNumberOfExternalNodes() != 2 ) {
                 return false;
             }
-            s = w.toNewHampshire( t11, false, true ).toString();
+            s = w.toNewHampshire( t11, true ).toString();
             if ( !s.equals( "(B,C);" ) ) {
                 return false;
             }
@@ -3445,7 +3571,7 @@ public final class Test {
             if ( t11.getNumberOfExternalNodes() != 1 ) {
                 return false;
             }
-            s = w.toNewHampshire( t11, false, false ).toString();
+            s = w.toNewHampshire( t11, false ).toString();
             if ( !s.equals( "B;" ) ) {
                 return false;
             }
@@ -3454,7 +3580,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 8 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "((A1,A2,A3),(B1,B3),(C1,C2,C3));" ) ) {
                 return false;
             }
@@ -3462,7 +3588,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 7 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "((A1,A2,A3),B1,(C1,C2,C3));" ) ) {
                 return false;
             }
@@ -3470,7 +3596,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 6 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "((A1,A2,A3),B1,(C1,C2));" ) ) {
                 return false;
             }
@@ -3478,7 +3604,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "((A2,A3),B1,(C1,C2));" ) ) {
                 return false;
             }
@@ -3486,7 +3612,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 4 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "((A2,A3),(C1,C2));" ) ) {
                 return false;
             }
@@ -3494,7 +3620,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 3 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "(A2,(C1,C2));" ) ) {
                 return false;
             }
@@ -3502,7 +3628,7 @@ public final class Test {
             if ( t12.getNumberOfExternalNodes() != 2 ) {
                 return false;
             }
-            s = w.toNewHampshire( t12, false, true ).toString();
+            s = w.toNewHampshire( t12, true ).toString();
             if ( !s.equals( "(C1,C2);" ) ) {
                 return false;
             }
@@ -3511,7 +3637,7 @@ public final class Test {
             if ( t13.getNumberOfExternalNodes() != 4 ) {
                 return false;
             }
-            s = w.toNewHampshire( t13, false, true ).toString();
+            s = w.toNewHampshire( t13, true ).toString();
             if ( !s.equals( "(A,B,C,E:5.0);" ) ) {
                 return false;
             }
@@ -3520,7 +3646,7 @@ public final class Test {
             if ( t14.getNumberOfExternalNodes() != 5 ) {
                 return false;
             }
-            s = w.toNewHampshire( t14, false, true ).toString();
+            s = w.toNewHampshire( t14, true ).toString();
             if ( !s.equals( "((A,B,C,D:1.1),F);" ) ) {
                 return false;
             }
@@ -3984,97 +4110,311 @@ public final class Test {
             while ( !n.isLastExternalNode() ) {
                 n = n.getNextExternalNode();
             }
-            final Phylogeny t3 = factory.create( "(((A,B),(C,D)),((E,F),(G,H)))", new NHXParser() )[ 0 ];
-            n = t3.getNode( "A" );
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "B" ) ) {
+            final Phylogeny t3 = factory.create( "(((A,B),(C,D)),((E,F),(G,H)))", new NHXParser() )[ 0 ];
+            n = t3.getNode( "A" );
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "B" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "C" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "D" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "E" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "F" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "G" ) ) {
+                return false;
+            }
+            n = n.getNextExternalNode();
+            if ( !n.getName().equals( "H" ) ) {
+                return false;
+            }
+            n = t3.getNode( "B" );
+            while ( !n.isLastExternalNode() ) {
+                n = n.getNextExternalNode();
+            }
+            final Phylogeny t4 = factory.create( "((A,B),(C,D))", new NHXParser() )[ 0 ];
+            for( final PhylogenyNodeIterator iter = t4.iteratorExternalForward(); iter.hasNext(); ) {
+                final PhylogenyNode node = iter.next();
+            }
+            final Phylogeny t5 = factory.create( "(((A,B),(C,D)),((E,F),(G,H)))", new NHXParser() )[ 0 ];
+            for( final PhylogenyNodeIterator iter = t5.iteratorExternalForward(); iter.hasNext(); ) {
+                final PhylogenyNode node = iter.next();
+            }
+            final Phylogeny t6 = factory.create( "((((((A))),(((B))),((C)),((((D)))),E)),((F)))", new NHXParser() )[ 0 ];
+            final PhylogenyNodeIterator iter = t6.iteratorExternalForward();
+            if ( !iter.next().getName().equals( "A" ) ) {
+                return false;
+            }
+            if ( !iter.next().getName().equals( "B" ) ) {
+                return false;
+            }
+            if ( !iter.next().getName().equals( "C" ) ) {
+                return false;
+            }
+            if ( !iter.next().getName().equals( "D" ) ) {
+                return false;
+            }
+            if ( !iter.next().getName().equals( "E" ) ) {
+                return false;
+            }
+            if ( !iter.next().getName().equals( "F" ) ) {
+                return false;
+            }
+            if ( iter.hasNext() ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace( System.out );
+            return false;
+        }
+        return true;
+    }
+
+    private static boolean testExtractSNFromNodeName() {
+        try {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2_Mus_musculus" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2 Mus musculus" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_BCDO2" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus musculus musculus BCDO2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_musculus_BCDO2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2 Mus musculus musculus" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Bcl Mus musculus musculus" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "vcl Mus musculus musculus" ) != null ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "could_be_anything_Mus_musculus_musculus_BCDO2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "could_be_anything_Mus_musculus_musculus_Musculus" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "could_be_anything_Mus_musculus_musculus_musculus" ) != null ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "musculus" ) != null ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "mus_musculus" ) != null ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "mus_musculus_musculus" ) != null ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_musculus_1" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_1" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_bcl" ) != null ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_BCL" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( ParserUtils.extractScientificNameFromNodeName( "Mus musculus bcl" ) != null ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus musculus BCL" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus musculus xBCL" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus musculus x1" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( " -XS12_Mus_musculus_12" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( " -1234_Mus_musculus_12 affrre e" )
+                    .equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( " -1234_Mus_musculus_12_affrre_e" )
+                    .equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_musculus_2bcl2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_musculus_2bcl2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_musculus_bcl2" )
+                    .equals( "Mus musculus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Mus_musculus_123" ).equals( "Mus musculus" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Pilostyles mexicana Mexico Breedlove 27233" )
+                    .equals( "Pilostyles mexicana" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia_coli_strain_K12/DH10B" )
+                    .equals( "Escherichia coli strain K12/DH10B" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia_coli_str_K12/DH10B" )
+                    .equals( "Escherichia coli str. K12/DH10B" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli str. K12/DH10B" )
+                    .equals( "Escherichia coli str. K12/DH10B" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis_lyrata_subsp_lyrata" )
+                    .equals( "Arabidopsis lyrata subsp. lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis lyrata subsp. lyrata" )
+                    .equals( "Arabidopsis lyrata subsp. lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis lyrata subsp. lyrata 395" )
+                    .equals( "Arabidopsis lyrata subsp. lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis lyrata subsp. lyrata bcl2" )
+                    .equals( "Arabidopsis lyrata subsp. lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis lyrata subsp lyrata bcl2" )
+                    .equals( "Arabidopsis lyrata subsp. lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Arabidopsis lyrata subspecies lyrata bcl2" )
+                    .equals( "Arabidopsis lyrata subspecies lyrata" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Verbascum sinuatum var. adenosepalum bcl2" )
+                    .equals( "Verbascum sinuatum var. adenosepalum" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "C" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (strain K12)" )
+                    .equals( "Escherichia coli (strain K12)" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "D" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (strain K12) bcl2" )
+                    .equals( "Escherichia coli (strain K12)" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "E" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (str. K12)" )
+                    .equals( "Escherichia coli (str. K12)" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "F" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (str K12)" )
+                    .equals( "Escherichia coli (str. K12)" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "G" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (str. K12) bcl2" )
+                    .equals( "Escherichia coli (str. K12)" ) ) {
                 return false;
             }
-            n = n.getNextExternalNode();
-            if ( !n.getName().equals( "H" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli (var K12) bcl2" )
+                    .equals( "Escherichia coli (var. K12)" ) ) {
                 return false;
             }
-            n = t3.getNode( "B" );
-            while ( !n.isLastExternalNode() ) {
-                n = n.getNextExternalNode();
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli str. K-12 substr. MG1655star" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
+                return false;
             }
-            final Phylogeny t4 = factory.create( "((A,B),(C,D))", new NHXParser() )[ 0 ];
-            for( final PhylogenyNodeIterator iter = t4.iteratorExternalForward(); iter.hasNext(); ) {
-                final PhylogenyNode node = iter.next();
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli str K-12 substr MG1655star" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
+                return false;
             }
-            final Phylogeny t5 = factory.create( "(((A,B),(C,D)),((E,F),(G,H)))", new NHXParser() )[ 0 ];
-            for( final PhylogenyNodeIterator iter = t5.iteratorExternalForward(); iter.hasNext(); ) {
-                final PhylogenyNode node = iter.next();
+            if ( !ParserUtils
+                    .extractScientificNameFromNodeName( "could be anything Escherichia coli str K-12 substr MG1655star" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
+                return false;
             }
-            final Phylogeny t6 = factory.create( "((((((A))),(((B))),((C)),((((D)))),E)),((F)))", new NHXParser() )[ 0 ];
-            final PhylogenyNodeIterator iter = t6.iteratorExternalForward();
-            if ( !iter.next().getName().equals( "A" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia coli str K-12 substr MG1655star gene1" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
                 return false;
             }
-            if ( !iter.next().getName().equals( "B" ) ) {
+            if ( !ParserUtils
+                    .extractScientificNameFromNodeName( "could be anything Escherichia coli str K-12 substr MG1655star GENE1" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
                 return false;
             }
-            if ( !iter.next().getName().equals( "C" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia_coli_str_K-12_substr_MG1655star" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
                 return false;
             }
-            if ( !iter.next().getName().equals( "D" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Escherichia_coli_str_K-12_substr_MG1655star" )
+                    .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) {
                 return false;
             }
-            if ( !iter.next().getName().equals( "E" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp." ).equals( "Macrocera sp." ) ) {
                 return false;
             }
-            if ( !iter.next().getName().equals( "F" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp. 123" ).equals( "Macrocera sp." ) ) {
                 return false;
             }
-            if ( iter.hasNext() ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp. K12" ).equals( "Macrocera sp." ) ) {
                 return false;
             }
-        }
-        catch ( final Exception e ) {
-            e.printStackTrace( System.out );
-            return false;
-        }
-        return true;
-    }
-
-    private static boolean testExtractSNFromNodeName() {
-        try {
-            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2_Mus_musculus" ).equals( "Mus musculus" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "something Macrocera sp. K12" )
+                    .equals( "Macrocera sp." ) ) {
                 return false;
             }
-            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2_Mus_musculus_musculus" )
-                    .equals( "Mus musculus musculus" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp" ).equals( "Macrocera sp." ) ) {
                 return false;
             }
-            if ( !ParserUtils.extractScientificNameFromNodeName( "BCDO2_Mus_musculus_musculus-12" )
-                    .equals( "Mus musculus musculus" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum ssp merenskyanum 07 48" )
+                    .equals( "Sesamum rigidum subsp. merenskyanum" ) ) {
                 return false;
             }
-            if ( !ParserUtils.extractScientificNameFromNodeName( " -XS12_Mus_musculus-12" ).equals( "Mus musculus" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum ssp. merenskyanum" )
+                    .equals( "Sesamum rigidum subsp. merenskyanum" ) ) {
                 return false;
             }
-            if ( !ParserUtils.extractScientificNameFromNodeName( " -1234_Mus_musculus-12 affrre e" )
-                    .equals( "Mus musculus" ) ) {
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum (ssp. merenskyanum)" )
+                    .equals( "Sesamum rigidum (subsp. merenskyanum)" ) ) {
+                return false;
+            }
+            if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum (ssp merenskyanum)" )
+                    .equals( "Sesamum rigidum (subsp. merenskyanum)" ) ) {
                 return false;
             }
         }
@@ -5709,10 +6049,10 @@ public final class Test {
 
     private static boolean testMsaQualityMethod() {
         try {
-            final Sequence s0 = BasicSequence.createAaSequence( "a", "ABAXEFGHIJ" );
-            final Sequence s1 = BasicSequence.createAaSequence( "b", "ABBXEFGHIJ" );
-            final Sequence s2 = BasicSequence.createAaSequence( "c", "AXCXEFGHIJ" );
-            final Sequence s3 = BasicSequence.createAaSequence( "d", "AXDDEFGHIJ" );
+            final Sequence s0 = BasicSequence.createAaSequence( "a", "ABAXEFGHIJJE-" );
+            final Sequence s1 = BasicSequence.createAaSequence( "b", "ABBXEFGHIJJBB" );
+            final Sequence s2 = BasicSequence.createAaSequence( "c", "AXCXEFGHIJJ--" );
+            final Sequence s3 = BasicSequence.createAaSequence( "d", "AXDDEFGHIJ---" );
             final List<Sequence> l = new ArrayList<Sequence>();
             l.add( s0 );
             l.add( s1 );
@@ -5731,6 +6071,169 @@ public final class Test {
             if ( !isEqual( 0.75, MsaMethods.calculateIdentityRatio( msa, 3 ) ) ) {
                 return false;
             }
+            if ( !isEqual( 0.75, MsaMethods.calculateIdentityRatio( msa, 10 ) ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.25, MsaMethods.calculateIdentityRatio( msa, 11 ) ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.25, MsaMethods.calculateIdentityRatio( msa, 12 ) ) ) {
+                return false;
+            }
+        }
+        catch ( final Exception e ) {
+            e.printStackTrace( System.out );
+            return false;
+        }
+        return true;
+    }
+
+    private static boolean testDeleteableMsa() {
+        try {
+            final Sequence s0 = BasicSequence.createAaSequence( "a", "AAAA" );
+            final Sequence s1 = BasicSequence.createAaSequence( "b", "BAAA" );
+            final Sequence s2 = BasicSequence.createAaSequence( "c", "CAAA" );
+            final Sequence s3 = BasicSequence.createAaSequence( "d", "DAAA" );
+            final Sequence s4 = BasicSequence.createAaSequence( "e", "EAAA" );
+            final Sequence s5 = BasicSequence.createAaSequence( "f", "FAAA" );
+            final List<Sequence> l0 = new ArrayList<Sequence>();
+            l0.add( s0 );
+            l0.add( s1 );
+            l0.add( s2 );
+            l0.add( s3 );
+            l0.add( s4 );
+            l0.add( s5 );
+            final DeleteableMsa dmsa0 = DeleteableMsa.createInstance( l0 );
+            dmsa0.deleteRow( "b" );
+            if ( !dmsa0.getIdentifier( 1 ).equals( "c" ) ) {
+                return false;
+            }
+            dmsa0.deleteRow( "e" );
+            dmsa0.deleteRow( "a" );
+            dmsa0.deleteRow( "f" );
+            if ( dmsa0.getLength() != 4 ) {
+                return false;
+            }
+            if ( dmsa0.getNumberOfSequences() != 2 ) {
+                return false;
+            }
+            if ( !dmsa0.getIdentifier( 0 ).equals( "c" ) ) {
+                return false;
+            }
+            if ( !dmsa0.getIdentifier( 1 ).equals( "d" ) ) {
+                return false;
+            }
+            if ( dmsa0.getResidueAt( 0, 0 ) != 'C' ) {
+                return false;
+            }
+            if ( !dmsa0.getSequenceAsString( 0 ).toString().equals( "CAAA" ) ) {
+                return false;
+            }
+            if ( dmsa0.getColumnAt( 0 ).size() != 2 ) {
+                return false;
+            }
+            dmsa0.deleteRow( "c" );
+            dmsa0.deleteRow( "d" );
+            if ( dmsa0.getNumberOfSequences() != 0 ) {
+                return false;
+            }
+            //
+            final Sequence s_0 = BasicSequence.createAaSequence( "a", "--A---B-C--X----" );
+            final Sequence s_1 = BasicSequence.createAaSequence( "b", "--B-----C-------" );
+            final Sequence s_2 = BasicSequence.createAaSequence( "c", "--C--AB-C------Z" );
+            final Sequence s_3 = BasicSequence.createAaSequence( "d", "--D--AA-C-------" );
+            final Sequence s_4 = BasicSequence.createAaSequence( "e", "--E--AA-C-------" );
+            final Sequence s_5 = BasicSequence.createAaSequence( "f", "--F--AB-CD--Y---" );
+            final List<Sequence> l1 = new ArrayList<Sequence>();
+            l1.add( s_0 );
+            l1.add( s_1 );
+            l1.add( s_2 );
+            l1.add( s_3 );
+            l1.add( s_4 );
+            l1.add( s_5 );
+            final DeleteableMsa dmsa1 = DeleteableMsa.createInstance( l1 );
+            dmsa1.deleteGapOnlyColumns();
+            dmsa1.deleteRow( "a" );
+            dmsa1.deleteRow( "f" );
+            dmsa1.deleteRow( "d" );
+            dmsa1.deleteGapOnlyColumns();
+            if ( !dmsa1.getSequenceAsString( 0 ).toString().equals( "B--C-" ) ) {
+                return false;
+            }
+            if ( !dmsa1.getSequenceAsString( 1 ).toString().equals( "CABCZ" ) ) {
+                return false;
+            }
+            if ( !dmsa1.getSequenceAsString( 2 ).toString().equals( "EAAC-" ) ) {
+                return false;
+            }
+            dmsa1.deleteRow( "c" );
+            dmsa1.deleteGapOnlyColumns();
+            final Writer w0 = new StringWriter();
+            dmsa1.write( w0, MSA_FORMAT.FASTA );
+            final Writer w1 = new StringWriter();
+            dmsa1.write( w1, MSA_FORMAT.PHYLIP );
+            if ( !dmsa1.getSequenceAsString( 0 ).toString().equals( "B--C" ) ) {
+                return false;
+            }
+            if ( !dmsa1.getSequenceAsString( 1 ).toString().equals( "EAAC" ) ) {
+                return false;
+            }
+            //
+            final Sequence s__0 = BasicSequence.createAaSequence( "a", "A------" );
+            final Sequence s__1 = BasicSequence.createAaSequence( "b", "BB-----" );
+            final Sequence s__2 = BasicSequence.createAaSequence( "c", "CCC----" );
+            final Sequence s__3 = BasicSequence.createAaSequence( "d", "DDDD---" );
+            final Sequence s__4 = BasicSequence.createAaSequence( "e", "EEEEE--" );
+            final Sequence s__5 = BasicSequence.createAaSequence( "f", "FFFFFF-" );
+            final List<Sequence> l2 = new ArrayList<Sequence>();
+            l2.add( s__0 );
+            l2.add( s__1 );
+            l2.add( s__2 );
+            l2.add( s__3 );
+            l2.add( s__4 );
+            l2.add( s__5 );
+            final DeleteableMsa dmsa2 = DeleteableMsa.createInstance( l2 );
+            dmsa2.deleteGapColumns( 0.5 );
+            if ( !dmsa2.getSequenceAsString( 0 ).toString().equals( "A---" ) ) {
+                return false;
+            }
+            if ( !dmsa2.getSequenceAsString( 1 ).toString().equals( "BB--" ) ) {
+                return false;
+            }
+            if ( !dmsa2.getSequenceAsString( 2 ).toString().equals( "CCC-" ) ) {
+                return false;
+            }
+            dmsa2.deleteGapColumns( 0.2 );
+            if ( !dmsa2.getSequenceAsString( 0 ).toString().equals( "A-" ) ) {
+                return false;
+            }
+            if ( !dmsa2.getSequenceAsString( 1 ).toString().equals( "BB" ) ) {
+                return false;
+            }
+            if ( !dmsa2.getSequenceAsString( 2 ).toString().equals( "CC" ) ) {
+                return false;
+            }
+            dmsa2.deleteGapColumns( 0 );
+            dmsa2.deleteRow( "a" );
+            dmsa2.deleteRow( "b" );
+            dmsa2.deleteRow( "f" );
+            dmsa2.deleteRow( "e" );
+            dmsa2.setIdentifier( 0, "new_c" );
+            dmsa2.setIdentifier( 1, "new_d" );
+            dmsa2.setResidueAt( 0, 0, 'x' );
+            dmsa2.deleteRow( "new_d" );
+            final Writer w = new StringWriter();
+            dmsa2.write( w, MSA_FORMAT.PHYLIP );
+            final String phylip = w.toString();
+            if ( !phylip.equals( "new_c x" + ForesterUtil.LINE_SEPARATOR ) ) {
+                return false;
+            }
+            final Writer w2 = new StringWriter();
+            dmsa2.write( w2, MSA_FORMAT.FASTA );
+            final String fasta = w2.toString();
+            if ( !fasta.equals( ">new_c" + ForesterUtil.LINE_SEPARATOR + "x" + ForesterUtil.LINE_SEPARATOR ) ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -6621,6 +7124,35 @@ public final class Test {
             if ( phylogenies[ 17 ].getNumberOfExternalNodes() != 10 ) {
                 return false;
             }
+            final NexusPhylogeniesParser p2 = new NexusPhylogeniesParser();
+            phylogenies = null;
+            phylogenies = factory.create( Test.PATH_TO_TEST_DATA + "S15613.nex", p2 );
+            if ( phylogenies.length != 9 ) {
+                return false;
+            }
+            if ( !isEqual( 0.48039661496919533, phylogenies[ 0 ].getNode( "Diadocidia_spinosula" )
+                    .getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.3959796191512233, phylogenies[ 0 ].getNode( "Diadocidia_stanfordensis" )
+                    .getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( !phylogenies[ 0 ].getName().equals( "Family Diadocidiidae MLT (Imported_tree_0)" ) ) {
+                return false;
+            }
+            if ( !phylogenies[ 1 ].getName().equals( "Family Diadocidiidae BAT (con_50_majrule)" ) ) {
+                return false;
+            }
+            if ( !phylogenies[ 2 ].getName().equals( "Family Diadocidiidae BAT (con_50_majrule)" ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.065284, phylogenies[ 7 ].getNode( "Bradysia_amoena" ).getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.065284, phylogenies[ 8 ].getNode( "Bradysia_amoena" ).getDistanceToParent() ) ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -6719,7 +7251,7 @@ public final class Test {
             if ( phy != null ) {
                 return false;
             }
-            ////
+            //
             p.setSource( Test.PATH_TO_TEST_DATA + "nexus_test_3.nex" );
             if ( !p.hasNext() ) {
                 return false;
@@ -6766,15 +7298,12 @@ public final class Test {
             if ( phy != null ) {
                 return false;
             }
-            ////
+            //
             p.setSource( Test.PATH_TO_TEST_DATA + "nexus_test_4_1.nex" );
-            //            if ( phylogenies.length != 18 ) {
-            //                return false;
-            //            }
-            //0
             if ( !p.hasNext() ) {
                 return false;
             }
+            //0
             phy = p.next();
             if ( phy == null ) {
                 return false;
@@ -6808,6 +7337,7 @@ public final class Test {
                 return false;
             }
             if ( phy.getNumberOfExternalNodes() != 3 ) {
+                System.out.println( phy.toString() );
                 return false;
             }
             if ( !phy.getName().equals( "" ) ) {
@@ -7185,6 +7715,82 @@ public final class Test {
             if ( phy.isRooted() ) {
                 return false;
             }
+            //
+            final NexusPhylogeniesParser p2 = new NexusPhylogeniesParser();
+            p2.setSource( Test.PATH_TO_TEST_DATA + "S15613.nex" );
+            // 0
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            if ( !isEqual( 0.48039661496919533, phy.getNode( "Diadocidia_spinosula" ).getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.3959796191512233, phy.getNode( "Diadocidia_stanfordensis" ).getDistanceToParent() ) ) {
+                return false;
+            }
+            // 1
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 2
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 3
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 4
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 5
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 6
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 7
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            // 8
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            if ( !isEqual( 0.065284, phy.getNode( "Bradysia_amoena" ).getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            if ( phy != null ) {
+                return false;
+            }
+            // 0
+            p2.reset();
+            if ( !p2.hasNext() ) {
+                return false;
+            }
+            phy = p2.next();
+            if ( !isEqual( 0.48039661496919533, phy.getNode( "Diadocidia_spinosula" ).getDistanceToParent() ) ) {
+                return false;
+            }
+            if ( !isEqual( 0.3959796191512233, phy.getNode( "Diadocidia_stanfordensis" ).getDistanceToParent() ) ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -7341,6 +7947,14 @@ public final class Test {
                     .equals( "Aranaeus" ) ) {
                 return false;
             }
+            phylogenies = factory.create( Test.PATH_TO_TEST_DATA + "S14117.nex", parser );
+            if ( phylogenies.length != 3 ) {
+                return false;
+            }
+            if ( !isEqual( phylogenies[ 2 ].getNode( "Aloysia lycioides 251-76-02169" ).getDistanceToParent(),
+                           0.00100049 ) ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -7360,10 +7974,10 @@ public final class Test {
             nhxp.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.NO );
             nhxp.setReplaceUnderscores( true );
             final Phylogeny uc0 = factory.create( "(A__A_,_B_B)", nhxp )[ 0 ];
-            if ( !uc0.getRoot().getChildNode( 0 ).getName().equals( "A A " ) ) {
+            if ( !uc0.getRoot().getChildNode( 0 ).getName().equals( "A A" ) ) {
                 return false;
             }
-            if ( !uc0.getRoot().getChildNode( 1 ).getName().equals( " B B" ) ) {
+            if ( !uc0.getRoot().getChildNode( 1 ).getName().equals( "B B" ) ) {
                 return false;
             }
             final Phylogeny p1b = factory
@@ -7654,14 +8268,14 @@ public final class Test {
             if ( p50.getNode( "A" ) == null ) {
                 return false;
             }
-            if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
+            if ( !p50.toNewHampshire( NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
                     .equals( "((A,B)ab:2.0[88],C);" ) ) {
                 return false;
             }
-            if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ).equals( "((A,B)ab:2.0,C);" ) ) {
+            if ( !p50.toNewHampshire( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ).equals( "((A,B)ab:2.0,C);" ) ) {
                 return false;
             }
-            if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.AS_INTERNAL_NODE_NAMES )
+            if ( !p50.toNewHampshire( NH_CONVERSION_SUPPORT_VALUE_STYLE.AS_INTERNAL_NODE_NAMES )
                     .equals( "((A,B)88:2.0,C);" ) ) {
                 return false;
             }
@@ -7679,13 +8293,63 @@ public final class Test {
             if ( p53.getNode( "B (x (a' ,b) f(x);" ) == null ) {
                 return false;
             }
-            // 
             final Phylogeny p54 = factory.create( new StringBuffer( "((A,B):[88],C)" ), new NHXParser() )[ 0 ];
             if ( p54.getNode( "A" ) == null ) {
                 return false;
             }
-            if ( !p54.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
-                    .equals( "((A,B)[88],C);" ) ) {
+            if ( !p54.toNewHampshire( NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS ).equals( "((A,B)[88],C);" ) ) {
+                return false;
+            }
+            final Phylogeny p55 = factory
+                    .create( new StringBuffer( "((\"lcl|HPV32_L1.:1  s\":0.195593,\"lcl|HPV30_L1.1|;a\":0.114237):0.0359322,\"lcl|HPV56_L1.1|,d\":0.0727412,\"lcl|HPV66_L1.1x\":0.0798012);" ),
+                             new NHXParser() )[ 0 ];
+            if ( !p55
+                    .toNewHampshire()
+                    .equals( "(('lcl|HPV32_L1.:1 s':0.195593,'lcl|HPV30_L1.1|;a':0.114237):0.0359322,'lcl|HPV56_L1.1|,d':0.0727412,lcl|HPV66_L1.1x:0.0798012);" ) ) {
+                System.out.println( p55.toNewHampshire() );
+                return false;
+            }
+            final Phylogeny p56 = factory
+                    .create( new StringBuffer( "((\"lcl|HPV32_L1.:1      s\":0.195593,\"lcl|HPV30_L1.1|;a\":0.114\n237):0.0359322,\"lcl|HPV56_L1.1|,d\":0.0727412,\"lcl|HPV66_L1.1:x\":0.0798012);" ),
+                             new NHXParser() )[ 0 ];
+            if ( !p56
+                    .toNewHampshire()
+                    .equals( "(('lcl|HPV32_L1.:1 s':0.195593,'lcl|HPV30_L1.1|;a':0.114237):0.0359322,'lcl|HPV56_L1.1|,d':0.0727412,'lcl|HPV66_L1.1:x':0.0798012);" ) ) {
+                System.out.println( p56.toNewHampshire() );
+                return false;
+            }
+            final Phylogeny p57 = factory
+                    .create( new StringBuffer( "((\"lcl|HPV32_L1.:1      s\":0.195593,\"lcl|HPV30_L1.1|;a\":0.114\n237):0.0359322,\"lcl|HPV56_L1.1|,d\":0.0727412,\"lcl|HPV66_L1.1:x\":0.0798012);" ),
+                             new NHXParser() )[ 0 ];
+            if ( !p57
+                    .toNewHampshire()
+                    .equals( "(('lcl|HPV32_L1.:1 s':0.195593,'lcl|HPV30_L1.1|;a':0.114237):0.0359322,'lcl|HPV56_L1.1|,d':0.0727412,'lcl|HPV66_L1.1:x':0.0798012);" ) ) {
+                System.out.println( p56.toNewHampshire() );
+                return false;
+            }
+            final String s58 = "('Homo \"man\" sapiens:1',\"Homo 'man' sapiens;\")';root \"1_ )';";
+            final Phylogeny p58 = factory.create( new StringBuffer( s58 ), new NHXParser() )[ 0 ];
+            if ( !p58.toNewHampshire().equals( s58 ) ) {
+                System.out.println( p58.toNewHampshire() );
+                return false;
+            }
+            final String s59 = "('Homo \"man sapiens:1',\"Homo 'man sapiens\")\"root; '1_ )\";";
+            final Phylogeny p59 = factory.create( new StringBuffer( s59 ), new NHXParser() )[ 0 ];
+            if ( !p59.toNewHampshire().equals( s59 ) ) {
+                System.out.println( p59.toNewHampshire() );
+                return false;
+            }
+            final String s60 = "('\" ;,:\":\"',\"'abc def' g's_\",'=:0.45+,.:%~`!@#$%^&*()_-+={} | ;,');";
+            final Phylogeny p60 = factory.create( new StringBuffer( s60 ), new NHXParser() )[ 0 ];
+            if ( !p60.toNewHampshire().equals( s60 ) ) {
+                System.out.println( p60.toNewHampshire() );
+                return false;
+            }
+            final String s61 = "('H[omo] \"man\" sapiens:1',\"H[omo] 'man' sapiens;\",H[omo] sapiens)';root \"1_ )';";
+            final Phylogeny p61 = factory.create( new StringBuffer( s61 ), new NHXParser() )[ 0 ];
+            if ( !p61.toNewHampshire()
+                    .equals( "('H{omo} \"man\" sapiens:1',\"H{omo} 'man' sapiens;\",Hsapiens)';root \"1_ )';" ) ) {
+                System.out.println( p61.toNewHampshire() );
                 return false;
             }
         }
@@ -8176,6 +8840,14 @@ public final class Test {
                 System.out.println( n6.toNewHampshireX() );
                 return false;
             }
+            final PhylogenyNode n7 = new PhylogenyNode();
+            n7.setName( "   gks:dr-m4 \"    '    `@:[]sadq04 " );
+            if ( !n7.toNewHampshire( true, PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
+                    .equals( "'gks:dr-m4 \" ` `@:[]sadq04'" ) ) {
+                System.out.println( n7
+                        .toNewHampshire( true, PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS ) );
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -8423,8 +9095,8 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n13 = PhylogenyNode
-                    .createInstanceFromNhxString( "blah_12345/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
-            if ( !n13.getName().equals( "blah_12345/1-2" ) ) {
+                    .createInstanceFromNhxString( "BLAH_12345/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+            if ( !n13.getName().equals( "BLAH_12345/1-2" ) ) {
                 return false;
             }
             if ( PhylogenyMethods.getSpecies( n13 ).equals( "12345" ) ) {
@@ -8489,7 +9161,7 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n19 = PhylogenyNode
-                    .createInstanceFromNhxString( "blah_1-roejojoej", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAH_1-roejojoej", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n19.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "1" ) ) {
                 return false;
             }
@@ -8497,7 +9169,7 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n30 = PhylogenyNode
-                    .createInstanceFromNhxString( "blah_1234567-roejojoej",
+                    .createInstanceFromNhxString( "BLAH_1234567-roejojoej",
                                                   NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n30.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "1234567" ) ) {
                 return false;
@@ -8506,7 +9178,7 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n31 = PhylogenyNode
-                    .createInstanceFromNhxString( "blah_12345678-roejojoej",
+                    .createInstanceFromNhxString( "BLAH_12345678-roejojoej",
                                                   NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( n31.getNodeData().isHasTaxonomy() ) {
                 return false;
@@ -8517,7 +9189,7 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n40 = PhylogenyNode
-                    .createInstanceFromNhxString( "bcl2_12345", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BCL2_12345", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n40.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "12345" ) ) {
                 return false;
             }
@@ -8612,6 +9284,12 @@ public final class Test {
             if ( !p10.toNewHampshireX().equals( "((A:0.2,B:0.3):0.5[&&NHX:B=91],C:0.1)root:0.1[&&NHX:B=100]" ) ) {
                 return false;
             }
+            final Phylogeny p11 = factory
+                    .create( " [79]   ( ('A: \" ' [co mment] :0 .2[comment],B:0.3[com])[com ment]: 0. 5 \t[ 9 1 ][ comment],C: 0.1)[comment]root:0.1[100] [comment]",
+                             new NHXParser() )[ 0 ];
+            if ( !p11.toNewHampshireX().equals( "(('A: \"':0.2,B:0.3):0.5[&&NHX:B=91],C:0.1)root:0.1[&&NHX:B=100]" ) ) {
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -8702,13 +9380,13 @@ public final class Test {
             if ( phy.getNodes( "'single quotes' inside double quotes" ).size() != 1 ) {
                 return false;
             }
-            if ( phy.getNodes( "double quotes inside single quotes" ).size() != 1 ) {
+            if ( phy.getNodes( "\"double quotes\" inside single quotes" ).size() != 1 ) {
                 return false;
             }
             if ( phy.getNodes( "noquotes" ).size() != 1 ) {
                 return false;
             }
-            if ( phy.getNodes( "A   (  B    C '" ).size() != 1 ) {
+            if ( phy.getNodes( "A ( B C '" ).size() != 1 ) {
                 return false;
             }
             final NHXParser p1p = new NHXParser();
@@ -8738,7 +9416,7 @@ public final class Test {
             final Phylogeny p10 = factory
                     .create( " [79]   ( (\"A \n\tB \" [co mment] :0 .2[comment],'B':0.3[com])[com ment]: 0. 5 \t[ 9 1 ][ comment],'C (or D?\\//;,))': 0.1)[comment]'\nroot is here (cool,  was! ) ':0.1[100] [comment]",
                              new NHXParser() )[ 0 ];
-            final String p10_clean_str = "(('A B':0.2,B:0.3):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool,  was! )':0.1[&&NHX:B=100]";
+            final String p10_clean_str = "(('A B':0.2,B:0.3):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100]";
             if ( !p10.toNewHampshireX().equals( p10_clean_str ) ) {
                 return false;
             }
@@ -8746,11 +9424,10 @@ public final class Test {
             if ( !p11.toNewHampshireX().equals( p10_clean_str ) ) {
                 return false;
             }
-            //
             final Phylogeny p12 = factory
                     .create( " [79]   ( (\"A \n\tB \" [[][] :0 .2[comment][\t&\t&\n N\tH\tX:S=mo\tnkey !],'\tB\t\b\t\n\f\rB B ':0.0\b3[])\t[com ment]: 0. 5 \t[ 9 1 ][ \ncomment],'C\t (or D?\\//;,))': 0.\b1)[comment]'\nroot \tis here (cool, \b\t\n\f\r was! ) ':0.1[100] [comment]",
                              new NHXParser() )[ 0 ];
-            final String p12_clean_str = "(('A B':0.2[&&NHX:S=monkey!],'BB B':0.03):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool,  was! )':0.1[&&NHX:B=100]";
+            final String p12_clean_str = "(('A B':0.2[&&NHX:S=monkey!],'BB B':0.03):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100]";
             if ( !p12.toNewHampshireX().equals( p12_clean_str ) ) {
                 return false;
             }
@@ -8758,7 +9435,7 @@ public final class Test {
             if ( !p13.toNewHampshireX().equals( p12_clean_str ) ) {
                 return false;
             }
-            final String p12_clean_str_nh = "(('A B':0.2,'BB B':0.03):0.5,'C (or D?\\//;,))':0.1)'root is here (cool,  was! )':0.1;";
+            final String p12_clean_str_nh = "(('A B':0.2,'BB B':0.03):0.5,'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1;";
             if ( !p13.toNewHampshire().equals( p12_clean_str_nh ) ) {
                 return false;
             }
@@ -11578,7 +12255,7 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n3 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_12345", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_12345", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n3.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "12345" ) ) {
                 System.out.println( n3.toString() );
                 return false;
@@ -11596,43 +12273,43 @@ public final class Test {
                 return false;
             }
             final PhylogenyNode n6 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag-12345-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG-12345-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( n6.getNodeData().isHasTaxonomy() ) {
                 System.out.println( n6.toString() );
                 return false;
             }
             final PhylogenyNode n7 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag-12345_blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG-12345_blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( n7.getNodeData().isHasTaxonomy() ) {
                 System.out.println( n7.toString() );
                 return false;
             }
             final PhylogenyNode n8 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_12345-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_12345-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n8.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "12345" ) ) {
                 System.out.println( n8.toString() );
                 return false;
             }
             final PhylogenyNode n9 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_12345/blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_12345/blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n9.getNodeData().getTaxonomy().getIdentifier().getValue().equals( "12345" ) ) {
                 System.out.println( n9.toString() );
                 return false;
             }
             final PhylogenyNode n10x = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_12X45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_12X45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( n10x.getNodeData().isHasTaxonomy() ) {
                 System.out.println( n10x.toString() );
                 return false;
             }
             final PhylogenyNode n10xx = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_1YX45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_1YX45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( n10xx.getNodeData().isHasTaxonomy() ) {
                 System.out.println( n10xx.toString() );
                 return false;
             }
             final PhylogenyNode n10 = PhylogenyNode
-                    .createInstanceFromNhxString( "blag_9YX45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
+                    .createInstanceFromNhxString( "BLAG_9YX45-blag", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
             if ( !n10.getNodeData().getTaxonomy().getTaxonomyCode().equals( "9YX45" ) ) {
                 System.out.println( n10.toString() );
                 return false;
@@ -11656,6 +12333,98 @@ public final class Test {
                 System.out.println( n13.toString() );
                 return false;
             }
+            final PhylogenyNode n14 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus_musculus_392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n14.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus" ) ) {
+                System.out.println( n14.toString() );
+                return false;
+            }
+            final PhylogenyNode n15 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus_musculus_K392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n15.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus" ) ) {
+                System.out.println( n15.toString() );
+                return false;
+            }
+            final PhylogenyNode n16 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus musculus 392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n16.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus" ) ) {
+                System.out.println( n16.toString() );
+                return false;
+            }
+            final PhylogenyNode n17 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus musculus K392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n17.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus" ) ) {
+                System.out.println( n17.toString() );
+                return false;
+            }
+            //
+            final PhylogenyNode n18 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus_musculus_musculus_392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n18.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus musculus" ) ) {
+                System.out.println( n18.toString() );
+                return false;
+            }
+            final PhylogenyNode n19 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus_musculus_musculus_K392",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n19.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus musculus" ) ) {
+                System.out.println( n19.toString() );
+                return false;
+            }
+            final PhylogenyNode n20 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus musculus musculus 392", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n20.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus musculus" ) ) {
+                System.out.println( n20.toString() );
+                return false;
+            }
+            final PhylogenyNode n21 = PhylogenyNode
+                    .createInstanceFromNhxString( "Mus musculus musculus K392",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n21.getNodeData().getTaxonomy().getScientificName().equals( "Mus musculus musculus" ) ) {
+                System.out.println( n21.toString() );
+                return false;
+            }
+            final PhylogenyNode n22 = PhylogenyNode
+                    .createInstanceFromNhxString( "NEMVE_Nematostella_vectensis",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n22.getNodeData().getTaxonomy().getTaxonomyCode().equals( "NEMVE" ) ) {
+                System.out.println( n22.toString() );
+                return false;
+            }
+            final PhylogenyNode n23 = PhylogenyNode
+                    .createInstanceFromNhxString( "9EMVE_Nematostella_vectensis",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n23.getNodeData().getTaxonomy().getScientificName().equals( "Nematostella vectensis" ) ) {
+                System.out.println( n23.toString() );
+                return false;
+            }
+            final PhylogenyNode n24 = PhylogenyNode
+                    .createInstanceFromNhxString( "9EMVE_Nematostella", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n24.getNodeData().getTaxonomy().getTaxonomyCode().equals( "9EMVE" ) ) {
+                System.out.println( n24.toString() );
+                return false;
+            }
+            //
+            final PhylogenyNode n25 = PhylogenyNode
+                    .createInstanceFromNhxString( "Nematostella_vectensis_NEMVE",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n25.getNodeData().getTaxonomy().getTaxonomyCode().equals( "NEMVE" ) ) {
+                System.out.println( n25.toString() );
+                return false;
+            }
+            final PhylogenyNode n26 = PhylogenyNode
+                    .createInstanceFromNhxString( "Nematostella_vectensis_9EMVE",
+                                                  NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n26.getNodeData().getTaxonomy().getScientificName().equals( "Nematostella vectensis" ) ) {
+                System.out.println( n26.toString() );
+                return false;
+            }
+            final PhylogenyNode n27 = PhylogenyNode
+                    .createInstanceFromNhxString( "Nematostella_9EMVE", NHXParser.TAXONOMY_EXTRACTION.AGGRESSIVE );
+            if ( !n27.getNodeData().getTaxonomy().getTaxonomyCode().equals( "9EMVE" ) ) {
+                System.out.println( n27.toString() );
+                return false;
+            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );