gl.tree.nj - missing values error

261 views
Skip to first unread message

Dallas

unread,
Aug 17, 2021, 3:19:26 PM8/17/21
to dartR
Hi there,

I'm trying to create a phylogenetic tree with my genlight object using the following code:
ph.tree <- gl.tree.nj(gl_complete, type="fan")
ph.tree

But I get the error: Error in ape::nj(d) : missing values are not allowed in the distance matrix Consider using njs()

I can't figure out how to remove the missing values it's talking about from my genlight object. I used gl.tree.nj with the testset.gl, and it worked. I looked into njs(), but it seemed more complicated than just removing the missing values.

Thanks!
Dallas

Arthur Georges

unread,
Aug 30, 2021, 9:36:31 AM8/30/21
to dartR
Not sure what is going on there Dallas. The testset.gl has lots of missing values, so I suspect that the issue is that one or more of your entities has missing values for all attributes. Perhaps you could try

D <- dist(gl)
D

to see if that is the issue.

BTW the neighbour joining tree gives a tree representation of genetic similarity, not really a phylogeny.

Arthur

Dallas

unread,
Aug 30, 2021, 6:38:15 PM8/30/21
to da...@googlegroups.com
Hey Arthur,

I ran the code you gave on my genlight object, but am unsure what I should be looking for? I didn't get any errors when I ran it.

Dallas

--
You received this message because you are subscribed to a topic in the Google Groups "dartR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dartr/FUmSFDu_4pY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dartr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/8730b9ec-ed00-495e-9f82-75df71590ae9n%40googlegroups.com.

Arthur Georges

unread,
Aug 30, 2021, 6:41:33 PM8/30/21
to da...@googlegroups.com
You are looking at the distance matrix to see if there are any NA's in there, as these could be causing the issues that you observed. :)

You received this message because you are subscribed to the Google Groups "dartR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dartr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/CAOeZsOmjkubH1WwDqiE3avj6H1WhRpBxei5xeTPfOAFrWuDg8A%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages