From 7359853f540f8d2704930c90e0ea9b6969bde51b Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 19 Feb 2014 02:20:44 +0000 Subject: [PATCH] inprogress --- .../src/org/forester/archaeopteryx/AptxUtil.java | 21 ++++++++-------- .../org/forester/archaeopteryx/ArchaeopteryxA.java | 9 +++++++ .../src/org/forester/archaeopteryx/Constants.java | 4 ++-- forester/java/src/org/forester/test/Test.java | 25 ++++++++++++++++++++ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java index 623a83e..14cb729 100644 --- a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java +++ b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java @@ -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; diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java index a471f2f..1ec5d96 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java @@ -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, diff --git a/forester/java/src/org/forester/archaeopteryx/Constants.java b/forester/java/src/org/forester/archaeopteryx/Constants.java index ff9f835..fc8459e 100644 --- a/forester/java/src/org/forester/archaeopteryx/Constants.java +++ b/forester/java/src/org/forester/archaeopteryx/Constants.java @@ -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" }; diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index ed1daa1..729d5b8 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -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"; -- 1.7.10.2