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

Crawford, Douglas L dcrawford at rsmas.miami.edu
Tue Jun 13 03:41:57 CEST 2017


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<http://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<mailto:dcrawford at miami.edu>
http://www.funhe-evol.org/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20170613/7151edae/attachment.html>


More information about the adegenet-forum mailing list