R: ape / phylobase: unable to convert ultrametric binary tree to hclust object (warning)

I imported the ClustalW2 tree to R using the monkey function and read.tree ape package functions. I evaluate molecular eyelids using the chronop function, which leads to an ultrametric binary tree. From which I want to create an R-assembly in a dendrogram object.

The trees are beautifully located and are the real object of phylo. However, I am trying to convert it to problems:

Minimum working example:

 require(ape) test.tree <- read.tree(file = "testree.phylip", text = NULL, tree.names = NULL, skip = 0, comment.char = "#", keep.multi = FALSE) test.tree.nu <- chronopl(test.tree, 0, age.min = 1, age.max = NULL, node = "root", S = 1, tol = 1e-8, CV = FALSE, eval.max = 500, iter.max = 500) is.ultrametric(test.tree.nu) is.binary.tree(test.tree.nu) treeclust <- as.hclust.phylo(test.tree.nu) 

The resulting tree looks β€œexcellent”, I check that the tree is not ultrametric and binary, and you want to convert it to an hclust object in order to eventually create its dendrogram object.

 > is.binary.tree(test.tree.nu) [1] TRUE > is.ultrametric(test.tree.nu) [1] TRUE 

After trying to make an hclust object from a tree, I get an error message:

 > tree.phylo <- as.hclust.phylo(test.tree.nu) Error in if (tmp <= n) -tmp else nm[tmp] : missing value where TRUE/FALSE needed In addition: Warning message: In nm[inode] <- 1:N : number of items to replace is not a multiple of replacement length 

I understand that this is a very detailed question, and it might be better to ask questions that are specifically related to certain packages elsewhere, but I hope someone can help me.

All help is much appreciated

Hello,

File upload

The Phylip file can be downloaded here http://www.box.net/shared/rnbdk973ja

+4
source share
2 answers

I can reproduce this with version 2.6-2 ape under R 2.12.1 beta (2010-12-07 r53808) on Linux, but your code works in monkey version 2.5-3.

This may mean that the error has got into the package, and you should inform the developers about the problem in order to seek expert advice. The email address of the companion, Emmanuel Paradis, is in the CRAN package for the monkey

+2
source

the problem seems to be that chronopl returns a tree that is either not loaded or has a multi-level root (depending on how it is interpreted). Also as.hclust.phylo has / had useless error messages.

It:

 modded.tree <- drop.tip(test.tree.nu,c( 'An16g06590','An02g12505','An11g00390','An14g01130')) 

removes all clues from one of the three treasures descending from the root, thus

 is.ultrametric(modded.tree) is.binary.tree(modded.tree) is.rooted(modded.tree) 

all return TRUE and you can do

 treeclust <- as.hclust.phylo(modded.tree) 

. Although I think you really need an hclust object representing a multi-level tree, and although hclust objects can handle them, as.hclust.phylo (from the "ape" package) for some reason does not work on multifurcations. If you know a way to import new files into hclust objects, this may be the way forward - ade has write.tree () to generate new files.

+1
source

All Articles