[Ecopd-commits] r84 - branches/single-tree/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Nov 18 19:33:58 CET 2009
Author: regetz
Date: 2009-11-18 19:33:57 +0100 (Wed, 18 Nov 2009)
New Revision: 84
Modified:
branches/single-tree/R/pd.R
Log:
superficial rearrangement of (temporary) error checking code in pd
Modified: branches/single-tree/R/pd.R
===================================================================
--- branches/single-tree/R/pd.R 2009-11-18 18:24:45 UTC (rev 83)
+++ branches/single-tree/R/pd.R 2009-11-18 18:33:57 UTC (rev 84)
@@ -28,11 +28,17 @@
setMethod("pd", signature(x="phylo4com"), function(x,
method=c("traditional", "polytomy", "yule")) {
+ method <- match.arg(method)
+
+ ##TODO fix abundance-weighted PD!
+ if (method %in% c("polytomy", "yule")) {
+ stop("Non-trad PD not yet implemented for phylo4com")
+ }
+
.pd <- function(phy, method) {
## if using non-traditional pd, adjust tip lengths based on abundance
if (method %in% c("polytomy", "yule")) {
- stop("Non-trad PD not yet implemented for phylo4com")
-# phy <- weightByAbund(phy, method)
+ phy <- weightByAbund(phy, method)
}
# exclude root edge from calculation (if it exists)
if (isRooted(phy)) {
@@ -44,7 +50,6 @@
return(tot.length)
}
- method <- match.arg(method)
comms <- x at metadata$comms
if (is.null(comms)) {
return(.pd(extractTree(x), method))
More information about the Ecopd-commits
mailing list