537e2d82f18af2c297582e202005a00c933ab3ee
[jalview.git] / wiki / forester.wiki
1 = Introduction =
2
3 Under development!
4
5 Documentation, tutorial, and examples for [http://www.phylosoft.org/forester/ forester].
6
7 Author: [http://www.cmzmasek.net/ Christian M Zmasek], Sanford-Burnham Medical Research Institute
8
9  
10 Copyright (C) 2011 Christian M Zmasek. All rights reserved.
11
12
13 = Parsing of Phylogenetic Trees and Displaying them with Archaeopteryx =
14
15 This needs file "forester.jar" to be in the class-path.
16
17 {{{
18
19 package examples;
20
21 import java.io.File;
22 import java.io.IOException;
23
24 import org.forester.archaeopteryx.Archaeopteryx;
25 import org.forester.io.parsers.PhylogenyParser;
26 import org.forester.phylogeny.Phylogeny;
27 import org.forester.util.ForesterUtil;
28
29 public class Example1 {
30
31     public static void main( final String[] args ) {
32         // Reads in (a) tree(s) from a file.
33         final File treefile = new File( "/path/to/tree.xml" );
34         PhylogenyParser parser = null;
35         try {
36             parser = ForesterUtil.createParserDependingOnFileType( treefile, true );
37         }
38         catch ( final IOException e ) {
39             e.printStackTrace();
40         }
41         Phylogeny[] phys = null;
42         try {
43             phys = ForesterUtil.readPhylogenies( parser, treefile );
44         }
45         catch ( final IOException e ) {
46             e.printStackTrace();
47         }
48         // Display of the tree(s) with Archaeopteryx.
49         Archaeopteryx.createApplication( phys );
50     }
51 }
52
53 }}}