Dear Thibaut,<br><br>Thanks very much for this solution. Indeed, the question was "how to assign individuals from one space to groups defined in another, partially overlapping space"?<br><br>I've run this analysis with the real dataset (not the toy dataset presented in the previous e-mail) and compared the results with and without regression. What I should probably mention here is that the group 'popx' is a mix of individuals from;<br>
- about 80% of individuals belonging to 'pop1'<br>- about 15% of individuals belonging to 'pop2'<br>- about 5% of hybrid individuals between 'pop1' and 'pop2'.<br><br>For the data set without regression, I performed a 'normal' DAPC with 3 predefined groups 'pop1, 'pop2' and 'popx'.<br>
-'pop1' individuals are clearly differentiated from 'pop2' and 'popx'<br>-'pop2' and 'popx' individuals are nearly indiscernable along discriminant function 1 (except for a few individuals from 'popx' that in fact belong to 'pop1')<br>
- the mean comparison of inferred groups with actual groups is 0.62<br>
<br>For the data set with regression, I performed a 'normal' DAPC on the residuals of the regression (as detailed in the previous e-mail)<br>
-'pop1' individuals are again clearly differentiated from 'pop2' and 'popx'<br>
-'pop2' and 'popx' individuals are much more differentiated along discriminant function 1 when compared to the normal DAPC detailed above. <br>- the mean comparison of inferred groups with actual groups is 0.81 (more than the normal DAPC)<br>
This accentuated differentiation of 'pop2' and 'popx' individuals seems rather unexpected as most individuals from 'popx' are in fact from 'pop2' (see details above). Also, after the DAPC, each individual has a probability to belong to the 3 groups ('pop2', 'pop1' and 'popx') rather than 2 groups ('pop2' and 'pop1') as aimed. <br>
<br>Give that original alleles of the 'popx' population, present in the 'popx' population but absent from either source populations (pop1 or pop2), wont give us any information about the origin of the 'popx' individuals (e.i. whether they come from 'pop1' or 'pop2), when performing the 'normal' DAPC (without regression), could we 'simply' consider these original alleles of 'popx' as missing data? Would there be an easy way to do that?<br>
<br>Thanks again for your help,<br>
<br>
Sébastien.<br><br><div class="gmail_quote">On 21 March 2011 15:34, Jombart, Thibaut <span dir="ltr"><<a href="mailto:t.jombart@imperial.ac.uk">t.jombart@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Dear Sébastien,<br>
<br>
thanks for this very interesting question. To rephrase it: "how to assign individuals from one space to groups defined in another, partially overlapping space"?<br>
<br>
The problem is not trivial if we think of it in probabilistic terms. If you used Bayesian/likelihood-based clustering, clusters would be defined in terms of frequencies of a given set of alleles (say, "S"). You can compute the probability for an individual to come from cluster xxx (or a mixture of clusters xxx, yyy, zzz etc in admixture models) as long as this individual does not possess any original allele (i.e., not in 'S'). Would it not be the case, the probability of observing a new allele in the previously defined clusters is, by definition, zero and thus P=0 for all clusters. Annoying.<br>
<br>
Distance-based method have a similar problem: if the spaces differ, it is much more difficult to compare one individual to another.<br>
<br>
However, we can use the fact that one space is contained within another, namely, the alleles differentiating pop1 /vs/ pop2 are a subset of the alleles of the complete dataset. One approach is to use an analysis that we could run on the entire dataset, but that would exclude all originality of 'popx', and only conserve differences between 'pop1' and 'pop2'. This can be achieved by regressing the data onto a factor opposing 'popx' to 'non-pop-x' individuals.<br>
<br>
####<br>
X <- truenames(trial)$tab # extract table of allele frequencies<br>
popx <- factor(pop(trial)=="popx") # popx vs non-popx<br>
X.res <- apply(X,2, function(e) residuals(lm(e~popx))) # remove 'popx' effect<br>
<br>
dapc1 <- dapc(X.res, pop(trial), n.pca=3, n.da=1) # perform dapc<br>
scatter(dapc1)<br>
assignplot(dapc1)<br>
####<br>
<br>
The DAPC aims to discriminate all populations of the dataset, but we actually tricked the method by removing all originality specific to "popx" beforehand. With the toy dataset you sent, "popx" is actually still at one extreme of the cline, but I suspect that actually hybrid populations should fall between the two parental populations.<br>
<br>
<br>
Best regards<br>
<br>
Thibaut.<br>
<br>
<br>
--<br>
######################################<br>
Dr Thibaut JOMBART<br>
MRC Centre for Outbreak Analysis and Modelling<br>
Department of Infectious Disease Epidemiology<br>
Imperial College - Faculty of Medicine<br>
St Mary’s Campus<br>
Norfolk Place<br>
London W2 1PG<br>
United Kingdom<br>
Tel. : 0044 (0)20 7594 3658<br>
<a href="mailto:t.jombart@imperial.ac.uk">t.jombart@imperial.ac.uk</a><br>
<a href="http://sites.google.com/site/thibautjombart/" target="_blank">http://sites.google.com/site/thibautjombart/</a><br>
<a href="http://adegenet.r-forge.r-project.org/" target="_blank">http://adegenet.r-forge.r-project.org/</a><br>
<br>
________________________________________<br>
From: <a href="mailto:adegenet-forum-bounces@r-forge.wu-wien.ac.at">adegenet-forum-bounces@r-forge.wu-wien.ac.at</a> [<a href="mailto:adegenet-forum-bounces@r-forge.wu-wien.ac.at">adegenet-forum-bounces@r-forge.wu-wien.ac.at</a>] On Behalf Of Sébastien Puechmaille [<a href="mailto:s.puechmaille@gmail.com">s.puechmaille@gmail.com</a>]<br>
Sent: 21 March 2011 13:15<br>
<div class="im">To: <a href="mailto:adegenet-forum@r-forge.wu-wien.ac.at">adegenet-forum@r-forge.wu-wien.ac.at</a><br>
Subject: [adegenet-forum] Genotypes assignment to clusters<br>
<br>
</div><div><div></div><div class="h5">Dear Thibaut and Adegenet users,<br>
<br>
I have a data set with 3 groups of samples (see below), 2 with samples of known origin (pop1 and pop2) and one (popx) with samples that I would like to assign to one of the 2 known populations (pop1 or pop2). For this, I want to run a DAPC with 'pop1' and 'pop2' data set and then, assign individuals from 'popx' to either 'pop1' or 'pop2'.<br>
<br>
However, individuals from the group to be assigned have some private alleles that are neither in 'pop1' nor in 'pop2' and therefore, the assignment cannot work. What would be the best solution to get around this problem?<br>
Shall I create dummies individuals in 'pop1' and 'pop2' having the private alleles of 'popx'?<br>
<br>
Hereafter is a reduced data set to illustrate the problem:<br>
indiv pop L1 L2 L3<br>
Indiv1 pop1 222224 232224 120122<br>
Indiv2 pop1 222226 232226 118120<br>
Indiv3 pop1 222222 232232 120120<br>
Indiv4 pop1 222224 232224 124124<br>
Indiv5 pop2 224224 224224 122122<br>
Indiv6 pop2 224224 224224 124124<br>
Indiv7 pop2 224226 224226 120120<br>
Indiv8 pop2 222224 232224 122124<br>
Indiv9 popx 220222 220232 116118<br>
Indiv10 popx 222224 232224 118120<br>
Indiv11 popx 222226 232226 120120<br>
Indiv12 popx 224224 224224 124124<br>
<br>
<br>
geno<-read.table("three-pop.txt",h=T)<br>
<br>
trial<-df2genind(geno[,3:5],missing=NA,ploidy=2,sep=NULL,ncode=6,ind.names=geno[,1], loc.names=colnames(geno[1,3:5]),pop=geno[,2])<br>
<br>
trial@pop.names<br>
split<- seppop(trial)<br>
<br>
pop12 <- repool(split$pop1, split$pop2)<br>
<br>
pop12 @all.names<br>
split$popx@all.names<br>
<br>
In this case, 'pop12' has 10 columns of '@tab' while 'split$popx' has 13 columns of '@tab'.<br>
<br>
Would anyone have a solution or any advice?<br>
<br>
Thanks for your help,<br>
<br>
Sébastien.<br>
<br>
</div></div></blockquote></div><br clear="all">*********************<br>Dr. Sébastien Puechmaille<br>UCD School of Biological and Environmental Sciences<br>University College Dublin (Zoology)<br>UCD Science and Education Research Center (West)<br>
Belfield<br>Dublin 4<br>Ireland<br><br>and<br><br>Max Planck Institute for Ornithology<br>
        Sensory Ecology Group<br>
Eberhard-Gwinner-Straße<br>
Haus Nr. 11<br>
82319 Seewiesen<br>
Germany
<br><br><a href="http://batlab.ucd.ie/%7Espuechmaille/" target="_blank">http://batlab.ucd.ie/~spuechmaille/</a><br><a href="http://www.ucd.ie/research/people/biologyenvscience/drsebastienpuechmaille/home/" target="_blank">http://www.ucd.ie/research/people/biologyenvscience/drsebastienpuechmaille/home/</a><br>
*********************