[Phylobase-commits] r290 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 20 18:47:20 CET 2008
Author: francois
Date: 2008-11-20 18:47:17 +0100 (Thu, 20 Nov 2008)
New Revision: 290
Modified:
pkg/R/methods-phylo4.R
pkg/R/phylo4.R
Log:
add sumEdgeLength mehtod
Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R 2008-11-06 07:57:20 UTC (rev 289)
+++ pkg/R/methods-phylo4.R 2008-11-20 17:47:17 UTC (rev 290)
@@ -68,6 +68,17 @@
else x at edge.length
})
+setMethod("sumEdgeLength", "phylo4", function(phy, node) {
+ if(!hasEdgeLength(phy))
+ NULL
+ else {
+ nd <- getnodes(phy, node)
+ iEdges <- which(phy at edge[,2] %in% nd)
+ sumEdges <- sum(phy at edge.length[iEdges])
+ sumEdges
+ }
+})
+
setMethod("hasNodeLabels", "phylo4", function(x) {
length(x at node.label) > 0
})
Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R 2008-11-06 07:57:20 UTC (rev 289)
+++ pkg/R/phylo4.R 2008-11-20 17:47:17 UTC (rev 290)
@@ -34,6 +34,10 @@
standardGeneric("edgeLength")
})
+setGeneric("sumEdgeLength", function(phy, node) {
+ standardGeneric("sumEdgeLength")
+})
+
setGeneric("hasNodeLabels", function(x) {
standardGeneric("hasNodeLabels")
})
More information about the Phylobase-commits
mailing list