[Ecopd-commits] r51 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 26 19:06:34 CET 2009


Author: regetz
Date: 2009-10-26 19:06:34 +0100 (Mon, 26 Oct 2009)
New Revision: 51

Modified:
   pkg/R/utilities.R
Log:
removed getAncestralLength and nodes functions (phylobase methods can
now be used to achieve the same results)


Modified: pkg/R/utilities.R
===================================================================
--- pkg/R/utilities.R	2009-10-26 17:38:52 UTC (rev 50)
+++ pkg/R/utilities.R	2009-10-26 18:06:34 UTC (rev 51)
@@ -1,59 +1,3 @@
-nodes <- function(tree, which=c("all", "internal", "tip"),
-  include.root=TRUE) {
-
-  which <- match.arg(which)
-
-  x <- as(tree, "data.frame")
-  node.type <- x$node.type
-  node <- x$node
-  names(node) <- x$label
-
-  tip.nodes <- node[node.type=="tip"]
-  if (which=="tip") {
-    return(tip.nodes)
-  }
-
-  int.nodes <- node[node.type=="internal"]
-  if (include.root) {
-    root <- node[node.type=="root"]
-    int.nodes <- c(root, int.nodes)
-  }
-
-  if (which=="internal") {
-    return(int.nodes)
-  } else if (which=="all") {
-    return(c(int.nodes, tip.nodes))
-  }
-
-  stop("internal error, contact package maintainer")
-
-}
-
-#
-# TODO: Make sure nothing funny is going on here wrt the order of nodes
-# as reported
-#
-ancestralEdgeLength <- function(tree, node=NULL) {
-  E <- edges(tree)
-  ancestor <- E[, 1]
-  if (is.null(node)) {
-    node <- E[,2]
-  } else if (!all(node %in% E)) {
-    stop("one or more nodes not found in tree")
-  }
-  ## retrieve the ancestor of each node
-  idx <- match(node, E[, 2]) # new ordering of the descendants/edges
-  ## if (length(ancestor)>0) ancestor <- c(NA, ancestor)
-  ancestor <- E[idx, 1]
-  ## branch.length <- c(x at root.edge, x at edge.length) # root.edge is not an edge length
-  branch.length <- edgeLength(tree)[idx]
-  if (is.null(edgeLength(tree))) {
-    branch.length <- rep(NA, length(node))
-  }
-  names(branch.length) <- node
-  return(branch.length)
-}
-
 # internal function to compute distances from one node to all others
 # NOTE: assumes node IDs are always 1:n (currently true of phylo4 objs)
 dijkstra <- function(phy, node) {



More information about the Ecopd-commits mailing list