Luigi Marongiu
2015-Jan-01 19:01 UTC
[R] Select subtree with vector of leaves using zoom function of the ape package
Dear all, I am drawing a phylogenetic tree using the zoom() function of the ape package. Since I have 476 sequences in my alignment, this allows me to have the outlook of the main tree and then highlight a portion of it, and this works fine. At the moment I am using the approach of indicating the leaves (or tips) to highlight by indicating their sequential number, for instance the zoom is based on the leaves 3:62. In order to have more control on the tree I would like to use a vector with the names of the sequences to highlight, but when I feed it to the "focus" argument I obtain the error: Warning message: In Ops.factor(focus[[i]]) : - not meaningful for factors and the zoom is based on the whole tree rather than on the subtree. The list of sequences is provided in the "leaf" vector in a column names "tip" and this approach does not work if I provide neither "leaf" nor "leaf$tip" as argument for "focus". Any tips? Best regards Luigi
Ben Bolker
2015-Jan-02 15:18 UTC
[R] Select subtree with vector of leaves using zoom function of the ape package
Luigi Marongiu <marongiu.luigi <at> gmail.com> writes:> I am drawing a phylogenetic tree using the zoom() function of the > ape package. Since I have 476 sequences in my alignment, this allows > me to have the outlook of the main tree and then highlight a portion > of it, and this works fine. At the moment I am using the approach > of indicating the leaves (or tips) to highlight by indicating their > sequential number, for instance the zoom is based on the leaves > 3:62. In order to have more control on the tree I would like to use > a vector with the names of the sequences to highlight, but when I > feed it to the "focus" argument I obtain the error:> Warning message: > In Ops.factor(focus[[i]]) : - not meaningful for factors> and the zoom is based on the whole tree rather than on the subtree. > The list of sequences is provided in the "leaf" vector in a column > names "tip" and this approach does not work if I provide neither > "leaf" nor "leaf$tip" as argument for "focus".This is not really answering your question, but I have a couple of meta-suggestions for asking it: * you might be better off asking questions about ape, phylogenetic analyses, etc., on the r-sig-phylo at r-project.org mailing list, which focuses on these kinds of questions (it's a good idea *not* to post in both places simultaneously, and to mention when you re-post there that you previously posted here); more of the users there will be familiar with these packages. * it would be really helpful, and greatly increase your odds of getting an answer, if you can post a "minimum workable example", that is a _small_ piece of data/code that people can use to replicate your problem: see http://tinyurl.com/reproducible-000 ... Ben Bolker