Re: [R-sig-phylo] The Curious Behavior of is.binary.tree
That all sounds great as gravy to me, Emmanuel. Thanks for clarifying the help file. -Cave On Wed, Jan 22, 2014 at 4:08 AM, Emmanuel Paradis emmanuel.para...@ird.fr wrote: Hi David, You are right about this help page which is not so accurrate. I have modified it with: The test differs slightly whether the tree is rooted or not. An urooted tree is considered binary if all its nodes are of degree three (i.e., three edges connect to each node). A rooted tree is considered binary if all nodes (including the root node) have exactly two descendant nodes, so that they are of degree three expect the root which is of degree 2. About the concept of rooted vs. unrooted, it is not so different from the one in Newick. Consider the tree: (A,B,C); is it an unrooted (binary) tree, or a rooted tree with a basal trifurcation? The presence of a root edge helps to solve this ambiguity, so: (A,B,C):0; is a (non-binary) rooted tree (note that both trees are graphically identical). Ape considers the first tree as unrooted because it is the kind of trees produced by many functions such as nj, bionj, etc. Best, Emmanuel Le 16/01/2014 17:32, David Bapst a écrit : Liam and to those who responded privately, Yes, I understand that's the general reasoning for why ape refers to trees with a polytomous root as 'unrooted'. But if a tree with a basal trichotomy is an acceptable binary tree, this doesn't jive with the help description for is.binary.tree in ape. The references to 'two descendant nodes' is the help file's terminology, after all. In particular, it doesn't match the text about binary trees having 2Ntip-2 edges; that is only true for 'rooted' binary trees. I also don't think every instance of a polytomy existing at the root reflects a user who necessarily realizes such topologies are treated as 'unrooted'; after all, a user might have use cases where a polytomy at the root actually represents a real multifurcating branching event. Although I realize this has never fully agreed with ape's concept of rooted and unrooted, I know I generally input trees in R with polytomous roots because there's some uncertainty in the proper outgroup, or the outgroup got dropped between inference and analysis. Either way, the tree is rooted and has directionality, it just doesn't have a fully resolved root. There's probably even better examples of use cases involving polytomous roots that just aren't occurring to me right now. Users may also not be immediately familiar with the 'rooted' and 'unrooted' concepts in ape as related to the presence of polytomies at the root node; I know I wasn't familiar with this concept when I first started working with phylogenies in R (although I admit I did know by the time I used is.binary.tree in my code). So, I think some clarification might be needed about the application of this function. Cheers, -Dave On Wed, Jan 15, 2014 at 8:03 PM, Liam J. Revell liam.rev...@umb.edu wrote: Hi David. In an unrooted, fully dichotomous tree each internal node is attached to three exactly three nodes (some of which are tips). (In a rooted binary tree one additional internal node exists, the root, which is attached to only two nodes.) Ancestor descendant have no meaning until the tree is rooted. The fact that an unrooted tree stored as an object of class phylo has one node with three 'descendants' (these aren't actually all descendants, as the tree is unrooted) is just an artifact of the way the object is stored in memory thus is.binary.tree is behaving correctly. 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 1/15/2014 3:34 PM, David Bapst wrote: Hi Emmanuel and the rest of the list, In some code, I use the ape function is.binary.tree to test if a phylogeny is fully dichotomous. However, some recent analyses have made me wonder if this wasn't the right choice. I'm not sure if the following is a bug report me or me not understand the reasoning of a function in ape. You see, I had an 'unrooted' (in ape terminology) tree with a basal trichotomy. I wouldn't consider such a tree to be fully dichotomous, but is.binary.tree says such a tree is in fact binary (i.e. returns TRUE). It appears to be limited to just trees with basal trichotomies. If the root is an even larger polytomy (more than three descendant nodes), is.binary.tree returns FALSE. I was a bit surprised, as the function description says This function tests whether a phylogenetic tree is binary, i.e. whether every node (including the root node) has exactly two descendant nodes. This would make me think it also tests if the root has two descendant nodes, but that doesn't seem to be the case, unless an unrooted tree with three lineages is (for some reason I'm unaware of) considered to
Re: [R-sig-phylo] The Curious Behavior of is.binary.tree
Liam and to those who responded privately, Yes, I understand that's the general reasoning for why ape refers to trees with a polytomous root as 'unrooted'. But if a tree with a basal trichotomy is an acceptable binary tree, this doesn't jive with the help description for is.binary.tree in ape. The references to 'two descendant nodes' is the help file's terminology, after all. In particular, it doesn't match the text about binary trees having 2Ntip-2 edges; that is only true for 'rooted' binary trees. I also don't think every instance of a polytomy existing at the root reflects a user who necessarily realizes such topologies are treated as 'unrooted'; after all, a user might have use cases where a polytomy at the root actually represents a real multifurcating branching event. Although I realize this has never fully agreed with ape's concept of rooted and unrooted, I know I generally input trees in R with polytomous roots because there's some uncertainty in the proper outgroup, or the outgroup got dropped between inference and analysis. Either way, the tree is rooted and has directionality, it just doesn't have a fully resolved root. There's probably even better examples of use cases involving polytomous roots that just aren't occurring to me right now. Users may also not be immediately familiar with the 'rooted' and 'unrooted' concepts in ape as related to the presence of polytomies at the root node; I know I wasn't familiar with this concept when I first started working with phylogenies in R (although I admit I did know by the time I used is.binary.tree in my code). So, I think some clarification might be needed about the application of this function. Cheers, -Dave On Wed, Jan 15, 2014 at 8:03 PM, Liam J. Revell liam.rev...@umb.edu wrote: Hi David. In an unrooted, fully dichotomous tree each internal node is attached to three exactly three nodes (some of which are tips). (In a rooted binary tree one additional internal node exists, the root, which is attached to only two nodes.) Ancestor descendant have no meaning until the tree is rooted. The fact that an unrooted tree stored as an object of class phylo has one node with three 'descendants' (these aren't actually all descendants, as the tree is unrooted) is just an artifact of the way the object is stored in memory thus is.binary.tree is behaving correctly. 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 1/15/2014 3:34 PM, David Bapst wrote: Hi Emmanuel and the rest of the list, In some code, I use the ape function is.binary.tree to test if a phylogeny is fully dichotomous. However, some recent analyses have made me wonder if this wasn't the right choice. I'm not sure if the following is a bug report me or me not understand the reasoning of a function in ape. You see, I had an 'unrooted' (in ape terminology) tree with a basal trichotomy. I wouldn't consider such a tree to be fully dichotomous, but is.binary.tree says such a tree is in fact binary (i.e. returns TRUE). It appears to be limited to just trees with basal trichotomies. If the root is an even larger polytomy (more than three descendant nodes), is.binary.tree returns FALSE. I was a bit surprised, as the function description says This function tests whether a phylogenetic tree is binary, i.e. whether every node (including the root node) has exactly two descendant nodes. This would make me think it also tests if the root has two descendant nodes, but that doesn't seem to be the case, unless an unrooted tree with three lineages is (for some reason I'm unaware of) considered to have two descendant nodes. There's also some stuff in ?is.binary.tree about fully dichotomous trees having 2Ntip-2 edges, which is only true if the root is also dichotomous (and thus the tree is 'rooted'). It isn't true for taxa with a basal trichotomy. Here's some code. I got the same results with both ape v3.0-11 and the v3.1 that Emmanuel had sent out two weeks ago. library(ape) tree-rtree(10) #collapse root tree$edge.length[which(tree$edge[,1]==11)[1]]-0 tree1-di2multi(tree) is.binary.tree(tree1) is.rooted(tree1) tree-stree(3) is.binary.tree(tree) is.rooted(tree) tree-stree(4) is.binary.tree(tree) is.rooted(tree) Is.rooted correctly returns FALSE, so does that mean best practice to get a tree where every node has two descendant nodes would be use is.binary.tree() is.rooted()? Curious on your thoughts on this and the intent of is.binary.tree. -Dave -- David W. Bapst, PhD Adjunct Asst. Professor, Geology and Geol. Eng. South Dakota School of Mines and Technology 501 E. St. Joseph Rapid City, SD 57701 http://webpages.sdsmt.edu/~dbapst/ http://cran.r-project.org/web/packages/paleotree/index.html ___ R-sig-phylo mailing list -
[R-sig-phylo] The Curious Behavior of is.binary.tree
Hi Emmanuel and the rest of the list, In some code, I use the ape function is.binary.tree to test if a phylogeny is fully dichotomous. However, some recent analyses have made me wonder if this wasn't the right choice. I'm not sure if the following is a bug report me or me not understand the reasoning of a function in ape. You see, I had an 'unrooted' (in ape terminology) tree with a basal trichotomy. I wouldn't consider such a tree to be fully dichotomous, but is.binary.tree says such a tree is in fact binary (i.e. returns TRUE). It appears to be limited to just trees with basal trichotomies. If the root is an even larger polytomy (more than three descendant nodes), is.binary.tree returns FALSE. I was a bit surprised, as the function description says This function tests whether a phylogenetic tree is binary, i.e. whether every node (including the root node) has exactly two descendant nodes. This would make me think it also tests if the root has two descendant nodes, but that doesn't seem to be the case, unless an unrooted tree with three lineages is (for some reason I'm unaware of) considered to have two descendant nodes. There's also some stuff in ?is.binary.tree about fully dichotomous trees having 2Ntip-2 edges, which is only true if the root is also dichotomous (and thus the tree is 'rooted'). It isn't true for taxa with a basal trichotomy. Here's some code. I got the same results with both ape v3.0-11 and the v3.1 that Emmanuel had sent out two weeks ago. library(ape) tree-rtree(10) #collapse root tree$edge.length[which(tree$edge[,1]==11)[1]]-0 tree1-di2multi(tree) is.binary.tree(tree1) is.rooted(tree1) tree-stree(3) is.binary.tree(tree) is.rooted(tree) tree-stree(4) is.binary.tree(tree) is.rooted(tree) Is.rooted correctly returns FALSE, so does that mean best practice to get a tree where every node has two descendant nodes would be use is.binary.tree() is.rooted()? Curious on your thoughts on this and the intent of is.binary.tree. -Dave -- David W. Bapst, PhD Adjunct Asst. Professor, Geology and Geol. Eng. South Dakota School of Mines and Technology 501 E. St. Joseph Rapid City, SD 57701 http://webpages.sdsmt.edu/~dbapst/ http://cran.r-project.org/web/packages/paleotree/index.html ___ 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] The Curious Behavior of is.binary.tree
Hi David. In an unrooted, fully dichotomous tree each internal node is attached to three exactly three nodes (some of which are tips). (In a rooted binary tree one additional internal node exists, the root, which is attached to only two nodes.) Ancestor descendant have no meaning until the tree is rooted. The fact that an unrooted tree stored as an object of class phylo has one node with three 'descendants' (these aren't actually all descendants, as the tree is unrooted) is just an artifact of the way the object is stored in memory thus is.binary.tree is behaving correctly. 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 1/15/2014 3:34 PM, David Bapst wrote: Hi Emmanuel and the rest of the list, In some code, I use the ape function is.binary.tree to test if a phylogeny is fully dichotomous. However, some recent analyses have made me wonder if this wasn't the right choice. I'm not sure if the following is a bug report me or me not understand the reasoning of a function in ape. You see, I had an 'unrooted' (in ape terminology) tree with a basal trichotomy. I wouldn't consider such a tree to be fully dichotomous, but is.binary.tree says such a tree is in fact binary (i.e. returns TRUE). It appears to be limited to just trees with basal trichotomies. If the root is an even larger polytomy (more than three descendant nodes), is.binary.tree returns FALSE. I was a bit surprised, as the function description says This function tests whether a phylogenetic tree is binary, i.e. whether every node (including the root node) has exactly two descendant nodes. This would make me think it also tests if the root has two descendant nodes, but that doesn't seem to be the case, unless an unrooted tree with three lineages is (for some reason I'm unaware of) considered to have two descendant nodes. There's also some stuff in ?is.binary.tree about fully dichotomous trees having 2Ntip-2 edges, which is only true if the root is also dichotomous (and thus the tree is 'rooted'). It isn't true for taxa with a basal trichotomy. Here's some code. I got the same results with both ape v3.0-11 and the v3.1 that Emmanuel had sent out two weeks ago. library(ape) tree-rtree(10) #collapse root tree$edge.length[which(tree$edge[,1]==11)[1]]-0 tree1-di2multi(tree) is.binary.tree(tree1) is.rooted(tree1) tree-stree(3) is.binary.tree(tree) is.rooted(tree) tree-stree(4) is.binary.tree(tree) is.rooted(tree) Is.rooted correctly returns FALSE, so does that mean best practice to get a tree where every node has two descendant nodes would be use is.binary.tree() is.rooted()? Curious on your thoughts on this and the intent of is.binary.tree. -Dave ___ 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/