difference between dart object and genlight object

44 views
Skip to first unread message

Sangay Dema

unread,
May 1, 2023, 8:56:25 PM5/1/23
to dartR
Dear Luis,

I have installed the latest beta version of dartR and read the dart file into dartR using the function: gl.read.dart(dartfile). The documentation says it should be converted to genlight object but when I check my file, it is showing as dartR object. I never had this issue with previous versions and analyses. Therefore, can you explain the difference between dartR object and the genlight object and if there is a difference, a way to convert dartR object to the genlight object please.

thanks

Sangay

Bernd.Gruber

unread,
May 1, 2023, 9:06:15 PM5/1/23
to da...@googlegroups.com

Hi in case dartR object are causing trouble you can simply convert it back to a genlight object using

 

class(gl)<- "genlight"

 

 

Cheers, Bernd

 

==============================================================================

Dr Bernd Gruber                                              )/_         

                                                         _.--..---"-,--c_    

Professor Ecological Modelling                      \|..'           ._O__)_     

Tel: (02) 6206 3804                         ,=.    _.+   _ \..--( /          

Fax: (02) 6201 2328                           \\.-''_.-' \ (     \_          

Institute for Applied Ecology                  `'''       `\__   /\          

Faculty of Science and Technology                          ')                

University of Canberra   ACT 2601 AUSTRALIA

Email: bernd....@canberra.edu.au

WWW: bernd-gruber

 

Australian Government Higher Education Provider Number CRICOS #00212K 

NOTICE & DISCLAIMER: This email and any files transmitted with it may contain
confidential or copyright material and are for the attention of the addressee
only. If you have received this email in error please notify us by email
reply and delete it from your system. The University of Canberra accepts
no liability for any damage caused by any virus transmitted by this email.

==============================================================================

--
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/01d89eb1-5187-49e4-a488-73e8e63ce16en%40googlegroups.com.

Jose Luis Mijangos

unread,
May 1, 2023, 9:30:43 PM5/1/23
to dartR
Hi Sangay,

The dartR object is the same as a genlight object in almost all aspects. 

One of the differences is that when subsetting a dartR object "by hand" (see code below), the metadata of individuals and loci are subsetted at the same time. This differs from subsetting "by hand" a genlight object in which only the genotypes are subsetted but not the metadata. 

library(dartR)
# test dataset
t1 <- platypus.gl
# checking the class of the object
class(t1)
# subsetting loci by hand in a genlight object
t1 <- t1[,1:10]
# locmetrics were not subsetted.
t1$other$loc.metrics


t2 <- platypus.gl
# converting a genlight object into a dartR object
class(t2) <- "dartR"
# subsetting loci by hand in a dartR object
t2 <- t2[,1:10]
# locmetrics were also subsetted.
t2$other$loc.metrics

We have plans for adding many features to the dartR object, which will be described in a nice tutorial. 

Cheers,
Luis

Sangay Dema

unread,
May 2, 2023, 3:17:08 AM5/2/23
to da...@googlegroups.com
Thanks, Bernd and Luis, for your prompt response and clarification. I see that with the new version of dartR (vanilla), when you read the DArTseq SNP data file received from DArT, unlike in the past, where the object gets converted to genlight object, they seem to stay as dartr object, right? It did not make any difference in implementing PCA using the dartR function gl.pcoa, so I am assuming that it did convert to genlight object though it says as DARTR object. Can you please clarify this for me?

However, when running pairwise fst using the function " stamppFst" of package StAMPP, in the past, I could calculate directly on the genlight object converted by the function gl.read.dart(dartfile). This time, it does not seem to work, so does it mean that I have to convert the object to geno format using the function from package LEA? Implementing the function "gl.fst.pop" directly in the DARTR object works but I am not sure about the underlying assumptions and calculation methods between using "gl.fst.pop" directly on genlight object and using "stamppFst" on geno object. Any clarification or pointing me to relevant literature would be helpful.

thanks a lot and look forward to your answers.

Sangay



--
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.

Jose Luis Mijangos

unread,
May 3, 2023, 1:18:10 AM5/3/23
to dartR
Hi Sangay,

The function gl.fst.pop is a wrapper for the function "stamppFst" from package StaAMPP as described in the function documentation. One way to access the documentation of the function is by typing in the R console: help(function_name) or ?function_name

Within dartR there is no difference between a dartR object and a genlight object.

As Bernd said in his response, in case dartR object is causing trouble you can simply convert it back to a genlight object using:

class(gl)<- "genlight"

Cheers,

Luis 

Sangay Dema

unread,
May 3, 2023, 9:04:43 PM5/3/23
to da...@googlegroups.com
Hi Jose,

Thank you so much for the clarification. Very helpful.

Best,

Sangay

Reply all
Reply to author
Forward
0 new messages