Edited wiki page forester through web user interface.
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 9 Jun 2011 22:43:34 +0000 (22:43 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 9 Jun 2011 22:43:34 +0000 (22:43 +0000)
wiki/forester.wiki

index 501ce08..ca89628 100644 (file)
@@ -145,7 +145,7 @@ public class Example2 {
 
 
 
 
 
 
-= 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.
 
 
 This needs file "forester.jar" to be in the class-path.
 
@@ -198,4 +198,65 @@ public class Example3 {
     }
 }
 
     }
 }
 
-}}}
\ No newline at end of file
+}}}
+
+
+
+
+
+
+
+
+
+= 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 Example5 {
+
+    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.addAsChild( d1 );
+        root.addAsChild( d2 );
+        phy.setRoot( root );
+        phy.setRooted( true );
+        // Displaying the newly created tree with Archaeopteryx.
+        Archaeopteryx.createApplication( phy );
+    }
+}
+
+}}}
+
+
+