+= forester Tutorial and Examples =
+<wiki:toc max_depth="3" />
+
= Introduction =
Under development!
import org.forester.phylogeny.Phylogeny;
import org.forester.util.ForesterUtil;
-public class Example4 {
+public class Example {
public static void main( final String[] args ) {
// Reading-in of (a) tree(s) from a file.
import org.forester.phylogeny.Phylogeny;
import org.forester.util.ForesterUtil;
-public class Example1 {
+public class Example {
public static void main( final String[] args ) {
// Reading-in of (a) tree(s) from a file.
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
-public class Example2 {
+public class Example {
public static void main( final String[] args ) {
// Creating a new rooted tree with two external nodes.
-= Using iterators to visit tree nodes in certain orders=
+= Using iterators to visit tree nodes in certain orders =
This needs file "forester.jar" to be in the class-path.
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
-public class Example3 {
+public class Example {
public static void main( final String[] args ) {
// Creating a new rooted tree with four external nodes.
}
}
+}}}
+
+
+
+
+
+
+
+
+
+= Creating a basic gene tree (with branch lengths) =
+
+This needs file "forester.jar" to be in the class-path.
+
+{{{
+
+package examples;
+
+import org.forester.archaeopteryx.Archaeopteryx;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.data.Sequence;
+import org.forester.phylogeny.data.Taxonomy;
+
+public class Example {
+
+ public static void main( final String[] args ) {
+ // Creating a new rooted tree with two external nodes.
+ final Phylogeny phy = new Phylogeny();
+ final PhylogenyNode root = new PhylogenyNode();
+ final PhylogenyNode d1 = new PhylogenyNode();
+ final PhylogenyNode d2 = new PhylogenyNode();
+ // Setting of distances.
+ d1.setDistanceToParent( 1.2 );
+ d2.setDistanceToParent( 2.4 );
+ // Adding species information.
+ final Taxonomy t1 = new Taxonomy();
+ t1.setScientificName( "Nematostella vectensis" );
+ d1.getNodeData().addTaxonomy( t1 );
+ final Taxonomy t2 = new Taxonomy();
+ t2.setScientificName( "Monosiga brevicollis" );
+ d2.getNodeData().addTaxonomy( t2 );
+ // Adding gene names.
+ final Sequence s1 = new Sequence();
+ s1.setName( "Bcl-2" );
+ d1.getNodeData().addSequence( s1 );
+ final Sequence s2 = new Sequence();
+ s2.setName( "Bcl-2" );
+ d2.getNodeData().addSequence( s2 );
+ // Root is a speciation.
+ final Event ev = new Event();
+ ev.setSpeciations( 1 );
+ ev.setDuplications( 0 );
+ root.getNodeData().setEvent( ev );
+ // Putting the tree together.
+ root.addAsChild( d1 );
+ root.addAsChild( d2 );
+ phy.setRoot( root );
+ phy.setRooted( true );
+ // Displaying the newly created tree with Archaeopteryx.
+ Archaeopteryx.createApplication( phy );
+ }
+}
+
}}}
\ No newline at end of file