[Adephylo-commits] r20 - in pkg: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 25 12:04:59 CET 2008
Author: jombart
Date: 2008-11-25 12:04:59 +0100 (Tue, 25 Nov 2008)
New Revision: 20
Modified:
pkg/R/distances.R
pkg/R/utils.R
pkg/TODO
Log:
Updated TODO.
Modified: pkg/R/distances.R
===================================================================
--- pkg/R/distances.R 2008-11-21 15:43:42 UTC (rev 19)
+++ pkg/R/distances.R 2008-11-25 11:04:59 UTC (rev 20)
@@ -47,7 +47,7 @@
temp <- table(E[,1])[as.character(path)] # number of dd per node
res <- sum(temp)
return(res)
- } # end Abouheif
+ } # end sumDD
} # end distNodes
Modified: pkg/R/utils.R
===================================================================
--- pkg/R/utils.R 2008-11-21 15:43:42 UTC (rev 19)
+++ pkg/R/utils.R 2008-11-25 11:04:59 UTC (rev 20)
@@ -1,36 +1,35 @@
-###############
-# shortestPath -> moved to phylobase
-###############
-## shortestPath <- function(x, node1, node2){
-## if(!require(phylobase)) stop("phylobase package is not installed")
+##############
+# pathTwoTips
+##############
+pathTwoTips <- function(phy, tip1, tip2){
+ ## if(!require(phylobase)) stop("phylobase package is not installed")
-## ## conversion from phylo, phylo4 and phylo4d
-## x <- as(x, "phylo4")
+ ## conversion from phylo, phylo4 and phylo4d
+ x <- as(phy, "phylo4")
-## ## come checks
-## if (is.character(checkval <- check_phylo4(x))) stop(checkval)
-## t1 <- getnodes(x, node1)
-## t2 <- getnodes(x, node2)
-## if(any(is.na(c(t1,t2)))) stop("wrong node specified")
-## if(t1==t2) return(NULL)
+ ## come checks
+ if (is.character(checkval <- check_phylo4(x))) stop(checkval)
+ t1 <- getnodes(x, node1)
+ t2 <- getnodes(x, node2)
+ if(any(is.na(c(t1,t2)))) stop("wrong node specified")
+ # if(t1==t2) return(NULL)
-## ## main computations
-## comAnc <- MRCA(x, t1, t2) # common ancestor
-## desComAnc <- descendants(x, comAnc, which="all")
-## ancT1 <- ancestors(x, t1, which="all")
-## path1 <- intersect(desComAnc, ancT1) # path: common anc -> t1
+ ## main computations
+ comAnc <- MRCA(x, t1, t2) # common ancestor
+ desComAnc <- descendants(x, comAnc, which="all")
+ ancT1 <- ancestors(x, t1, which="all")
+ path1 <- intersect(desComAnc, ancT1) # path: common anc -> t1
-## ancT2 <- ancestors(x, t2, which="all")
-## path2 <- intersect(desComAnc, ancT2) # path: common anc -> t2
+ ancT2 <- ancestors(x, t2, which="all")
+ path2 <- intersect(desComAnc, ancT2) # path: common anc -> t2
-## res <- union(path1, path2) # union of the path
-## ## add the common ancestor if it differs from t1 or t2
-## if(!comAnc %in% c(t1,t2)){
-## res <- c(comAnc,res)
-## }
+ res <- union(path1, path2) # union of the path
+ ## add the common ancestor if it differs from t1 or t2
+ if(!comAnc %in% c(t1,t2)){
+ res <- c(comAnc,res)
+ }
-## res <- getnodes(x, res)
+ res <- getnodes(x, res)
-## return(res)
-## } # end shortestPath
-
+ return(res)
+} # end shortestPath
Modified: pkg/TODO
===================================================================
--- pkg/TODO 2008-11-21 15:43:42 UTC (rev 19)
+++ pkg/TODO 2008-11-25 11:04:59 UTC (rev 20)
@@ -36,6 +36,7 @@
# NEW IMPLEMENTATIONS:
=====================
* plot methods from phylobase ('old' version) -- done (TJ)
+* implement a pathTwoTips method, which has to go fast to find shortest path between two tips.
* basic stuff existing in phylog objects (while option=TRUE), e.g. distance to the root for tips, etc.
* proximities between OTUs like Abouheif, etc.
* distances between OTUs (like sum of branch lengths)
More information about the Adephylo-commits
mailing list