[adegenet-forum] DAPC a priori grouping and find.clusters

Rita Castilho rita.castil at gmail.com
Mon Dec 23 16:32:20 CET 2013


Hi!
Here are the the scatter commands too. If I ask for ellipses, I get 5 
(species) ellipses. But then, what is the meaning of the two colors 
(light blue and red)? And for two groups, what is the graphic solution?
Thanks
Rita



#DAPC Analysis#
#perform temporary DAPC
dapc <- dapc(infile, pop=NULL, n.pca=NULL, n.da=NULL)
###evaluate number of PCAs to retain
a=optim.a.score(dapc, n.pca = 1:ncol(dapc$tab), smart=TRUE, n=10, 
plot=TRUE, n.sim=100, n.da=length(levels(dapc$grp)))
##perform DAPC based on species
dapc.species <- dapc(infile, pop=NULL, n.pca=a$best, n.da=NULL, 
scale=FALSE, truenames=FALSE, all.contrib=TRUE)
scatter(dapc.species, xax=1, 
yax=2,col=rainbow(length(levels(dapc.species$grp))), clabel=0.8, 
bg="white", csub=0.5, pch=19, solid=1)
<<<<<<<<<<<<GRAPH ON THE LEFT>>>>>>>>>>>>>>

#FIND CLUSTERS
clusters <-  find.clusters(data.gp, 
choose.n.clust=TRUE,criterion=c("diffNgroup"), 
n.pca=a$best,n.clust=NULL, stat='BIC', max.n.clust=10, n.iter=1e5, 
n.start=100)
#data.clust<- find.clusters(data.gp, n.pca=a$best, choose=TRUE, 
stat="BIC", choose.n.clust=TRUE,criterion=c("diffNgroup"),max.n.clust=10)
dapc.clusters<- dapc(data.gp, grp=clusters$grp, n.pca=a$best)
scatter(dapc.clusters, xax=1, 
yax=2,col=rainbow(length(levels(clusters$grp))), clabel=0, bg="white", 
csub=0.5, pch=19, solid=1,cstar=0)
<<<<<<<<<<<<GRAPH ON THE RIGHT>>>>>>>>>>>>>>
> Jombart, Thibaut <mailto:t.jombart at imperial.ac.uk>
> December 23, 2013 3:10 AM
> Hello,
>
> the discrimination of groups is always better on axes of lower rank, 
> and by default the lower ranks are always represented on the x-axis. 
> So in this case, the better differentiation is actually on your x-axis 
> for graph #1.
>
> Graph #2 puzzles me a little. There is always at maximum K-1 
> discriminant axes, so when K=2 there is only one axis to be plotted. 
> I'm not sure how you got two axes there... Plus the ellipses are 
> missing, suggesting this is not the basic graph.
>
> Cheers
> Thibaut
> ________________________________________
> From: adegenet-forum-bounces at lists.r-forge.r-project.org 
> [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Rita 
> Castilho [rita.castil at gmail.com]
> Sent: 21 December 2013 18:07
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] DAPC a priori grouping and find.clusters
>
> Hi,
>
> I am trying to get two DAPCs done:
> 1. a DAPC1 that displays the a priori established groups (in this case 
> a complex of 5 nominal species) and
> 2. a DAPC2 that displays the genetic gorups, with no a priori 
> determination= K clusters
>
> I have produced two scatter plots for these two DAPCs which are 
> attached. The first graph (DAPC1) seems to have a y-axis clear 
> division, and I was expecting that DAPC2 would display that. But DAPC2 
> shows a horizontal grouping.
>
> Maybe my scripts are not correct. Does anyone can comment if the code 
> is correct, or am I making some very basic mistakes?
>
> Many thanks,
> Rita
>
>
>
> The coding I am using is the following:
>
> data.gp <- read.genepop('infile.gen')
> #perform temporary DAPC
> dapc <- dapc(data.gp, pop=NULL, n.pca=NULL, n.da=NULL)
> a=optim.a.score(dapc, n.pca = 1:ncol(dapc$tab), smart=TRUE, n=10, 
> plot=TRUE, n.sim=100, n.da=length(levels(dapc$grp)))
> ##perform DAPC based on species
> dapc.species <- dapc(data.gp, pop=NULL, n.pca=a$best, n.da=NULL, 
> scale=FALSE, truenames=FALSE, all.contrib=TRUE)
> <<<<<<<<<<<<GRAPH ON THE LEFT>>>>>>>>>>>>>>
>
> #FIND CLUSTERS##################################
> clusters <- find.clusters(data.gp, 
> choose.n.clust=TRUE,criterion=c("diffNgroup"), 
> n.pca=a$best,n.clust=NULL, stat='BIC', max.n.clust=10)
> dapc.clusters<- dapc(data.gp, grp=clusters$grp, n.pca=a$best)
> <<<<<<<<<<<<GRAPH ON THE RIGHT>>>>>>>>>>>>>>
>
>
>
> Rita Castilho <mailto:rita.castil at gmail.com>
> December 21, 2013 6:07 PM
> Hi,
>
> I am trying to get two DAPCs done:
> 1. a DAPC1 that displays the a priori established groups (in this case 
> a complex of 5 nominal species) and
> 2. a DAPC2 that displays the genetic gorups, with no a priori 
> determination= K clusters
>
> I have produced two scatter plots for these two DAPCs which are 
> attached. The first graph (DAPC1) seems to have a y-axis clear 
> division, and I was expecting that DAPC2 would display that. But DAPC2 
> shows a horizontal grouping.
>
> Maybe my scripts are not correct. Does anyone can comment if the code 
> is correct, or am I making some very basic mistakes?
>
> Many thanks,
> Rita
>
>
>
> The coding I am using is the following:
>
> data.gp <- read.genepop('infile.gen')
> #perform temporary DAPC
> dapc <- dapc(data.gp, pop=NULL, n.pca=NULL, n.da=NULL)
> a=optim.a.score(dapc, n.pca = 1:ncol(dapc$tab), smart=TRUE, n=10, 
> plot=TRUE, n.sim=100, n.da=length(levels(dapc$grp)))
> ##perform DAPC based on species
> dapc.species <- dapc(data.gp, pop=NULL, n.pca=a$best, n.da=NULL, 
> scale=FALSE, truenames=FALSE, all.contrib=TRUE)
> <<<<<<<<<<<<GRAPH ON THE LEFT>>>>>>>>>>>>>>
>
> #FIND CLUSTERS##################################
> clusters <-  find.clusters(data.gp, 
> choose.n.clust=TRUE,criterion=c("diffNgroup"), 
> n.pca=a$best,n.clust=NULL, stat='BIC', max.n.clust=10)
> dapc.clusters<- dapc(data.gp, grp=clusters$grp, n.pca=a$best)
> <<<<<<<<<<<<GRAPH ON THE RIGHT>>>>>>>>>>>>>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20131223/2d4e960a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20131223/2d4e960a/attachment.jpg>


More information about the adegenet-forum mailing list