dendropy.utility.error.UltrametricityError when using TACT #230
Description
Activity
ape, DendroPy, and phyx all compute ultrametricity in different ways. I disagree with DendroPy's approach since it looks at every single node in the tree and raises an error if the ages of the left and right children of the parent node differ by some threshold (set to 1e-5). I think ape looks at the relative maximum difference in root-to-tip distance and phyx looks at the variance in root-to-tip distances (which ape used to use).
I'll probably write something in tact to address this but for now you can use
nnls.tree(cophenetic(phy), phy, TRUE)in the R package phangorn to fix the tree.Reacted by Miao SunReacted by Miao SunThanks for your respond @jonchang ! I have tried with
phytools::force.ultramtric()with "method = 'extend'" and it requires 45 Gb memory request; with "method = 'nnls'" andphangorn::nnls.tree(cophenetic(phy), phy, TRUE)raising the same error msg:> library("phangorn") Loading required package: ape > tree <- read.tree("GBMB_bi-rmbadtip.tre") > library("phytools") Loading required package: maps > tree2 <- force.ultrametric(tree, method="nnls") Error in double(nm * nm) : vector size cannot be NA In addition: Warning message: In nm * nm : NAs produced by integer overflow > tree3 <- nnls.tree(cophenetic(tree), tree, rooted =TRUE) Error in double(nm * nm) : vector size cannot be NA In addition: Warning message: In nm * nm : NAs produced by integer overflowBut no worries, I'm looking forward to your update.
Thank you so much!
MiaoMiao, can you see if #231 fixes the ultrametricity check?
Hi, I'm trying now. Should I re-install tact and rerun again?
I'm on a Ubuntu machine.
I have upgraded TACT:
[cactus]$ pipx upgrade tact upgraded package tact from 0.3.1 to 0.3.4 (location: /home/cactus/.local/pipx/venvs/tact)And reran it, and the issue remains.
Miao
You'll need to install it from the branch, like so:
pipx install git+https://github.com/jonchang/tact.git@fix-ultrametricityReacted by Miao SunHi,
Thanks for the tip! I have upgraded the tact. Now the error message is new, said:
[cactus]$ cat tacted.test.log.txt Reading taxonomy Reading backbone Tree is not ultrametric!However, phyx said the tree is ultrametric:
[cactus]$ pxlstr -t GBMB_bi-rmbadtip.tre tree #: 0 rooted: true binary: true nterminal: 78929 ninternal: 78928 branch lengths: true rttipvar: 2.23112e-10 treelength: 490017 ultrametric: true rootheight: 325.05Thanks!
Miao
Can you email me the tree?
Can you email me the tree?
Yes, I send the data to you at "me@jonathanchang.org" [not sure about the email address :P].
Thanks!
Miao
Tree is not ultrametric: (('Platea latifolia', 325.0477049999999), ('Ginkgo biloba', 325.05001799999997))
I think I'll solve this by just letting you set an ultrametricity precision.
Ok, try
pipx uninstall tact && pipx install git+https://github.com/jonchang/tact.git@fix-ultrametricityagain and try passing--ultrametricity-precision. Note that this will coerce your ages to be a bit older (so the root-to-tip distance for Platea latifolia will be slightly larger).Reacted by Miao SunReacted by Miao SunHey @jonchang , I have done as what you instructed
pipx uninstall tact && pipx install git+https://github.com/jonchang/tact.git@fix-ultrametricity, and pass--ultrametricity-precision.please let me know if I did anything wrong here, the program has not finished with error msg:
Tree is not ultrametric!
Platea latifolia has a root distance of 325.0477049999999, but Ginkgo biloba has 325.05001799999997
If this is unexpected, consider setting--ultrametricity-precisionor using phytools::force.ultrametric in R
allTaxoPlantsTrees.gbmb.tacted.test.log.txt (END)tact_add_taxa --backbone backbone.tre --taxonomy taxonomy.ed.tre --output tacted.test --ultrametricity-precision 1e-6Try with a higher number. 1e-6 implies six figs of similarity, so you'd need something like 1e-3 or 1e-2.
Try with a higher number. 1e-6 implies six figs of similarity, so you'd need something like 1e-3 or 1e-2.
Thanks for the detailed instruction @jonchang !! it worked and finished this time. 👍
This fix is now released as part of tact 0.4.0: https://github.com/jonchang/tact/releases/tag/v0.4.0
Hi @jonchang ,
I'm trying to use TACT adding some species to GBMB.tre from Smith and Brown (2018). The backbone is fine, which was confirmed by phyx.
When I run TACT with
tact_add_taxafunction, it gives error as below:I suspect it could be issues from dendropy, not really TACT, but would like to hear from your advice first. Thank you!
Happy to mail you my tree file and taxonomy data if you have time to check it.
Cheers,
Miao