TESS format from genlight

16 views
Skip to first unread message

Susan Miller

unread,
Apr 12, 2023, 8:41:25 AM4/12/23
to dartR
Hi,
Does anyone know how to convert a genlight object to a format suitable for tess3r?

the required format is: 1 row per individual, snps coded as 0, 1 and 2

I've tried quite a few of the options in dartR and I can't find one that gives this format. Any suggestions?

thanks,
Susan

Jose Luis Mijangos

unread,
Apr 12, 2023, 10:05:03 PM4/12/23
to dartR
Hi Susan,

Can you try the code below:

Cheers,
Luis 

devtools::install_github("bcm-uga/TESS3_encho_sen")
library(tess3r)
t1 <- gl.filter.callrate(platypus.gl,threshold = 1)
genotype <- as.matrix(t1)
coordinates <- as.matrix(t1$other$latlon)
tess3.obj <- tess3(X = genotype, coord = coordinates, K = 1:3,
                   method = "projected.ls", ploidy = 2, openMP.core.num = 1) 

Bernd.Gruber

unread,
Apr 12, 2023, 10:32:07 PM4/12/23
to da...@googlegroups.com

Would not be a simple

 

as.matrix(gl)

 

do the trick?

 

Cheers, Bernd

 

 

P.S. In case you need them as strings per row that might help

 

> glm <-(as.matrix(possums.gl[1:5,1:7]))

>

> glms <- apply(glm, 1, function(x) paste(x, collapse = ""), simplify = F)

>

> rglms <- do.call(rbind, glms)

> rglms

  [,1]    

1 "1212221"

2 "1111110"

3 "2020111"

4 "0120010"

5 "1212221"

> 

 

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

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/46bd163b-5824-4925-9b69-27862506fb92n%40googlegroups.com.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages