Dear Russell, there is also a function getMRCA() in ape, which is more appropriate to use for your problem, as it only computes the MRCA for a set of tips. This should be much more efficient than using mrca(). Kind regards, Klaus
On Thu, Jun 3, 2021 at 1:05 AM Russell Engelman <neovenatori...@gmail.com> wrote: > Dear R-sig-phylo, > > I have been working with a mammalian phylogeny I recently downloaded from > VertLife (http://vertlife.org/phylosubsets/). Unfortunately, the phylogeny > is missing a large number of species, so I am trying to manually add these > taxa to the phylogeny. I have a series of 100 trees that I am using to do > things such as test for phylogenetic signal. I know how to use bind.tip to > add new taxa to a single tree, but I am having more trouble with a > multiPhylo object. I am primarily adding these taxa by placing them as > sister to their nearest included relative (since most of them are elevated > former subspecies), but the issue here is that in the 100 trees in the > multiPhylo object the node representing the taxon to bind these taxa to is > not the same across all trees due to shifting topologies. > > This is an example of the code I have been using, in which "tree" is the > tree object. This works for a single 'phylo' tree but not 'multiphylo'. > > ``` > newtree<-lapply(tree,bind.tip,tip.label="Cercopithecus_albogularis", > position=0.59,edge.length = 0.59, > > where=mrca(tree)["Cercopithecus_mitis","Cercopithecus_mitis"]) > ``` > > Now, this code will not work, but I know exactly why: 'tree' is a > multiPhylo object and so the 'where' argument cannot find the node for the > terminal taxon. However, the issue is how can I tell R to repeat this > 'where' argument for each of the 100 trees, since the node in question is > not identical across these trees? Is there an easier way to do this than > using the 'mrca' call for each terminal taxon? I've noticed adding a 'mrca' > argument also increases computation time and if I am reinventing the wheel > it would be nice to know if I am overthinking things. > > Sincerely, > Russell > > [[alternative HTML version deleted]] > > _______________________________________________ > 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 Senior Scientist Institute of Computational Biotechnology TU Graz https://icbt.tugraz.at https://www.phangorn.org/ <http://www.phangorn.org/> [[alternative HTML version deleted]] _______________________________________________ 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/