Thanks Liam for the quick answer. The exemple you made up is nice, I will work on, and try to transfer that on my case Not sure that it would be possible.
Benjamin Le Mercredi 4 Juin 2014 16:10 GMT, "Liam J. Revell" <liam.rev...@umb.edu> a écrit: > Hi Gilles. > > which.edge returns the rows of phy$edge containing the edges to the mrca > of the taxa in group. If the group is monophyletic, this will be all the > edges in the group descended from that mrca. If the group is > non-monophyletic, it will be only the edges leading from the mrca of > group to the tips. Key to keep in mind is that which.edge computes the > indices from phy$edge, not the node numbers themselves! > > So, for instance: > > require(phytools) > set.seed(1) > tree<-pbtree(n=26,tip.label=LETTERS) > plotTree(tree,node.numbers=T) > group<-c("E","F","G","H") ## should be monophyletic > ii<-which.edge(tree,group) > tree$edge[ii,] ## should be the edges tipward of the mrca of group > ## visualize this: > plotSimmap(paintBranches(tree,tree$edge[ii,2],state="2"), > colors=setNames(c("blue","red"),1:2),lwd=3,node.numbers=T) > group<-c("C","D","F","E") ## should be non-monophyletic > ii<-which.edge(tree,group) > tree$edge[ii,] ## should be the edges tipward of the mrca of group > ## visualize this: > plotSimmap(paintBranches(tree,tree$edge[ii,2],state="2"), > colors=setNames(c("blue","red"),1:2),lwd=3,node.numbers=T) > > All the best, Liam > > Liam J. Revell, Assistant Professor of Biology > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://blog.phytools.org > > On 6/4/2014 11:41 AM, Gilles Benjamin Leduc wrote: > > Hello, > > > > I am looking the correct way to use the function which.edge {ape} and to > > understand what it returns… > > > > which.edge(phy, group) > > > > so I use as phy an object I get like that: > > as.phylo(dendroIcscan) > > > > summary(as.phylo(dendroIcscan)) > > > > Phylogenetic tree: as.phylo(dendroIcscan) > > > > Number of tips: 169 > > Number of nodes: 168 > > Branch lengths: > > mean: 0.1140614 > > variance: 0.006095345 > > distribution summary: > > Min. 1st Qu. Median 3rd Qu. Max. > > 0.005061 0.047450 0.093750 0.175000 0.361100 > > No root edge. > > First ten tip labels: B-40-2x-T > > B-41-2x-T > > B-43-2x-T > > B-47-2x-T > > B-52-2x-T > > B-72-3x-T > > B-73-2x-A > > B-75-4x-T > > B-83-4x-A > > B-84-4x-NA > > No node labels. > > > > > > and as group, I get an object: > > ColPloIcscan > > [1] 2 2 2 2 2 3 2 4 4 4 4 4 4 2 4 2 2 4 2 4 2 4 2 4 2 4 2 4 2 3 2 3 2 4 > > 2 3 2 4 2 4 3 3 4 2 4 2 4 2 4 3 4 2 4 2 4 2 4 2 3 4 4 2 3 4 2 4 3 3 2 4 2 4 > > 2 4 4 4 4 2 4 2 4 4 3 4 4 4 > > [87] 2 3 4 2 4 4 2 4 2 2 3 2 4 2 4 2 4 2 4 4 2 2 4 3 4 4 4 4 4 4 4 4 4 4 > > 4 2 2 3 2 2 4 3 4 2 4 4 2 2 4 3 4 2 4 4 2 4 3 2 3 2 4 2 4 2 4 4 4 2 2 2 4 2 > > 2 4 2 4 2 2 4 4 4 4 2 > > > > with everything in the same order than in the phylogenetic tree. > > > > As there is no exemple, I try around with several commande : > >> which.edge(as.phylo(dendroIcscan), ColPloIcscan) > > [1] 10 50 68 69 71 72 73 74 79 80 110 120 121 122 > >> which.edge(as.phylo(dendroIcscan), ColPloIcscan==2) > > [1] 9 10 50 68 69 70 > >> which.edge(as.phylo(dendroIcscan), ColPloIcscan==3) > > [1] 9 10 50 68 69 70 > >> which.edge(as.phylo(dendroIcscan), ColPloIcscan==4) > > [1] 8 9 10 50 68 69 70 > > > > > > There is no exemple, and it doesn't make sens in itself… who could help me > > with that? > > > > Benjamin > > > > _______________________________________________ > > 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/