xavierdidelot / BactDating

Bayesian inference of ancestral dates on bacterial phylogenetic trees
https://xavierdidelot.github.io/BactDating
MIT License
81 stars 15 forks source link

Error with 0 branch lengths #5

Closed rgladstone closed 5 years ago

rgladstone commented 5 years ago

I got the following error from one of my trees "Error in if (log(runif(1)) < l2 - l + dgamma(mu2, shape = 0.001, scale = 1000, : missing value where TRUE/FALSE needed" It appears I had a zero branch length causing the problem which I got around by rerooting.

xavierdidelot commented 5 years ago

Dear Rebecca,

Thanks for this report. Having a branch of length zero should not be a problem in itself. Could you send me perhaps by email more information to allow me to reproduce the problem and investigate further?

Best wishes, Xavier

rgladstone commented 5 years ago

Hi Xavier,

Please find examples attached, I only came across this issue for 2/73 of lineage trees, both trees gave a distance for the root ending in “):0.0;” mid-point rooting resolved the issue.

BW

Rebecca

From: Xavier Didelot notifications@github.com Reply-To: xavierdidelot/BactDating reply@reply.github.com Date: Monday, 12 November 2018 at 10:07 To: xavierdidelot/BactDating BactDating@noreply.github.com Cc: Rebecca Gladstone rg9@sanger.ac.uk, Author author@noreply.github.com Subject: Re: [xavierdidelot/BactDating] Error with 0 branch lengths (#5)

Dear Rebecca,

Thanks for this report. Having a branch of length zero should not be a problem in itself. Could you send me perhaps by email more information to allow me to reproduce the problem and investigate further?

Best wishes, Xavier

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_xavierdidelot_BactDating_issues_5-23issuecomment-2D437824125&d=DwMFaQ&c=D7ByGjS34AllFgecYw0iC6Zq7qlm8uclZFI0SqQnqBo&r=v6s6pvOcw9r40RHMkRZgyg&m=9Eq0sPgXKOMZUysv7JHEXWxiNvMFtQIZ_H3Ze4ivE5U&s=T5NEXOTt4MPs8FcIjbSHGYufXnRoWefrTFrGd7xNAGg&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AbCjdKS1O0tC5OTvfU8o7lbykXo7SN4Oks5uuUhLgaJpZM4YQyrU&d=DwMFaQ&c=D7ByGjS34AllFgecYw0iC6Zq7qlm8uclZFI0SqQnqBo&r=v6s6pvOcw9r40RHMkRZgyg&m=9Eq0sPgXKOMZUysv7JHEXWxiNvMFtQIZ_H3Ze4ivE5U&s=3PbLy-EfIzJXvnrOoNuIDdG5UjP5L9SmV74bnvTKYlA&e=.

-- The Wellcome Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

xavierdidelot commented 5 years ago

Hi Rebecca,

The problem with these two trees is that they contain a 3-way polytomy at the root. This is usually a sign that the tree should be seen as unrooted, and I think usually read.tree interprets this correct, but here for some reason it did not and returned your trees as if they were rooted. So you can solve the problem by midbranch rooting as you wrote, or using tree=unroot(tree) to make it explicit that the tree is unrooted.

Best wishes, Xavier