[Phylobase-commits] r129 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 28 14:50:52 CET 2008


Author: jombart
Date: 2008-02-28 14:50:51 +0100 (Thu, 28 Feb 2008)
New Revision: 129

Modified:
   pkg/R/phylo4.R
   pkg/man/phylo4-class.Rd
   pkg/man/phylo4.Rd
Log:
Summary of phylo4 now provides information about polytomies in a readable way.
$degree and $polytomy documented.


Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-02-28 10:29:19 UTC (rev 128)
+++ pkg/R/phylo4.R	2008-02-28 13:50:51 UTC (rev 129)
@@ -369,9 +369,16 @@
         terminPoly <- (degree>2) & endsAtATip
         internPoly <- (degree>2) & !endsAtATip
         res$degree <- degree
-        res$polytomy <- rep("no poly.",nrow(E))
-        res$polytomy[terminPoly] <- "terminal poly."
-        res$polytomy[internPoly] <- "internal poly."
+        res$polytomy <- rep("none",nrow(E))
+        res$polytomy[terminPoly] <- "terminal"
+        res$polytomy[internPoly] <- "internal"
+        ## now just keep information about nodes (not all edges)
+        nod <- unique(E[,1])
+        idx <- match(nod,E[,1])
+        res$degree <- res$degree[idx]
+        names(res$degree) <- NodeLabels(x)
+        res$polytomy <- res$polytomy[idx]
+        names(res$polytomy) <- NodeLabels(x)
     }
     
     ## model info
@@ -379,7 +386,7 @@
     res$para <- attr(x, "para")
     res$xi <- attr(x, "xi")
     
-    ## if quiet, stop here                                        
+    ## if quiet, stop here
     if(quiet) return(invisible(res))
     
     if(!is.null(x$root.edge)){
@@ -393,7 +400,7 @@
     cat(" Number of nodes   :", res$nb.nodes, "\n")
     ## cat("  ")
     if(is.null(x$edge.length)) {
-        cat(" Branch lengths      : No branch lengths.\n")
+        cat(" Branch lengths    : No branch lengths.\n")
     } else {
         cat(" Branch lengths:\n")
         cat("        mean         :", res$mean.el, "\n")
@@ -402,8 +409,12 @@
         print(res$sumry.el)
     }
     if(hasPoly(x)){
-        cat("\nDegree of the nodes  :", res$degree, "\n")
-        cat("Polytomies at the nodes:", res$polytomy, "\n")
+        cat("\nDegree of the nodes  :\n")
+        print(res$degree)
+        cat("\n")
+        cat("Types of polytomy:\n")
+        print(res$polytomy)
+        cat("\n")
     }
     
     if (!is.null(attr(x, "loglik"))) {

Modified: pkg/man/phylo4-class.Rd
===================================================================
--- pkg/man/phylo4-class.Rd	2008-02-28 10:29:19 UTC (rev 128)
+++ pkg/man/phylo4-class.Rd	2008-02-28 13:50:51 UTC (rev 129)
@@ -55,6 +55,12 @@
     - \code{var.el}: variance of edge lengths (estimate for population) \cr
     - \code{sumry.el}: summary (i.e. range and quartiles) of the edge
     lengths \cr
+    - \code{degree}: (optionnal) degree (i.e. number of descendents) of
+    each node; displayed only when there are polytomies \cr
+    - \code{polytomy}: (optionnal) type of polytomy for each node:
+    'node', 'terminal' (all descendents are tips) or internal (at least
+    one descendent is an internal node); displayed only when there are
+    polytomies \cr
 
    The \code{names} method returns a vector of characters corresponding
    to the names of the slots.
@@ -70,5 +76,12 @@
   P1
   sumryP1 = summary(P1)
   sumryP1
+
+  ## summary of a polytomic tree
+  E <- matrix(c(8,9,10,10,9,9,8,11,11,11,9,10,1,2,3,4,11,5,6,7),ncol=2)
+  P2 <- phylo4(E)
+  plot(P2,show.node=TRUE)
+  sumryP2 <- summary(P2)
+  sumryP2
 }
 \keyword{classes}

Modified: pkg/man/phylo4.Rd
===================================================================
--- pkg/man/phylo4.Rd	2008-02-28 10:29:19 UTC (rev 128)
+++ pkg/man/phylo4.Rd	2008-02-28 13:50:51 UTC (rev 129)
@@ -2,7 +2,7 @@
 \alias{phylo4}
 \title{ create a phylogenetic tree object }
 \description{
-  The phylo4() function creates a phylogenetic tree object for use in phylobase methods. Phylobase contains functions for input of phylogenetic trees and data, manipulation of these objects including pruning and subsetting, and plotting. The phylobase package also contains translation functions to forms used in other comparative phylogenetic method packages.
+  The \code{phylo4} function creates a phylogenetic tree object for use in phylobase methods. Phylobase contains functions for input of phylogenetic trees and data, manipulation of these objects including pruning and subsetting, and plotting. The phylobase package also contains translation functions to forms used in other comparative phylogenetic method packages.
 }
 \usage{
 phylo4(edge, edge.length = NULL, tip.label = NULL, node.label = NULL, edge.label = NULL, root.edge = NULL, ...)



More information about the Phylobase-commits mailing list