[adegenet-forum] xvalDapc, help for arguments "x" and "grp"
Roman Luštrik
roman.lustrik at biolitika.si
Thu Mar 17 12:56:26 CET 2016
Hi Maïlis,
in xvalDapc `x` argument is your DAPC result (`tab(dapc1)`) and `grp` is the membership of individuals in groups. The latter is sometimes found in // Optional content, but you appear to not have this. You will have to assign indviduals to a population some other way. You tried using `find.clusters` and you can access group membership by taking out a $grp element. In your case that would be
xvalDapc(tab(dapc1), grp = grp$grp)
I omitted `x =` which is personal preference of always omitting first argument in a function call.
Let us know if this works.
Cheers,
Roman
----
In god we trust, all others bring data.
----- Original Message -----
From: "Maïlis" <mailis at kwata.net>
To: adegenet-forum at lists.r-forge.r-project.org
Sent: Tuesday, January 26, 2016 12:01:31 PM
Subject: [adegenet-forum] xvalDapc, help for arguments "x" and "grp"
Hello,
I am contacting you because I use the DAPC fonction of adegenet package without encountering any particular problems. However , I would like to use the cross validation, and that 's when it no longer works..
> database<-read.table(file.choose("C:/Users/.../XXX.txt"), header=TRUE, sep=",",na.strings="-9")
> x<- df2genind(data.frame(database), sep="/", ncode=3, p=NULL, NA.char="-9", ploidy=2, type=c("codom"),strata=NULL, hierarchy=NULL)
/// GENIND OBJECT /////////
// 341 individuals; 7 loci; 164 alleles; size: 264.9 Kb
// Basic content
@tab: 341 x 164 matrix of allele counts
@loc.n.all: number of alleles per locus (range: 13-30)
@loc.fac: locus factor for the 164 columns of @tab
@all.names: list of allele names for each locus
@ploidy: ploidy of each individual (range: 2-2)
@type: codom
@call: df2genind(X = data.frame(database), sep = "/", ncode = 3, pop = NULL,
NA.char = "-9", ploidy = 2, type = c("codom"), strata = NULL,
hierarchy = NULL)
// Optional content
- empty -
Warning message:
In df2genind(data.frame(database), sep = "/", ncode = 3, p = NULL, :
duplicate labels detected for some individuals; using generic labels
> grp<-find.clusters(x, max.n.clust=9)
Choose the number PCs to retain (>=1): 140
Choose the number of clusters (>=2): 6
> dapc1<-dapc(x,grp$grp)
Choose the number PCs to retain (>=1): 40
Choose the number discriminant functions to retain (>=1): 5
It works but, for using xvalDapc
I don't know what to choose as an argument for " x" and " grp ". I tried severals things but that didn't work.
Can you advise me on the arguments to use?
Thank you in advance for your reply,
Best regards,
Maïlis
Cet e-mail a été envoyé depuis un ordinateur protégé par Avast.
www.avast.com
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20160317/015c283c/attachment-0001.html>
More information about the adegenet-forum
mailing list