[adegenet-forum] adegenet - a.score.opt vs. xvalDAPC

Thibaut Jombart thibautjombart at gmail.com
Wed Jun 14 13:15:15 CEST 2017


Hello,

this should work with the devel version using 'tab' on the genlight
object, but I have just seen an issue accessing C functions underlying
genlight on most recent R. Investigating. Will post back soon.

Best
Thibaut

--
Dr Thibaut Jombart
Lecturer, Department of Infectious Disease Epidemiology, Imperial College London
Head of RECON: repidemicsconsortium.org
WHO Consultant - outbreak analysis
sites.google.com/site/thibautjombart/
Twitter: @TeebzR
+44(0)20 7594 3658


On 13 June 2017 at 02:41, Crawford, Douglas L <dcrawford at rsmas.miami.edu> wrote:
> Good Afternoon,
>     I cannot get results from “xialdapc”.   I apologize for the long list of
> attempts.
> In general,    I have followed the advice in the "A tutorial for
> Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0”,
> "https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html” and
> thibautjombart commented on May 9 • edited  about Replace NA in genlight
> file for xvalDapc #168
>
> Mydata;
> Using penlight object:
> /// GENLIGHT OBJECT /////////
>
>  // 69 genotypes,  3,243 binary SNPs, size: 487.6 Kb
>  32430 (14.49 %) missing data
>
>  // Basic content
>    @gen: list of 69 SNPbin
>    @ploidy: ploidy of each individual  (range: 2-2)
>
>  // Optional content
>    @ind.names:  69 individual labels
>    @loc.names:  3243 locus labels
>    @pop: population of each individual (group size range: 4-22)
>    @other: a list containing: sex  phenotype  pat  mat
>
> COMMANDS & ERRORS:
> cmd:
> xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result =
> "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30,
> xval.plot = TRUE)
>
> #error
> Error in sort.list(y) : 'x' must be atomic for 'sort.list'
> Have you called 'sort' on a list
>
> cmd:
> grp <- pop(CR_grp)
> cmd:
> xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result =
> "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30,
> xval.plot = TRUE)
> #error
> Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a
> data.frame
>
> Following DAPC tutorial 2.0.0
> Cmd:
> mat <- as.matrix(na.replace(CR_grp, method="mean"))
> # error
> Error in as.matrix(na.replace(CR_grp, method = "mean")) :
>   error in evaluating the argument 'x' in selecting a method for function
> 'as.matrix': Error: could not find function "na.replace"
>
> Following thibautjombart commented on May 9
>
> Cmd:
> mat <- as.matrix(CR_grp, NA.method = "mean")
> #ok
> Cmd:
> grp <- pop(CR_grp)
> #ok
>
> Cmd:
> xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9,
>                  result = "groupMean", center = TRUE, scale = FALSE,
>                  n.pca = NULL, n.rep = 30, xval.plot = TRUE)
> error:
> Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,  :
>   na entries in table
>
>
> Following https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html
>
> CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp))
> #Error in (function (classes, fdef, mtable) : unable to find an inherited
> method for function ‘tab’ for signature ‘"genlight"’
> CRgrpx <- xvalDapc(CR_grp, pop(CR_grp))
> #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na
> entries in table
>
> Any suggestions would be appreciated.
>
> Douglas
>
>
> ——************________*********————
> Douglas L. Crawford
> Professor, Marine Biology & Ecology
> Rosenstiel School of Marine & Atmospheric Science
> University of Miami
> 4600 Rickenbacker Causeway
> Mami, FL 33149
> 305-421-4121
>
> dcrawford at miami.edu
> http://www.funhe-evol.org/
>
>
>
> _______________________________________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum


More information about the adegenet-forum mailing list