Discussion:
[R-sig-phylo] Rescaling a cophenetic matrix based on the Early Burst Model?
Max Farrell
2017-12-15 21:27:24 UTC
Permalink
I have been using the rescale function from geiger for a link prediction
model I recently helped develop (https://arxiv.org/abs/1707.08354). I'm now
running this model on a much larger dataset and part of the code is
computing cophenetic(rescale(phy)) with 'EB' rescaling many many times.

We're finding that calling cophenetic() is the rate limiting step, and if
we can avoid this function we expect to speed up our code by up to 4 times.
This would be very useful as our simulation has been running for over 50
days now...

I was wondering if there is a way to do EB transformations on a
phylogenetic distance matrix directly so as to avoid using the cophenetic
function?

Any help or insights would be greatly appreciated!

[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/
Cecile Ane
2017-12-15 21:36:17 UTC
Permalink
In the package phylolm, the function "transf.branch.lengths” might do what you need. It has an option model=“EB” for early burst.
Cécile
Post by Max Farrell
I have been using the rescale function from geiger for a link prediction
model I recently helped develop (https://arxiv.org/abs/1707.08354). I'm now
running this model on a much larger dataset and part of the code is
computing cophenetic(rescale(phy)) with 'EB' rescaling many many times.
We're finding that calling cophenetic() is the rate limiting step, and if
we can avoid this function we expect to speed up our code by up to 4 times.
This would be very useful as our simulation has been running for over 50
days now...
I was wondering if there is a way to do EB transformations on a
phylogenetic distance matrix directly so as to avoid using the cophenetic
function?
Any help or insights would be greatly appreciated!
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-a
Max Farrell
2017-12-15 21:55:46 UTC
Permalink
Hi Cecile,

Thanks for the input - it looks like this function does perform the tree
rescaling, and in about 1/4 of the time, so this could help speed up the
code!

However, the function doesn't seem to return a covariance matrix. Is there
a way to get the cophenetic matrix with the out put of this function?
Otherwise I'm stuck using cophenetic again...

Max

Max
Post by Cecile Ane
In the package phylolm, the function "transf.branch.lengths” might do what
you need. It has an option model=“EB” for early burst.
Cécile
Post by Max Farrell
I have been using the rescale function from geiger for a link prediction
model I recently helped develop (https://arxiv.org/abs/1707.08354). I'm
now
Post by Max Farrell
running this model on a much larger dataset and part of the code is
computing cophenetic(rescale(phy)) with 'EB' rescaling many many times.
We're finding that calling cophenetic() is the rate limiting step, and if
we can avoid this function we expect to speed up our code by up to 4
times.
Post by Max Farrell
This would be very useful as our simulation has been running for over 50
days now...
I was wondering if there is a way to do EB transformations on a
phylogenetic distance matrix directly so as to avoid using the cophenetic
function?
Any help or insights would be greatly appreciated!
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at ht
Cecile Ane
2017-12-15 22:26:47 UTC
Permalink
Not in phylolm, because it’s faster to avoid manipulating this large matrix, if possible (and it is indeed possible for many purposes). If you can rephrase your calculations to use branching times (distance from a node to its descendant tips) or using the nodes’ distance to the root, then you could use functions like pruningwise.branching.times and pruningwise.distFromRoot in phylolm. Other folks could chime in, for tools in other packages.
Cécile

On Dec 15, 2017, at 3:55 PM, Max Farrell <***@gmail.com<mailto:***@gmail.com>> wrote:

Hi Cecile,

Thanks for the input - it looks like this function does perform the tree rescaling, and in about 1/4 of the time, so this could help speed up the code!

However, the function doesn't seem to return a covariance matrix. Is there a way to get the cophenetic matrix with the out put of this function? Otherwise I'm stuck using cophenetic again...

Max

Max

On Fri, Dec 15, 2017 at 4:36 PM, Cecile Ane <***@wisc.edu<mailto:***@wisc.edu>> wrote:
In the package phylolm, the function "transf.branch.lengths” might do what you need. It has an option model=“EB” for early burst.
Cécile
Post by Max Farrell
I have been using the rescale function from geiger for a link prediction
model I recently helped develop (https://arxiv.org/abs/1707.08354). I'm now
running this model on a much larger dataset and part of the code is
computing cophenetic(rescale(phy)) with 'EB' rescaling many many times.
We're finding that calling cophenetic() is the rate limiting step, and if
we can avoid this function we expect to speed up our code by up to 4 times.
This would be very useful as our simulation has been running for over 50
days now...
I was wondering if there is a way to do EB transformations on a
phylogenetic distance matrix directly so as to avoid using the cophenetic
function?
Any help or insights would be greatly appreciated!
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/



[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail
Klaus Schliep
2017-12-15 23:01:34 UTC
Permalink
Dear Max,
there is a function called coph in phangorn. The function is hidden in the
name space, so you have to use phangorn:::coph.
It returns a dist object instead of a matrix and computing time is roughly
O(n^2) instead of O(n^3).
library(phangorn)> tree <- rtree(10000)
system.time(cm1 <- cophenetic(tree))
user system elapsed
4.312 0.428 4.752
system.time(cm2 <- phangorn:::coph(tree))
user system elapsed
0.228 0.036 0.262
For large trees you are likely running out of memory, so Cecile's approach
is in the long run probably better.
Cheers,
Klaus
Not in phylolm, because it’s faster to avoid manipulating this large
matrix, if possible (and it is indeed possible for many purposes). If you
can rephrase your calculations to use branching times (distance from a node
to its descendant tips) or using the nodes’ distance to the root, then you
could use functions like pruningwise.branching.times and
pruningwise.distFromRoot in phylolm. Other folks could chime in, for tools
in other packages.
Cécile
Hi Cecile,
Thanks for the input - it looks like this function does perform the tree
rescaling, and in about 1/4 of the time, so this could help speed up the
code!
However, the function doesn't seem to return a covariance matrix. Is there
a way to get the cophenetic matrix with the out put of this function?
Otherwise I'm stuck using cophenetic again...
Max
Max
In the package phylolm, the function "transf.branch.lengths” might do what
you need. It has an option model=“EB” for early burst.
Cécile
Post by Max Farrell
I have been using the rescale function from geiger for a link prediction
model I recently helped develop (https://arxiv.org/abs/1707.08354). I'm
now
Post by Max Farrell
running this model on a much larger dataset and part of the code is
computing cophenetic(rescale(phy)) with 'EB' rescaling many many times.
We're finding that calling cophenetic() is the rate limiting step, and if
we can avoid this function we expect to speed up our code by up to 4
times.
Post by Max Farrell
This would be very useful as our simulation has been running for over 50
days now...
I was wondering if there is a way to do EB transformations on a
phylogenetic distance matrix directly so as to avoid using the cophenetic
function?
Any help or insights would be greatly appreciated!
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
--
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston
http://www.phangorn.org/

[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://
Loading...