Hello all

I am working with a cophylogenetic problem where I have a host tree, a parasite tree and a binary matrix HP encapsulating the host-parasite associations . After trimming the matrix according to a given criterion, I require to prune the trees accordingly. Since I am getting errors at the execution I devised the following control function to check the number of tree nodes after pruning:

z <- function (hp, treeH,treeP) {
  treeh <- drop.tip(treeH, setdiff(treeH$tip.label, rownames(hp)))
  treep <- drop.tip(treeP, setdiff(treeP$tip.label, colnames(hp)))
  res <- c(treeh$Nnode,treep$Nnode)

Then I try the following

x <- sapply (THP, z, treeH=TreeH[[7]], treeP= TreeP[[7]])

where THP is a list of trimmed HP matrices and TreeH and TreeP are multiphylo objects and get the following error:

Error in integer(max(oldnodes)) : vector size cannot be infinite

The traceback is

6. integer(max(oldnodes))
5. collapse.singles(phy)
4. drop.tip(treeP, setdiff(treeP$tip.label, colnames(hp)))
3. FUN(X[[i]], ...)
2. lapply(X = X, FUN = FUN, ...)
1. sapply(THP, z, treeH = TreeH[[7]], treeP = TreeP[[7]])

This error appears only with this particular pair of host and parasite trees (#7) and I cannot find a reason why this case should be different.

Any help will be very much appreciated.

Juan A. Balbuena


Dr. Juan A. Balbuena
Cavanilles Institute of Biodiversity and Evolutionary Biology
University of Valencia                                           
P.O. Box 22085                                                   
46071 Valencia, Spain

j.a.balbu...@uv.es    tel. +34 963 543 658    fax +34 963 543 733

NOTE! For shipments by EXPRESS COURIER use the following street address:
C/ Catedrático José Beltrán 2, 46980 Paterna (Valencia), Spain.


R-sig-phylo mailing list - R-sig-phylo@r-project.org
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to