From 559cc4858d1a9a8257c7c8d11607507d929fcdb6 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Sat, 15 Feb 2014 01:21:27 +0000 Subject: [PATCH] inprogress --- forester/java/src/org/forester/io/parsers/nhx/NHXParser.java | 4 +++- forester/java/src/org/forester/test/Test.java | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java index 2e2caf9..3309661 100644 --- a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java +++ b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java @@ -263,7 +263,6 @@ public final class NHXParser implements PhylogenyParser, IteratingPhylogenyParse private final Phylogeny finishPhylogeny() throws PhylogenyParserException, NHXFormatException, PhyloXmlDataFormatException { - System.out.println( "finishPhylogeny()" + _current_phylogeny ); if ( _current_phylogeny != null ) { parseNHX( _current_anotation != null ? _current_anotation.toString() : "", _current_phylogeny.getRoot(), @@ -281,6 +280,7 @@ public final class NHXParser implements PhylogenyParser, IteratingPhylogenyParse _current_phylogeny.setRooted( true ); } } + System.out.println( "finishPhylogeny()" + _current_phylogeny ); return _current_phylogeny; } return null; @@ -425,6 +425,7 @@ public final class NHXParser implements PhylogenyParser, IteratingPhylogenyParse throw new PhylogenyParserException( "error in NH (Newick) formatted data: most likely cause: number of open parens does not equal number of close parens" ); } if ( _current_phylogeny != null ) { + System.out.println( "getNext() going to call finishPhylogeny()" ); _next = finishPhylogeny(); _current_phylogeny = null; _current_anotation = null; @@ -507,6 +508,7 @@ public final class NHXParser implements PhylogenyParser, IteratingPhylogenyParse final PhylogenyNode new_node = new PhylogenyNode(); if ( _clade_level == 0 ) { if ( _current_phylogeny != null ) { + System.out.println( "processOpenParen() going to call finishPhylogeny()" ); phy = finishPhylogeny(); } _clade_level = 1; diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index e7aa418..d39c9ea 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -50,7 +50,6 @@ import org.forester.io.parsers.FastaParser; import org.forester.io.parsers.GeneralMsaParser; import org.forester.io.parsers.HmmscanPerDomainTableParser; import org.forester.io.parsers.HmmscanPerDomainTableParser.INDIVIDUAL_SCORE_CUTOFF; -import org.forester.io.parsers.PhylogenyParser; import org.forester.io.parsers.nexus.NexusBinaryStatesMatrixParser; import org.forester.io.parsers.nexus.NexusCharactersParser; import org.forester.io.parsers.nexus.NexusPhylogeniesParser; @@ -407,14 +406,14 @@ public final class Test { 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 PhylogenyParser parser = ParserUtils.createParserDependingOnUrlContents( u, true ); - final Phylogeny[] phys = factory.create( u.openStream(), parser ); + // final PhylogenyParser parser = new NHXParser(); + final Phylogeny[] phys = factory.create( u.openStream(), new NHXParser() ); System.out.println( "results 1:" ); for( final Phylogeny phy : phys ) { System.out.println( phy.toString() ); } System.out.println( "" ); - final Phylogeny[] phys3 = factory.create( "((a,b),c)", parser ); + final Phylogeny[] phys3 = factory.create( "((a,b),c)", new NHXParser() ); System.out.println( "results 3:" ); for( final Phylogeny phy : phys3 ) { System.out.println( phy.toString() ); -- 1.7.10.2