X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fapplication%2Fsimple_node_processor.java;h=a190edfb84d2413193d3ae30db6948b3d4c718bb;hb=4e202b796a689419621ddc2c3934797c39af9026;hp=3f713dccd0eb0277d50ea902f6385223ccb9efc4;hpb=eee996a6476a1e3d84c07f8f690dcde3ff4b2ef5;p=jalview.git diff --git a/forester/java/src/org/forester/application/simple_node_processor.java b/forester/java/src/org/forester/application/simple_node_processor.java index 3f713dc..a190edf 100644 --- a/forester/java/src/org/forester/application/simple_node_processor.java +++ b/forester/java/src/org/forester/application/simple_node_processor.java @@ -28,7 +28,6 @@ package org.forester.application; import java.io.File; import org.forester.io.parsers.phyloxml.PhyloXmlParser; -import org.forester.io.writers.PhylogenyWriter; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; @@ -41,18 +40,17 @@ public class simple_node_processor { private final static String BASE = "b_"; public static void main( final String args[] ) { - if ( ( args.length != 2 ) ) { - System.exit( -1 ); - } + File in = null; + final File out = null; try { CommandLineArguments cla = null; cla = new CommandLineArguments( args ); - final File in = cla.getFile( 0 ); - final File out = cla.getFile( 1 ); - if ( out.exists() ) { - System.out.println( out + " already exists" ); - System.exit( -1 ); - } + in = cla.getFile( 0 ); + // out = cla.getFile( 1 ); + // if ( out.exists() ) { + // System.out.println( out + " already exists" ); + // System.exit( -1 ); + // } final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); final PhyloXmlParser xml_parser = new PhyloXmlParser(); final Phylogeny[] phylogenies_0 = factory.create( in, xml_parser ); @@ -64,8 +62,8 @@ public class simple_node_processor { processNode( node, i ); i++; } - final PhylogenyWriter writer = new PhylogenyWriter(); - writer.toPhyloXML( out, phylogeny_0, 0 ); + // final PhylogenyWriter writer = new PhylogenyWriter(); + // writer.toPhyloXML( out, phylogeny_0, 0 ); } catch ( final Exception e ) { System.out.println( e.getLocalizedMessage() ); @@ -74,12 +72,19 @@ public class simple_node_processor { } } + // private static void processNode( final PhylogenyNode node, final int i ) { + // node.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT ); + // if ( !node.isExternal() ) { + // if ( ( node.getName() == null ) || node.getName().isEmpty() ) { + // node.setName( BASE + i ); + // } + // } + // } private static void processNode( final PhylogenyNode node, final int i ) { - node.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT ); - if ( !node.isExternal() ) { - if ( ( node.getName() == null ) || node.getName().isEmpty() ) { - node.setName( BASE + i ); - } + if ( node.isExternal() ) { + final String c = "" + node.getNodeData().getBinaryCharacters().getPresentCount(); + final String s = node.getNodeData().getTaxonomy().getScientificName(); + System.out.println( s + "\t" + c ); } } }