BPerezLamarque / HOME

1 stars 0 forks source link

The tutorial script add_host_tips.R not working on FASTTREE or IQTREE version of the trees #3

Closed Jigyasa3 closed 1 year ago

Jigyasa3 commented 1 year ago

Dear @BPerezLamarque ,

Thank you again for the add_host_tips.R script to add new host tips with branch lengths close to 0. I have been able to run this script successfully on a host tree from BEAST2. But when I run it using the version of the host tree from FASTTREE or IQTREE, I keep getting the following error and the edge length of the output tree is all NULL.

Error in if (where <= Ntip(tree) && position == 0) { : missing value where TRUE/FALSE needed

My files and version of the script used is here

BPerezLamarque commented 1 year ago

Hi @Jigyasa3,

It seems that the trees you generated using FASTTREE and IQTREE are not time-calibrated and contain branch lengths of 0 : you need to first calibrate these trees (e.g. using the chronos function in the R-package ape, or PATHd8 or treePL) to obtain calibrated trees. The function add_host_tips.R should work once you have calibrated trees. In addition, to run add_host_tips.R you need your trees to be in the "phylo" class, using "read.iqtree()" this is not the case, thus you must use "as.phylo()" to have the correct class.

All best, Benoît

Jigyasa3 commented 1 year ago

Hi Benoit,

Thank you for your reply. I changed the edge.length value from Null to zero in the script. It generated a tree with the original edge lengths and zero edge lengths for added branches. Would I still need to calibrate the trees?

Thanks for the advice on as.phylo() object. I also added that to the script.

Regards, Jigyasa

On Wed, Jan 11, 2023, 8:11 PM Benoît Perez-Lamarque < @.***> wrote:

Hi @Jigyasa3 https://github.com/Jigyasa3,

It seems that the trees you generated using FASTTREE and IQTREE are not time-calibrated and contain branch lengths of 0 : you need to first calibrate these trees (e.g. using the chronos function in the R-package ape, or PATHd8 or treePL) to obtain calibrated trees. The function add_host_tips.R should work once you have calibrated trees. In addition, to run add_host_tips.R you need your trees to be in the "phylo" class, using "read.iqtree()" this is not the case, thus you must use "as.phylo()" to have the correct class.

All best, Benoît

— Reply to this email directly, view it on GitHub https://github.com/BPerezLamarque/HOME/issues/3#issuecomment-1378588893, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUN5HLJDJFTTCSU3BAEETWR2IM5ANCNFSM6AAAAAATXLNL24 . You are receiving this because you were mentioned.Message ID: @.***>

BPerezLamarque commented 1 year ago

Hi Jigyasa,

OK perfect. Yes you have to calibrate the tree before running add_host_tips.R because add_host_tips.R and then HOME require a time-calibrated tree.

All best, Benoît