Hi Vincenzo, "node.dating" is a help topic that points to two functions which seem to do what you are looking for. As a simple example:
R> n <- 3 R> tr <- rcoal(n) R> estimate.dates(tr, rep(0, n), .01) [1] 0.00000 0.00000 0.00000 -144.32183 -43.67435 R> estimate.dates(tr, rep(0, n), .1) [1] 0.000000 0.000000 0.000000 -14.432183 -4.367435 By setting the dates all equal to zero this assumes an ultrametric tree. Note that the input tree can be non-ultrametric: R> tr <- rtree(n) R> estimate.dates(tr, rep(0, n), .1) [1] 0.00000 0.00000 0.00000 -12.36168 -6.29650 R> estimate.dates(tr, rep(0, n), .01) [1] 0.0000 0.0000 0.0000 -123.6168 -62.9650 The third argument is the given (fixed) value of mu. Another function that you may check is chronoMPL(): it is based on a simple method (the reference is in the help page) which could be useful in your case. Best, Emmanuel ----- Le 4 Mar 24, à 23:09, Vincenzo Ellis <vael...@udel.edu> a écrit : > Dear Emmanuel, > Thank you very much for your response. I cannot see how to provide the > substitution rate to the phangorn::pml_bb() function, but I was looking at the > ape::node.dating() function and it appears that I could provide the > substitution rate to the "mu" argument and then set the "node.dates" argument > to NA or zero for all tips (I'm not sure if NA or zero would be preferable to > force the tips to all be from a single time point). Do you think that would > work? I'm not sure how to make ape::node.dating() accept a substitution rate > rather than try to estimate one. Maybe an option could be added to allow mu to > equal a user-specified number rather than the output of ape:: [ > http://estimate.mu/ | estimate.mu ] ()? > Another option might be to calculate an estimated age for every node > connecting > sister taxa in the tree by converting the genetic distances between sister > pairs to divergence times using the substitution rate and then use those as > priors in ape::chronos(). I suppose I could also apply that logic to date all > of the nodes by using the mean pairwise distances between taxa on either side > of a node and converting that to divergence times (although the R code for > such > a calculation would likely take me a while to figure out). Would that be > another option? > Thanks again, > Vincenzo > On Sat, Mar 2, 2024 at 5:44 AM Emmanuel Paradis < [ > mailto:emmanuel.para...@ird.fr | emmanuel.para...@ird.fr ] > wrote: >> Hi Vincenzo, >> There's no direct way to do this with ape::chronos(). You may have a look at >> the >> function phangorn::pml_bb() but I'm not sure it can estimate the dates if the >> rate is provided in a model object given as main argument(?) >> That said, I expect that estimating so many dates to be very challenging >> (unless >> you have a lot of known dates for calibration). This implies that you are >> certainly right to look for an approach where you don't need to estimate the >> rates. >> Best, >> Emmanuel >> ----- Le 27 Fév 24, à 22:40, Vincenzo Ellis [ mailto:vael...@udel.edu | >> vael...@udel.edu ] a écrit : >> > Dear R-sig-phylo members, >> > I've made a maximum likelihood tree in Raxml for several thousand taxa >> > using a single gene that has an estimated substitution rate of 0.006 >> > substitutions/nucleotide/My. Is there a way to use chronos in ape to apply >> > that substitution rate as a fixed clock rate and generate an ultrametric >> > time-scaled version of the tree? >> > Thank you, >> > Vincenzo >> > [[alternative HTML version deleted]] >> > _______________________________________________ >>> R-sig-phylo mailing list - [ mailto:R-sig-phylo@r-project.org | >> > R-sig-phylo@r-project.org ] >>> [ https://stat.ethz.ch/mailman/listinfo/r-sig-phylo | >> > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo ] >>> Searchable archive at [ >>> http://www.mail-archive.com/r-sig-phylo@r-project.org/ | >> > http://www.mail-archive.com/r-sig-phylo@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/