work for rrm project (ComPhy 2012 Moscow)
[jalview.git] / forester / java / src / org / forester / application / phyloxml_converter.java
index afa7dd7..25497ec 100644 (file)
@@ -34,10 +34,12 @@ import java.util.List;
 import org.forester.io.parsers.PhylogenyParser;
 import org.forester.io.parsers.nexus.NexusPhylogeniesParser;
 import org.forester.io.parsers.nhx.NHXParser;
+import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
 import org.forester.io.parsers.util.ParserUtils;
 import org.forester.io.writers.PhylogenyWriter;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
 import org.forester.phylogeny.factories.PhylogenyFactory;
@@ -73,7 +75,7 @@ public class phyloxml_converter {
     final static private String  WWW                               = "www.phylosoft.org/forester/";
     final static private boolean SPECIAL                           = false;
 
-    public static void main( final String args[] ) {
+    public static void main( final String args[] ) throws PhyloXmlDataFormatException {
         ForesterUtil.printProgramInformation( PRG_NAME, PRG_VERSION, PRG_DATE, E_MAIL, WWW );
         CommandLineArguments cla = null;
         try {
@@ -237,7 +239,7 @@ public class phyloxml_converter {
         }
         if ( field != null ) {
             for( final Phylogeny phy : phys ) {
-                PhylogenyMethods.transferNodeNameToField( phy, field );
+                PhylogenyMethods.transferNodeNameToField( phy, field, false );
             }
         }
         if ( midpoint_reroot ) {
@@ -253,7 +255,10 @@ public class phyloxml_converter {
         }
         if ( order_subtrees ) {
             for( final Phylogeny phy : phys ) {
-                phy.orderAppearance( true );
+                PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.TAXONOMY );
+                phy.externalNodesHaveChanged();
+                phy.clearHashIdToNodeMap();
+                phy.recalculateNumberOfExternalDescendants( true );
             }
         }
         try {