Hello all, I recently ran into two issue with ape, using R 2.14.2 and ape 3.0-1.
1) I'm having some issues with the output from prop.clades, which was recent noted in another discussion on this list. The output of the original function is definitely incorrect and the output of the 'fixed' version offered on the site occasionally (repeatably but not consistently) produces an incorrect value in the output. For an example, I'll compare a tree and then a second tree which is generated by using degradeTree from the library paleotree to remove about half the nodes. This is a library(ape) library(paleotree) set.seed(3) tree1<-rtree(30) tree2<-degradeTree(tree1,0.5) layout(matrix(1:2,,2));plot(tree1);plot(tree2) In the plot we can see the two trees are the same; tip labels are identical, just we've degraded how resolved the tree is. The nodes that are present in the second are still present in the first, though. But if we run prop.clades... > prop.clades(tree1,tree2) [1] 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 There's definitely more than two clades shared, so that's not right. Summary-1 of prop.part should also tell us how many bifurcations are shared: > summary(prop.part(tree1,tree2))-1 [1] 1 1 0 0 0 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 That looks more right. Now, recently Klaus S. suggested a fix for prop.clades ( http://www.mail-archive.com/r-sig-phylo@r-project.org/msg01779.html) but the fix doesn't also work right.... I've pasted Klaus's fix in below, but I'll rename it prop.clades.mod: prop.clades.mod <- function (phy, ..., part = NULL, rooted = FALSE) { if (is.null(part)) { obj <- list(...) if (length(obj) == 1 && class(obj[[1]]) != "phylo") obj <- unlist(obj, recursive = FALSE) part <- prop.part(obj, check.labels = TRUE) } bp <- prop.part(phy) if (!rooted){ bp <- postprocess.prop.part(bp) part <- postprocess.prop.part(part) # This line I added!! } n <- numeric(phy$Nnode) for (i in seq_along(bp)) { for (j in seq_along(part)) { if (identical(bp[[i]], part[[j]])) { n[i] <- attr(part, "number")[j] done <- TRUE break } } } n } And if we run it on this particular dataset... > prop.clades.mod(tree1,tree2) [1] 1 2 0 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 What is a two doing in the output? How can a bipartition appear twice in tree2? Maybe I need to collapse. singles... > prop.clades.mod(tree1,collapse.singles(tree2)) [1] 1 2 0 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 No, that didn't fix anything. The appearance of these 2s doesn't happen all the time, but it happens often enough on large simulated trees to worry me, particularly since I discovered this in a simulation where I was summing prop.clades to find the number of shared bipartions. It seems like its always the second element of the output that has the 2. Am I misunderstanding something here? 2) While on an grand experiment comparing the many alternatives for fitting OU models in R, I ran into an error using compar.ou in ape. So what I was doing: library(ape) set.seed(2) tree<-rtree(20) trait<-rTraitCont(tree) fit<-compar.ou(trait, tree) But I got the following: Error in chol.default(V) : the leading minor of order 10 is not positive definite Any tree I generate with rtree or rcoal seems to generate this or a similar error with compar.ou, so it doesn't seem to be an issue with me using a non-ultrametric tree. Any ideas? Thanks, all! -Dave -- David Bapst Dept of Geophysical Sciences University of Chicago 5734 S. Ellis Chicago, IL 60637 http://home.uchicago.edu/~dwbapst/ http://cran.r-project.org/web/packages/paleotree/index.html <http://home.uchicago.edu/%7Edwbapst/> [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo