2 package org.forester.applications;
6 import java.io.IOException;
7 import java.util.HashMap;
10 import org.forester.archaeopteryx.Archaeopteryx;
11 import org.forester.io.parsers.PhylogenyParser;
12 import org.forester.io.parsers.util.ParserUtils;
13 import org.forester.phylogeny.Phylogeny;
14 import org.forester.phylogeny.PhylogenyMethods;
15 import org.forester.phylogeny.data.BranchColor;
16 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
18 public class wiki_examples {
20 public static void main( final String[] args ) {
21 // Reading-in of (a) tree(s) from a file.
22 final File treefile = new File( args[ 0 ] );
23 PhylogenyParser parser = null;
25 parser = ParserUtils.createParserDependingOnFileType( treefile, true );
27 catch ( final IOException e ) {
30 Phylogeny[] phys = null;
32 phys = PhylogenyMethods.readPhylogenies( parser, treefile );
34 catch ( final IOException e ) {
37 final Phylogeny phy = phys[ 0 ];
38 // Read node->color map into a map
39 final Map<String, Color> colors = new HashMap<String, Color>();
40 // read it in from file...
41 // Iterate over nodes and set colors from 'colors' map
42 for( final PhylogenyNodeIterator it = phy.iteratorPostorder(); it.hasNext(); ) {
43 // if node-name (?) in 'colors' map
44 it.next().getBranchData().setBranchColor( new BranchColor( colors.get( "xx" ) ) );
46 // For testing, use Aptx...
47 Archaeopteryx.createApplication( phy );