inprogress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 19 Feb 2014 02:20:44 +0000 (02:20 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 19 Feb 2014 02:20:44 +0000 (02:20 +0000)
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java
forester/java/src/org/forester/archaeopteryx/Constants.java
forester/java/src/org/forester/test/Test.java

index 623a83e..14cb729 100644 (file)
@@ -709,18 +709,17 @@ public final class AptxUtil {
         }
         AptxUtil.printAppletMessage( "Archaeopteryx", "parser is " + parser.getName() );
         final Phylogeny[] phys = factory.create( url.openStream(), parser );
-        for( final Phylogeny phy : phys ) {
-            System.out.println( phy.toString() );
-        }
-        if ( nhx_or_nexus && internal_numbers_are_confidences ) {
-            for( final Phylogeny phy : phys ) {
-                PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+        if ( phys != null ) {
+            if ( nhx_or_nexus && internal_numbers_are_confidences ) {
+                for( final Phylogeny phy : phys ) {
+                    PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+                }
             }
-        }
-        if ( midpoint_reroot ) {
-            for( final Phylogeny phy : phys ) {
-                PhylogenyMethods.midpointRoot( phy );
-                PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
+            if ( midpoint_reroot ) {
+                for( final Phylogeny phy : phys ) {
+                    PhylogenyMethods.midpointRoot( phy );
+                    PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
+                }
             }
         }
         return phys;
index a471f2f..1ec5d96 100644 (file)
@@ -141,6 +141,15 @@ public class ArchaeopteryxA extends JApplet {
                     .isValidatePhyloXmlAgainstSchema(), configuration.isReplaceUnderscoresInNhParsing(), configuration
                     .isInternalNumberAreConfidenceForNhParsing(), configuration.getTaxonomyExtraction(), configuration
                     .isMidpointReroot() );
+            if ( phys == null ) {
+                ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + tree_url + "] are null" );
+            }
+            else if ( phys.length < 1 ) {
+                ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + tree_url + "] are empty" );
+            }
+            else {
+                AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + tree_url );
+            }
             AptxUtil.printAppletMessage( ArchaeopteryxA.NAME, "loaded " + phys.length + " phylogenies from: "
                     + tree_url );
             AptxUtil.addPhylogeniesToTabs( phys,
index ff9f835..fc8459e 100644 (file)
@@ -42,8 +42,8 @@ public final class Constants {
     public final static boolean __SYNTH_LF                                                    = false;                                                               // TODO remove me
     public final static boolean ALLOW_DDBJ_BLAST                                              = false;
     public final static String  PRG_NAME                                                      = "Archaeopteryx";
-    final static String         VERSION                                                       = "0.984 FX";
-    final static String         PRG_DATE                                                      = "140121";
+    final static String         VERSION                                                       = "0.985 CC";
+    final static String         PRG_DATE                                                      = "140218";
     final static String         DEFAULT_CONFIGURATION_FILE_NAME                               = "_aptx_configuration_file";
     final static String[]       DEFAULT_FONT_CHOICES                                          = { "Arial", "Helvetica",
             "Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans"  };
index ed1daa1..729d5b8 100644 (file)
@@ -958,6 +958,15 @@ public final class Test {
             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.println();
         final Runtime rt = java.lang.Runtime.getRuntime();
         final long free_memory = rt.freeMemory() / 1000000;
@@ -1075,6 +1084,22 @@ 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";