Re: [R-sig-phylo] problem with drop.tip
Dear John, can you please be a bit more specific with your error message. It is always good to have a reproducible example, e.g. adding a tree which where drop.tip fails, and to run traceback() just after the error to get more information where the error occurred. It is also useful to add information of the version of ape and your operating system. Regards, Klaus On 2/28/13, john d dobzhan...@gmail.com wrote: Dear all, I'm trying to prune a set of 1000 post-burnin trees to include only a subset of taxa. Unfortunately the tree is too big to send to the list, but if it is really necessary I'll figure out a way to do it. tr is my tree and taxa is my list of selected terminals. for(i in 1:1000){ write.tree(drop.tip(tr[[i]],tr[[i]]$tip.label[-match(taxa, tr[[i]]$tip.label)]), file=result.tre, append=TRUE) } If I run that code, it works for some trees, but not for others, for which I got the message Error in kids[[parent[i]]] : subscript out of bounds. Any suggestions? John ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ -- Klaus Schliep Phylogenomics Lab at the University of Vigo, Spain ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] problem with drop.tip
Hi John, It seems a problem occurs within write.tree and not with the pruning. So try prune the trees first and then write them out. tr2=vector(list, 1000) for(i in 1:1000){ tr2[[i]] - drop.tip(tr[[i]],tr[[i]]$tip.label[-match(taxa, tr[[i]]$tip.label)]) } class(tr2) = multiPhylo plot(tr2) for(i in 1:1000){print(i);write.tree(tr2[[i]])} # may helps find you the trees which fail write.tree(tr2, file=result.tre) Cheers, Klaus On 2/28/13, Klaus Schliep klaus.schl...@gmail.com wrote: Dear John, can you please be a bit more specific with your error message. It is always good to have a reproducible example, e.g. adding a tree which where drop.tip fails, and to run traceback() just after the error to get more information where the error occurred. It is also useful to add information of the version of ape and your operating system. Regards, Klaus On 2/28/13, john d dobzhan...@gmail.com wrote: Dear all, I'm trying to prune a set of 1000 post-burnin trees to include only a subset of taxa. Unfortunately the tree is too big to send to the list, but if it is really necessary I'll figure out a way to do it. tr is my tree and taxa is my list of selected terminals. for(i in 1:1000){ write.tree(drop.tip(tr[[i]],tr[[i]]$tip.label[-match(taxa, tr[[i]]$tip.label)]), file=result.tre, append=TRUE) } If I run that code, it works for some trees, but not for others, for which I got the message Error in kids[[parent[i]]] : subscript out of bounds. Any suggestions? John ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ -- Klaus Schliep Phylogenomics Lab at the University of Vigo, Spain -- Klaus Schliep Phylogenomics Lab at the University of Vigo, Spain ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
[R-sig-phylo] problem with drop.tip
Dear all, I'm trying to prune a set of 1000 post-burnin trees to include only a subset of taxa. Unfortunately the tree is too big to send to the list, but if it is really necessary I'll figure out a way to do it. tr is my tree and taxa is my list of selected terminals. for(i in 1:1000){ write.tree(drop.tip(tr[[i]],tr[[i]]$tip.label[-match(taxa, tr[[i]]$tip.label)]), file=result.tre, append=TRUE) } If I run that code, it works for some trees, but not for others, for which I got the message Error in kids[[parent[i]]] : subscript out of bounds. Any suggestions? John ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/