[R-sig-phylo] Imposing backbone constraints in phylogeny reconstruction?
Dear all, I am trying to create a phylogeny of approximately 70 fish. In doing the reconstruction using ML and MrBayes methods, I get funny outcomes where certain groups that should be ancestral are not. If I am quite sure that some groups should be ancestral to other groups is there a way to impose backbone constraints? For example, I want to specify in the model that clade/species A and clade/species B have be ancestral to clade/species C. Is there a way to do this using maximum likelihood in R (I'm using phangorn), and in MrBayes? Thanks! Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Why no branch lengths on consensus trees?
When making a consensus tree using ape::consensus the branch lengths are lost. Is there a way to not lose the branch lengths? Or to add them somehow to the consensus tree after making it. library(ape) cat(owls(((Strix_aluco:4.2,Asio_otus:4.1):4.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);, file = ex1.tre, sep = \n) cat(owls(((Strix_aluco:1.2,Asio_otus:4.5):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);, file = ex2.tre, sep = \n) cat(owls(((Strix_aluco:3.2,Asio_otus:4.7):8.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);, file = ex3.tre, sep = \n) tree1 - read.tree(ex1.tre) tree2 - read.tree(ex2.tre) tree3 - read.tree(ex3.tre) trees - c(tree1, tree2, tree3) trees_con - consensus(trees) trees_con Phylogenetic tree with 4 tips and 3 internal nodes. Tip labels:[1] Strix_aluco Asio_otus Athene_noctua Tyto_alba Rooted; no branch lengths. Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Why no branch lengths on consensus trees?
Dear Brian, Awesome. Thanks for sharing the code Brian. I will give it a try. I see what you all mean now more precisely with the question of what does it really mean to have branch lengths on a consensus tree. Thanks, Scott On Wed, Nov 21, 2012 at 11:10 AM, Brian O'Meara bome...@utk.edu wrote: I have a function to create a consensus tree with branch lengths. You feed it a given topology (often a consensus topology, made with ape), then a list of trees, and tell it what you want the branch lengths to represent. It could be the proportion of input trees with that edge (good for summarizing bootstrap or Bayes proportions) or the mean, median, or sd of branch lengths for those trees that have that edge. Consensus branch lengths in units of proportion of matching trees has obvious utility. As Daniel says, the average branch lengths across a set of trees is more difficult to see a use case for, but you could imagine doing something like taking the ratogram output from r8s on a set of trees and summarizing the rate average and rate sd on a given, best, tree as two sets of branch lengths on that tree. I've put the function source at https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/R/consensusBrlen.R?revision=110root=omearalab. You can source the file for the function (consensusBrlen() ) and other functions it needs. It also uses phylobase. Note that this is alpha-quality code -- it's been checked a bit, but verify it's doing what you want. Here's an example of how to use it library(ape) library(phylobase) phy.a-rcoal(15) phy.b-phy.a phy.b$edge.length-phy.b$edge.length+runif(length(phy.b$edge.length), 0, 0.1) phy.c-rcoal(15) phy.list-list(phy.a, phy.b, phy.c) phy.consensus-consensusBrlen(phy.a, list(phy.a, phy.b, phy.c), type=mean_brlen) Best, Brian PS: Note that I am actively looking for grad students: info at http://www.brianomeara.info/lab . Guaranteed five years support, subject to decent performance. ___ Brian O'Meara Assistant Professor Dept. of Ecology Evolutionary Biology U. of Tennessee, Knoxville http://www.brianomeara.info Students wanted: Applications due Dec. 15, annually Postdoc collaborators wanted: Check NIMBioS' website Calendar: http://www.brianomeara.info/calendars/omeara On Wed, Nov 21, 2012 at 11:09 AM, Daniel Barker d...@st-andrews.ac.ukwrote: Dear Scott, What should branch lengths on a consensus tree represent? They cannot be expected substitutions per residue. This would imply no evolution at points where uncertain branching patterns have been reduced to a multi-furcation - which is not what the multi-furcation is meant to imply. (Rather: there was evolution, but we aren't very certain about the branching pattern.) But, MrBayes does provide average lengths of some kind. Best wishes, Daniel On 21/11/2012 15:13, Scott Chamberlain myrmecocys...@gmail.com wrote: When making a consensus tree using ape::consensus the branch lengths are lost. Is there a way to not lose the branch lengths? Or to add them somehow to the consensus tree after making it. library(ape) cat(owls(((Strix_aluco:4.2,Asio_otus:4.1):4.1,Athene_noctua:7.3):6.3,Tyt o_alba:13.5);, file = ex1.tre, sep = \n) cat(owls(((Strix_aluco:1.2,Asio_otus:4.5):3.1,Athene_noctua:7.3):6.3,Tyt o_alba:13.5);, file = ex2.tre, sep = \n) cat(owls(((Strix_aluco:3.2,Asio_otus:4.7):8.1,Athene_noctua:7.3):6.3,Tyt o_alba:13.5);, file = ex3.tre, sep = \n) tree1 - read.tree(ex1.tre) tree2 - read.tree(ex2.tre) tree3 - read.tree(ex3.tre) trees - c(tree1, tree2, tree3) trees_con - consensus(trees) trees_con Phylogenetic tree with 4 tips and 3 internal nodes. Tip labels:[1] Strix_aluco Asio_otus Athene_noctua Tyto_alba Rooted; no branch lengths. Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- Daniel Barker http://bio.st-andrews.ac.uk/staff/db60.htm The University of St Andrews is a charity registered in Scotland : No SC013532 ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Why no branch lengths on consensus trees?
Dear Joe, Thanks for your feedback on this question. I will go read those pages you mentioned. Scott On Wed, Nov 21, 2012 at 5:19 PM, Joe Felsenstein j...@gs.washington.eduwrote: Daniel Barker wrote: What should branch lengths on a consensus tree represent? Scott Chamberlain had written: When making a consensus tree using ape::consensus the branch lengths are lost. Is there a way to not lose the branch lengths? Or to add them somehow to the consensus tree after making it. The issue of what branch lengths ought to be on a consensus tree is not simple. If we have three rooted trees: ((A:1,B:1):1,C:2); ((A:1,B:1):1,C:2); (A:2,(B:1,C:1):1); the consensus tree should be the first tree, but what branch length should be used for (say) the branch ancestral to the AB clade? 1? 0.667? The minute you open this can of worms it becomes clear that the answer depends on what you want that number to convey and what interpretations your audience will tend to draw from the number. There is no obvious answer. So this is not a mere technical computing question. By the way, in my 2004 book, you will find me agonizing about this on page 526, coming down on the side of 0.667, but not overwhelmingly convincingly. You could argue that a branch length should be set 0 when the branch is not there, and all the resulting values averaged, or you could argue that the average should only be taken over those trees for which that branch is present. One possible way to solve the problem is to take the consensus tree as if it were a user-defined tree, use your whole data set, and infer branch lengths on that tree. Daniel has already expressed his legitimate concerns in such a case as to whether it takes (for example) trifurcations as if they were real rather than an expression of our uncertainty. J.F. Joe Felsenstein j...@gs.washington.edu Department of Genome Sciences and Department of Biology, University of Washington, Box 355065, Seattle, WA 98195-5065 USA (from 1 October 2012 to 10 December 2012 on sabbatical leave at) Department of Statistics, University of California, Berkeley, 367 Evans Hall, Berkeley, CA 94710 [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Extinction series in bipartite
Hello, I am interested in calculating the consequences of removing species from a bipartite network, specifically removing species from the least-connected to the most-connected. The bipartite package in R has the second.extinct and robustness functions which allows investigation of secondary extinctions but does not allow for removing species from least-connected to the most-connected. The only removal options are: 1) random, 2) least-abundant to most-abundant 3) most-connected to least-connected. I am wondering if there are any other programs in which I could run the extinction series that I desire. Thanks, Scott Chamberlain Simon Fraser University [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Extinction series in bipartite
Apologies, meant to send to the R-ecolgy list serve! Scott On Thursday, July 12, 2012 at 10:22 AM, Scott Chamberlain wrote: Hello, I am interested in calculating the consequences of removing species from a bipartite network, specifically removing species from the least-connected to the most-connected. The bipartite package in R has the second.extinct and robustness functions which allows investigation of secondary extinctions but does not allow for removing species from least-connected to the most-connected. The only removal options are: 1) random, 2) least-abundant to most-abundant 3) most-connected to least-connected. I am wondering if there are any other programs in which I could run the extinction series that I desire. Thanks, Scott Chamberlain Simon Fraser University [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Estimating heritability with sire-offspring regression
Is there any package, tutorial, or script on estimating heritability with sire offspring regression following the Lynch and Walsh chapter (Chapter 17) using iteratively re-weighted least squares regression? The rlm() function in MASS does iteratively re-weighted least squares regression, but how do you specify the correct weight Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Add names to a list in R, and count matching numbers
here'a an example of what i am guessing you want a - list(1,2,3) b - list(4,5,6) for(i in 1:length(a)) { a[[i]] - c(a[i], b[i]) } a On Fri, Dec 9, 2011 at 9:26 AM, charlotte.ndir...@unil.ch wrote: Dear All, I would like to do 2 things. First, I want to add 30 different family names to a list of length 30. Second, I have 200 plots with different species identity. I need to store in the new list with 30 different family names, the number of plots that match/contain species belonging to each of the 30 specific families? Many thanks in advance! ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Simulating a phylogeny with outgroup on long branch
Hello, I want to simulate two types of phylogenies: one normally done with, for example, rcoal in ape; and the second type with an outgroup on a long branch. The first is easy with rcoal. I'm not sure how to make the second kind of tree. An example of this second kind is a tree with say all animals, and then an outgroup with all plant species, so that you have many animal species that have relatively short branches among them, and then the distance between plants and animals is relatively long. Is there a way to simulate this second kind of tree with any available R functions? Thanks! Scott Chamberlain Rice University [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Simulating a phylogeny with outgroup on long branch
Hi Liam, Great, thanks so much. The point of this exercise is to figure out to what extent certain tree characteristics are influencing phylogenetic meta-analysis output. We think that deep basal splits in these types of trees (e.g., mostly animals with a plant species as an outgroup) may be greatly decreasing model fit in phylogenetic meta-analysis relative to trees without these deep basal splits. It may relate to how even the groups are, e.g, in your code below if one clade has 2 species and the other 48, that may have a different impact on phylogenetic meta-analysis fit than if each clade had 25 species. Scott On Thu, Oct 13, 2011 at 5:14 PM, Liam J. Revell liam.rev...@umb.edu wrote: Hi Scott. I'm not sure why you want to do this, but based on your description it sounds like you could just generate two separate trees and then paste them together across a deep basal split. The following is an example of doing this, although I'm sure you could also come up with your own using different functions than those that I have chosen: require(phytools); require(geiger) # load packages ntaxa1-50; ntaxa2-50 # number of taxa in each clade total.height-10 # total tree height (may need to be adjusted) # simulate subtree 1 tr1-birthdeath.tree(b=1,d=0,**taxa.stop=ntaxa1) tr1$tip.label-1:ntaxa1; tr1$root.edge-0 # simulate subtree 2 tr2-birthdeath.tree(b=1,d=0,**taxa.stop=ntaxa2) tr2$tip.label-1:ntaxa2+**ntaxa1; tr2$root.edge-0 # compute tree heights, so that the whole thing can be ultrametric height1-max(nodeHeights(tr1)) height2-max(nodeHeights(tr2)) # create the basal split tr3-list(Nnode=1,edge=matrix(**c(3,1,3,2),2,2,byrow=T),edge.** length=c(total.height-height1,**total.height-height2),tip.** label=c(tr1,tr2)) class(tr3)-phylo # attach the two subtrees one by one tr3$tip.label[tr3$tip.label==**tr1]-NA tr3-paste.tree(tr3,tr1) tr3$tip.label[tr3$tip.label==**tr2]-NA tr3-paste.tree(tr3,tr2) # plot the full tree plot(tr3) I hope this is kind of what you are going for. All the best, Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.**revell/http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 10/13/2011 5:32 PM, Scott Chamberlain wrote: Hello, I want to simulate two types of phylogenies: one normally done with, for example, rcoal in ape; and the second type with an outgroup on a long branch. The first is easy with rcoal. I'm not sure how to make the second kind of tree. An example of this second kind is a tree with say all animals, and then an outgroup with all plant species, so that you have many animal species that have relatively short branches among them, and then the distance between plants and animals is relatively long. Is there a way to simulate this second kind of tree with any available R functions? Thanks! Scott Chamberlain Rice University [[alternative HTML version deleted]] __**_ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Finding distances between tree nodes
require(ape) tree - rtree(10) dist.nodes(tree) dist.nodes gives you pairwise distances between all nodes and tips, then you can just pick out the one you want from the output matrix HTH, Scott On Monday, July 18, 2011 at 5:26 AM, Liutauras Rusaitis wrote: Hello, We're using the Ape library here in a plant shape research, and we need to find evolutionary time between two specific nodes on the evolutionary tree (by adding the branch lengths along from one node to another). I'd appreciate if anyone could hint the quickest way to do it. Thanks, Liutauras ___ R-sig-phylo mailing list R-sig-phylo@r-project.org (mailto:R-sig-phylo@r-project.org) https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Assigning node ages to a tree, revisited
Hi Roger, Can you provide a reproducible example (perhaps a subset of your tree and their tip and node ages if the tree is very large)? I don't know what the problem could be without the data, but perhaps Gene knows? Scott On Wednesday, July 13, 2011 at 10:57 PM, Roger Close wrote: Hello all, I wish to transform branch lengths on a tree according to ages of terminal taxa and internal node ages; to this end I have tried to implement the script written by Gene Hunt mentioned in a recent post to this list (http://www.mail-archive.com/r-sig-phylo@r-project.org/msg01005.html; script available at https://gist.github.com/938313). However, when attempting to run the command scalePhylo(tr, tip.ages, node.mins), it crunches away for hours on my computer (a 2010 MacBook Pro Core i7, which is quite fast). Clearly there's something wrong. I'm afraid I don't know enough about R to debug a script. I thought I'd send this to the list in case someone other than Gene Hunt or Scott Chamberlain has had a go at using this script. Thanks in advance, Roger [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Felsentsein's contrast LRT
Hello, (apologies if this is too far off list theme) In Felsenstein's 2008 AmNat paper he states Likelihood ratio rest (LRT) are available of the hypotheis that a set of q characters have on phylogenetic covariation with the remaining p - q characters. And his software contrast gives only one LRT result in the output even if you have say 3 traits. If you are interested in contrasts and a LRT for all pairwise relationships of the 3 traits, do you just run analyses 3 different times, each with the pair of traits you are interested in? Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Felsenstein's 2008 AmNat complete method in R?
This is mostly directed towards Dr. Paradis, but here goes. I realize that ape computes the Felsenstein contrasts that incorporate Felsenstein's within species variance. However, does anyone have code in R for doing the complete method proposed by Felsenstein, including the likelihood ratio test he suggests? Another question: If one wanted to compare this phylogenetically controlled correlation between traits to a traditional correlation including within species variation, could you simply use a star phylogeny instead of the known phylogeny? Thanks! Scott [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Phylogenetic correlation
Dear R users, I am trying to compare correlation's among traits without phylogeny and with accounting for phylogenetic history (each data point is a species mean trait value). There is no clear predictor and no clear response variable between two traits. I thought that regression through the origin with independent contrasts was the correct method for this question, but if there is no clear predictor and no clear response, should correlation be used instead of regression? If so, are there any R functions that do this phylogenetic correlation? Thanks! Scott [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] reading nexus file from treebase?
Hello, I can't get read.nexus (ape) or readNexus (phylobase) to read nexus files downloaded from treebase with URLs parsed from xml files. I can't manually edit each file as I want to read a lot of these files. Is there an easy fix? One of the files is copied below. Thanks! Scott Chamberlain Rice University, EEB Dept. #NEXUS [!This data set was downloaded from TreeBASE, a relational database of phylogenetic knowledge. TreeBASE has been supported by the NSF, Harvard University, Yale University, SDSC and UC Davis. Please do not remove this acknowledgment from the Nexus file. Downloaded on March 24, 2011; 16:32 GMT TreeBASE (cc) 1994-2008 Study reference: Brown R., Yang Z. 2010. Bayesian Dating of Shallow Phylogenies with a Relaxed Clock. Systematic Biology, 59(2): 119-131. TreeBASE Study URI: http://purl.org/phylo/treebase/phylows/study/TB2:S10165] BEGIN TAXA; TITLE M4787; DIMENSIONS NTAX=16; TAXLABELS Chalcides_coeruleopunctatus_E2806.20 Chalcides_coeruleopunctatus_E2806.22 Chalcides_manueli_E2506.1 Chalcides_mionecton_mionecton_E2506.10 Chalcides_mionecton_mionecton_E2506.12 Chalcides_mionecton_trifasciatus_E2506.18 Chalcides_polylepis_E14124.1 Chalcides_polylepis_E14124.2 Chalcides_polylepis_E2506.21 Chalcides_sexlineatus_bistriatus_E2806.6 Chalcides_sexlineatus_sexlineatus_E2806.8 Chalcides_simonyi_E3007.2 Chalcides_sphenopsiformis_E8121.26 Chalcides_sphenopsiformis_E8121.27 Chalcides_viridanus_E2806.10 Chalcides_viridanus_E2806.14 ; END; BEGIN TREES; TITLE Tb10793; LINK TAXA = M4787; TREE Fig._3c = [R] ((Chalcides_sphenopsiformis_E8121.26,Chalcides_sphenopsiformis_E8121.27),(((Chalcides_viridanus_E2806.10,Chalcides_viridanus_E2806.14),((Chalcides_sexlineatus_bistriatus_E2806.6,Chalcides_sexlineatus_sexlineatus_E2806.8),(Chalcides_coeruleopunctatus_E2806.22,Chalcides_coeruleopunctatus_E2806.20))),(Chalcides_simonyi_E3007.2,((Chalcides_mionecton_trifasciatus_E2506.18,(Chalcides_mionecton_mionecton_E2506.12,Chalcides_mionecton_mionecton_E2506.10)),(Chalcides_manueli_E2506.1,(Chalcides_polylepis_E14124.1,(Chalcides_polylepis_E14124.2,Chalcides_polylepis_E2506.21))); [! TreeBASE tree URI: http://purl.org/phylo/treebase/phylows/tree/TB2:Tr6136] END; [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] R interface to treebase.org?
Hello, Are there any packages, or known functions for downloading trees from treebase.org? Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] mntd and mpd without community data
Thanks much Dan and Steve. Scott On Thursday, March 17, 2011 at 11:05 AM, Dan Rabosky wrote: Hi Scott- There are lots of indices to quantify tree shape differences, both in terms of topology (Colless etc) and temporal differences (e.g., Pybus and Harvey's gamma). MNTD and MPD will largely capture the temporal dimension of your trees and will be highly correlated with gamma. For example, if you have long terminal branches in your tree and with very short internal branches, gamma will be negative and both MPD and MNTD will be large. I don't think there is a right or wrong answer here and any index might be appropriate, but you will have to think hard about what exactly you want to quantify (e.g, topological imbalance or asymmetry versus branching time differences) and why. It might be good to think about standardized metrics, to control for differences in the number of taxa in trees. You may want to use several indices in concert. ~Dan Rabosky On Mar 17, 2011, at 8:45 AM, Scott Chamberlain wrote: Hello, I am curious if it is appropriate to calculate mntd (mean nearest taxon distance) and mpd (mean pairwise distance) in the picante package on trees themselves, that is, without community data. We are trying to think of informative metrics that can tell us something about tree shape among lots of different trees. Using mntd and mpd we give the functions a tree and just a vector of all 1's for the community data so that each species is equally abundant. Does this approach make sense? Are there better metrics to use given that we are just dealing with trees without community data? (I am aware of Sackin's, Colless', beta splitting, gamma, etc.) Here is a reproducible example of what I am doing: require(picante) require(ape) tree - rcoal(10) abund - rep(1, 10) names(abund) - tree$tip.label mpd_ - mpd(rbind(abund, abund), # can't have just one vector/community apparently cophenetic(tree))[1] # just one of the two numbers needed as they are the same Sincerely, Scott Chamberlain Rice University, EEB Dept. [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Assign node ages to a tree
Hello, We have trees for which we have estimated node ages for many nodes (but not all nodes in any one tree). We would like to assign node ages to the trees, and then later transform branch lengths according to node ages. How does one assign node ages in R? Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Assign node ages to a tree
Gene, Thanks very much. I should have said I am aware of bladj in the program Phylocom, but this is great that there are at least two additional methods. All of our trees have only extant species, and no extinct species. What exactly is the problem with having only extant species in relation to your function? Also, how does your and Graeme's function handle polytomies? Do they have to be resolved beforehand, or are they resolved within the code you or Graeme wrote? Scott On Friday, March 11, 2011 at 9:49 AM, Hunt, Gene wrote: Scott, I have written a function to transform branch lengths on a tree according to age constraints in the terminal taxa and (optionally) the nodes (attached). If your phylo object is tr, the command scalePhylo(tr, tip.ages, node.mins) will return a phylo object with new branch lengths scaled to the age constraints. Ages are positive numbers (e.g., in Ma). If all your taxa are extant, set tip.ages to be a vector of zeroes. The argument node.mins can have NA entries for nodes without constraints. I developed this for paleontological trees so the tip ages usually constrain branch lengths as well. This may not work exactly as you would like for trees of extant species with only some of the nodes constrained (some internal nodes can be pushed up to the recent). You may also want to look at Graeme Lloyd's function for doing this, which handles zero-length branches in a more elegant way: http://www.graemetlloyd.com/methdpf.html. Again, this was designed for paleontological applications, so it might not get you exactly what you need. The code may be a useful starting point, though. Best, Gene On 3/11/11 10:01 AM, Scott Chamberlain myrmecocys...@gmail.com wrote: Hello, We have trees for which we have estimated node ages for many nodes (but not all nodes in any one tree). We would like to assign node ages to the trees, and then later transform branch lengths according to node ages. How does one assign node ages in R? Thanks, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- Gene Hunt Curator, Department of Paleobiology National Museum of Natural History Smithsonian Institution [NHB, MRC 121] P.O. Box 37012 Washington DC 20013-7012 Phone: 202-633-1331 Fax: 202-786-2832 http://paleobiology.si.edu/staff/individuals/hunt.cfm Attachments: - Tree-node-ages.R [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] system() and clustalw2
Hello, I am doing something wrong but not sure what. I am trying to call clustalw2 with the system command, but with every attempt I get sh: clustalw2: command not found. Here is reproducible code: require(phangorn) # ITS 1 and 2 genes for Gossypium species cotton_acc - c(U56784, U56806, U12712, U56810, U12732, U12725, U56786, U12715, AF057758, U56790, U12716, U12729, U56798, U12727, U12713, U12719, U56811, U12728, U12730, U12731, U12722, U56796, U12714, U56789, U56797, U56801, U56802, U12718, U12710, U56804, U12734, U56809, U56812, AF057753, U12711, U12717, U12723, U12726) cotton - read.GenBank(cotton_acc) write.dna(cotton, cotton.fas, format = fasta) # multiple sequence alignment setwd(/Applications/clustalw-2.0.10-macosx/) # none of these work system(paste('clustalw2 -options cotton.fas output.log')) system(paste(clustalw2, cotton.fas)) system(paste(\clustalw2\, cotton.fas, cottonout.aln)) Thanks!!! Scott Chamberlain sessionInfo() R version 2.12.2 (2011-02-25) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] phyloch_1.4.48 XML_3.2-0 colorspace_1.0-1 phangorn_1.3-1 ape_2.6-2 [6] quadprog_1.5-3 loaded via a namespace (and not attached): [1] gee_4.13-16 grid_2.12.2 lattice_0.19-17 nlme_3.1-98 tools_2.12.2 [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Comparing the topology of two trees
There is also SH.test (Shimodaira-Hasegawa test) in package phangorn And the Icong index by de Vienne which only compares topology (See this website: http://www.ese.u-psud.fr/utilisateurs/devienne/index.html) -Scott On Thursday, March 3, 2011 at 11:37 AM, John Cumbers wrote: Hi Alastair, See these functions below, dist.topo is in library(Ape) Cheers, John # check for similarity # do the two trees produced by MrBayes and raxML have the same topology? all.equal(tree1, tree2, use.edge.length = FALSE) # result = TRUE or FALSE. # calculate the distance between the two tree, using default method. ( Penny and HardyÂs 1985) dist.topo(tree1, tree2) # result = numeric measure of distance On Wed, Mar 2, 2011 at 11:25 PM, Alastair Potts pott...@gmail.com wrote: Good day all, I was wondering if there is a tree statistic that compares the topology of two trees which gives and indication of the degree of similarity or dissimilarity between the trees? Cheers, Alastair ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Multiple sequence alignment in R?
Hello, Is clustal multiple sequence alignment implemented in any R packages, or is there an easy way to call ClustalW on your hard drive from R, perhaps with system() Sincerely, Scott Chamberlain Rice University, EEB Dept. [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Ultrametricize?
Dear R users, I am curious the best way to ultrametricize a tree to retain the relative branch lengths among species. For example, in the below code I the table pairwisedists shows that the branch length distances differ between the non-ultrametric tree and the ultrametric tree. That is, distances between species A and B and A and C are the same in one tree, but in the other tree they are different. I want to use pairwise distances among each species pair for phylogenetically controlled analyses, but I am not sure which method is best for ultrametricizing trees. library(ape) library(reshape2) tree - read.tree(text = ((Apis_mellifera:2,(Aedes_aegypti:1,(Drosophila_melanogaster:1,Oxyna_parietina:1):0.5):0.5):1,(((Homo_sapiens:2.5,(Lepus_europaeus:1,Mus_musculus:1):2):0.25,(((Gazella_dama:1,Gazella_dorcas:1):0.5,Odocoileus_virginanus:1):0.5,Equus_caballus:1):1):0.25,((Gambusia_holbrooki:1,Hoplosthethus_atlanticus:1):1,(((Oncorhynchus_mykiss:2,Oncorhynchus_clarki:2,Oncorhynchus_gorbuscha:2,Oncorhynchus_keta:2):1,Salvelinus_fontinalis:1):1,(Salmo_trutta:1,Salmo_salar:1):1):1):1):1):1;) tree2 - compute.brlen(tree, method = Grafen) # I used the 64 bit version, but in the 32 bit version the by column names are Var1 and Var2 for some reason pairwisedists - merge(melt(cophenetic(tree)), melt(cophenetic(tree2)), by = c(X1, X2)) Sincerely, Scott Chamberlain Rice University, EEB Dept. [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Simulate discrete characters on tree constrained tophylogenetic signal K
Dear Enrico/Emmanuel, Actually, I just realized I need continuous traits, not discrete. Sorry about that. Thanks so much for pointing me towards rTrait(using Cont). Would it be right that a one optima OU model with rTraitCont would have theta set to one single value? And a two optima model would have theta at two possible values for each branch? Etc.? Enrico, thanks very much for that thought. So I am simulating trees and traits on trees, and then calculating K using the phylosignal function. Thus, K is implicitly manipulated, instead of explicitly manipulated. Scott On Monday, January 31, 2011 at 3:28 AM, Enrico Rezende wrote: Scott, one important caveat that should be added is that, even when one knows and controls the parameters of the evolutionary model, the resulting dataset will have the expected amount of signal only ON AVERAGE, given the inherent stochasticity of these models. For instance, if you want K = 1 and assume Brownian motion character evolution on a given tree, you may still get data that have a K ranging between, say, 0.6 and 1.4 (with a mean K = 1, of course). Thus, you might want to quantify K after the simulations to ensure that you're obtaining the amount of signal desired. Ah yes, this applies primarily to quantitative traits, for qualitative characters things change a bit. Enrico Emmanuel Paradis escribió: On Fri, 28 Jan 2011 17:20:57 -0600 Scott Chamberlain myrmecocys...@gmail.com wrote: Dear R community, I would like to simulate discrete characters on a randomly generated tree. However, I would like to create different sets of trees and associated characters at certain levels of phylogenetic signal. If you know the relationship between phylogenetic signal (Blomberg et al's K in your case) and the parameters of the model used to simulate the characters, this would be easy. But I don't think this relationship is obvious, at least for discrete characters. Keep in mind also that, for a given model and parameters of evolution, the quantity of phylogenetic signal depends on the tree. Can someone point me in the right direction? I am familiar with sim.char from geiger package for simulating characters, and rcoal for simulating the ultrametric trees that I want, but I don't know how I could, if at all, simulate characters that have a particular a priori set phylogenetic signal. BTW, instead of rcoal() you may wish to use rbdtree(). And if you want more flexibility for simulating the characters, see rTraitDisc() in ape. Best, Emmanuel As a simple example, the following example gets phylogenetic signal (K) that is all over the map in different runs: q - list(rbind(c(-.5, .5), c(.5, -.5))) traits - sim.char(tree, q, model = discrete, n = 1) traits_ - as.data.frame(traits[,,1]) traitsvec - traits_[,1] names(traitsvec) - rownames(traits_) phylosignal(traitsvec, tree, reps = 100) Sincerely, Scott Chamberlain Rice University, EEB Dept. [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- *** Enrico L. Rezende Departament de Genètica i de Microbiologia Facultat de Biociències, Edifici Cn Universitat Autònoma de Barcelona 08193 Bellaterra (Barcelona) SPAIN Telephone: +34 93 581 4705 Fax: +34 93 581 2387 E-mail: enrico.reze...@uab.cat *** [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Testing topological similarity between trees
Dear R users, I am curious if anyone has implemented the Icong statistic (created by de Vienne et al. 2007 Bioinformatics vol. 23, 3119-3124) from within R (either built in functions or passing newick files to their website here: http://www.ese.u-psud.fr/bases/upresa/pages/devienne/index.html). de Vienne et al. created this website to calculate Icong, but I need to compare a lot of phylogenies and would like to do so from R. Thanks very much! Sincerely, Scott Chamberlain [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo