how to add latlon data to a genlight

35 views
Skip to first unread message

Deo Angelo Macahig

unread,
Apr 27, 2023, 10:10:29 AM4/27/23
to dartR
Hello everyone,

I want to generate an IBD plot from a SNP dataset (not from DArT, initially no attached lat lon data but I do have access to this info) using the gl.ibd function.
I have successfully converted the SNP dataset to a genlight one, and was able to already use some of the other dartR functions with no errors. Now that I try to perform the gl.ibd function, I encounter an error:

Error in gl.ibd(Cgla_Cmar_86_10pops_bi_removed_nomaf.gl, coordinates = coords) :
  Cannot find coordinates for each individual in slot @other$latlon.

Does anyone know how I can add the latlon info to my genlight object?
Thank you very much.

Deo Angelo Macahig

unread,
Apr 27, 2023, 5:00:26 PM4/27/23
to dartR
Solved it already. Just one more question, has the plot generated for the gl.ibd function changed from years ago?
I seem to remember getting a colored plot and now I get this which is still correct - just wanna make sure Im not doing anything wrong. Thanks!
Cgla_Cmar_86_10pops_bi_removed_nomaf_IBD.png

Jose Luis Mijangos

unread,
May 1, 2023, 3:59:34 AM5/1/23
to dartR
Hi,

You can use the function parameter "paircols" to color each pairwise comparison, for example:

> library(dartR)
> ibd2 <- gl.ibd(x=platypus.gl, paircols = "pop")

Cheers,
Luis 
Reply all
Reply to author
Forward
0 new messages