If your case is simple - like you have a tree with tips labeled by
genus, and each species label from each subtree to be bound has tip
labels in the format Genus_species, this could be done using bind.tree
in ape.

For instance:

library(phytools)
## here's your backbone
backbone<-read.tree(text="((A:2.0,B:2.0):1,C:3.0);")
plotTree(backbone)

## here are your subtrees
A<-read.tree(text="(A_sp1:1.0,A_sp2:1.0);")
B<-read.tree(text="(B_sp1:1.5,B_sp2:1.5);")
C<-read.tree(text="((C_sp1:0.5,C_sp2:0.5):0.5,C_sp3:1.0);")
subtrees<-c(A,B,C)

for(i in 1:length(subtrees)){
        genus<-strsplit(subtrees[[i]]$tip.label[[1]],"_")[[1]][1]
        h<-max(nodeHeights(subtrees[[i]]))
        tip<-which(backbone$tip.label==genus)
        backbone$edge.length[which(backbone$edge[,2]==tip)]<-
                backbone$edge.length[which(backbone$edge[,2]==tip)]-h
        backbone<-bind.tree(backbone,subtrees[[i]],where=tip)
}

plotTree(backbone)

Something like that.

(Of course you could also modify this so that you just manually identify the tips to bind to. Given the small size of your problem this is probably what you want.)

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
& Profesor Asociado, Programa de Biología
Universidad del Rosario
web: http://faculty.umb.edu/liam.revell/

On 4/26/2018 4:19 PM, Brian O'Meara wrote:
Look at congruify.phylo in geiger (and the associated paper: Eastman
JM, LJ Harmon, and DC Tank. 2013. Congruification: support for time
scaling large phylogenetic trees. Methods in Ecology and Evolution).

You could also look into SDM in ape (converting trees [not data] to distance matrices, first): relevant paper Criscuolo, A., Berry, V., Douzery, E. J. P. , and Gascuel, O. (2006) SDM: A fast
distance-based approach for (super)tree building in phylogenomics.
Systematic Biology, 55, 740–755.

Best, Brian

_______________________________________________________________________


Brian O'Meara, http://www.brianomeara.info, especially Calendar
<http://brianomeara.info/calendars/omeara/>, CV <http://brianomeara.info/cv/>, and Feedback <http://brianomeara.info/teaching/feedback/>

Associate Professor, Dept. of Ecology & Evolutionary Biology, UT
Knoxville Associate Head, Dept. of Ecology & Evolutionary Biology, UT
Knoxville Associate Director for Postdoctoral Activities, National
Institute for Mathematical & Biological Synthesis
<http://www.nimbios.org> (NIMBioS)


On Thu, Apr 26, 2018 at 5:07 PM, Chris Law <cj...@ucsc.edu> wrote:

Hi all,

I am trying to graft 3 chronograms onto a family level backbone.
Does anybody have any suggestions on what is the best way to do
this? Or is going through the tree files in textwrangler the only
way to do this.

Thanks!


*Chris Law​ **|* * ​*PhD Student *|* * ​*University of California,
Santa Cruz ​


Coastal Biology Building ​ 130 McAllister Way Santa Cruz, CA 95060 cj...@ucsc.edu *|* research.pbsci.ucsc.edu/eeb/cjlaw/ Small Mammal Research in the Forest Internship <http://research.pbsci.ucsc.edu/envs/smurf>

[[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-ph...@r-project.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/


_______________________________________________
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/

Reply via email to