<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>RE: Looking for help with a PCA using adegenet in R</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hello again<BR>
About the ploidy.&nbsp; We are looking at MHC genes, specifically MHC DRB exon 2.&nbsp; We found that it is duplication, with individuals possessing between 2-4 alleles (Castillo et al. 2010).&nbsp; Individuals with 2 alleles are presumed to be homozygous at each locus (hence why genotype would be 1 2 -9 -9).<BR>
We are having trouble running our data in the usual genetic software due to the ploidy issue, we are sure that it is duplicated therefore ploidy is up to tetraploid, but individuals range with 2, 3, and 4 alleles.<BR>
<BR>
I am unsure of how else to represent this other than missing data (as they are still important)<BR>
<BR>
Therefore, the differences in number of alleles/individual is important for the structure and should be used during the analyzes.&nbsp; Any advice would be appreciated<BR>
<BR>
Sarrah<BR>
<BR>
<BR>
____________________<BR>
Sarrah Castillo<BR>
MSc Candidate<BR>
Environmental &amp; Life Sciences Graduate Program<BR>
Trent University, 2140 East Bank Drive,<BR>
Peterborough, Ontario, K9J 7B8, Canada<BR>
e-mail:scastillo@nrdpfc.ca<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Jombart, Thibaut [<A HREF="mailto:t.jombart@imperial.ac.uk">mailto:t.jombart@imperial.ac.uk</A>]<BR>
Sent: Tue 19/10/2010 12:37<BR>
To: Sarrah Castillo; adegenet-forum@lists.r-forge.r-project.org<BR>
Subject: RE: Looking for help with a PCA using adegenet in R<BR>
<BR>
Dear Sarrah,<BR>
<BR>
In this case read.structure should not be used - it is designed for diploid individuals only. Fortunately, you can still read your data in adegenet using df2genind.<BR>
<BR>
The trick consists in merging the 4 alleles into a single character string:<BR>
#####<BR>
&gt; foo=read.table(&quot;foo.txt&quot;, head=TRUE)<BR>
&gt; head(foo)<BR>
&nbsp; Ind Reg Al1 Al2 Al3 Al4<BR>
1 271&nbsp; ON&nbsp;&nbsp; 7&nbsp; 10&nbsp; 11&nbsp; -9<BR>
2 273&nbsp; ON&nbsp;&nbsp; 2&nbsp; 10&nbsp; 13&nbsp; -9<BR>
3 272&nbsp; ON&nbsp;&nbsp; 4&nbsp; 11&nbsp; 12&nbsp; -9<BR>
4 465&nbsp; ON&nbsp;&nbsp; 1&nbsp;&nbsp; 2&nbsp; -9&nbsp; -9<BR>
5 472&nbsp; ON&nbsp;&nbsp; 3&nbsp;&nbsp; 6&nbsp; 11&nbsp; 19<BR>
6 489&nbsp; ON&nbsp;&nbsp; 2&nbsp;&nbsp; 3&nbsp;&nbsp; 4&nbsp; 19<BR>
&gt; gen=apply(foo[,3:6],1,paste,collapse=&quot;/&quot;)<BR>
&gt; gen<BR>
&nbsp;[1] &quot;7/10/11/-9&quot; &quot;2/10/13/-9&quot; &quot;4/11/12/-9&quot; &quot;1/2/-9/-9&quot;&nbsp; &quot;3/6/11/19&quot;<BR>
&nbsp;[6] &quot;2/3/4/19&quot;&nbsp;&nbsp; &quot;7/12/-9/-9&quot; &quot;7/14/43/-9&quot; &quot;4/5/15/19&quot;&nbsp; &quot;7/14/20/26&quot;<BR>
[11] &quot;5/7/8/-9&quot;&nbsp;&nbsp; &quot;4/11/21/-9&quot; &quot;7/21/24/-9&quot; &quot;1/20/26/49&quot; &quot;7/16/20/26&quot;<BR>
[16] &quot;7/25/27/49&quot; &quot;3/19/25/49&quot; &quot;7/9/12/-9&quot;<BR>
#####<BR>
<BR>
A problem in your data is that for a single locus and individual, it happens that some but not all data are missing (expl:&nbsp; &quot;1/2/-9/-9&quot;). Are these actual tetraploid data? Or is the actual ploidy unknown?<BR>
For now, I consider that frequencies cannot be inferred as soon as there is at least one NA.<BR>
<BR>
#####<BR>
&gt; isNA=grep(&quot;-9&quot;,gen)<BR>
&gt; gen[isNA] &lt;- NA<BR>
&gt; gen<BR>
&nbsp;[1] NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;3/6/11/19&quot;<BR>
&nbsp;[6] &quot;2/3/4/19&quot;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;4/5/15/19&quot;&nbsp; &quot;7/14/20/26&quot;<BR>
[11] NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;1/20/26/49&quot; &quot;7/16/20/26&quot;<BR>
[16] &quot;7/25/27/49&quot; &quot;3/19/25/49&quot; NA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
#####<BR>
<BR>
We can now obtain the genind object:<BR>
<BR>
#####<BR>
&gt;&nbsp; x=df2genind(data.frame(gen), ind.names=foo$Ind, pop=foo$Reg, sep=&quot;/&quot;, ploidy=4)<BR>
Warning message:<BR>
In df2genind(data.frame(gen), ind.names = foo$Ind, pop = foo$Reg,&nbsp; :<BR>
&nbsp; entirely non-type individual(s) deleted<BR>
&gt; truenames(x)<BR>
$tab<BR>
&nbsp;&nbsp;&nbsp; gen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p;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.00<BR>
341&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.25<BR>
385&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.00&nbsp;&nbsp; 0.25<BR>
<BR>
$pop<BR>
[1] ON ON ON ON ON ON ON ON<BR>
Levels: ON<BR>
<BR>
&gt; genind2df(x, sep=&quot;/&quot;)<BR>
&nbsp;&nbsp;&nbsp; pop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gen<BR>
472&nbsp; ON 03/06/11/19<BR>
489&nbsp; ON 02/03/04/19<BR>
466&nbsp; ON 04/05/15/19<BR>
749&nbsp; ON 07/14/20/26<BR>
319&nbsp; ON 01/20/26/49<BR>
323&nbsp; ON 07/16/20/26<BR>
341&nbsp; ON 07/25/27/49<BR>
385&nbsp; ON 03/19/25/49<BR>
#####<BR>
<BR>
Now you can use 'x' as any other genind object:<BR>
#####<BR>
&gt; Hs(x)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<BR>
0.9238281<BR>
&gt; summary(x)<BR>
&nbsp;# Total number of genotypes:&nbsp; 8<BR>
<BR>
&nbsp;# Population sample sizes:&nbsp;<BR>
ON<BR>
&nbsp;8<BR>
<BR>
&nbsp;# Number of alleles per locus:&nbsp;<BR>
L1<BR>
17<BR>
<BR>
[etc.]<BR>
#####<BR>
<BR>
Best regards,<BR>
<BR>
Thibaut<BR>
<BR>
<BR>
________________________________________<BR>
From: adegenet-forum-bounces@lists.r-forge.r-project.org [adegenet-forum-bounces@lists.r-forge.r-project.org] On Behalf Of Sarrah Castillo [scastillo@nrdpfc.ca]<BR>
Sent: 19 October 2010 16:20<BR>
To: adegenet-forum@lists.r-forge.r-project.org<BR>
Subject: [adegenet-forum] Looking for help with a PCA using adegenet in R<BR>
<BR>
Hello Dr. Jombart<BR>
I was wondering if you could help me with an issue I am having with your program (Adegenet) in R.<BR>
I am attempting to perform a PCA using a structure file. The difference is that this is based on tetraploid data.&nbsp; Structure allows for multiple ploidy, however I am unsure of how to have the program read my data as tetraploid instead of diploid. The genetic information is for a single locus with between 2-4 alleles (with -9 representing missing data)<BR>
<BR>
Here is an example of my file (with -9 representing missing data)<BR>
<BR>
Ind&nbsp;&nbsp;&nbsp;&nbsp; Reg&nbsp;&nbsp;&nbsp;&nbsp; Al1&nbsp;&nbsp;&nbsp;&nbsp; Al2&nbsp;&nbsp;&nbsp;&nbsp; Al3&nbsp;&nbsp;&nbsp;&nbsp; Al4<BR>
271&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -9<BR>
273&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -9<BR>
272&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -9<BR>
465&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;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bsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 27&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 49<BR>
385&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 49<BR>
485&nbsp;&nbsp;&nbsp;&nbsp; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -9<BR>
<BR>
Ind=individual<BR>
Reg=region<BR>
Al1= allele 1<BR>
Al2= allele 2<BR>
Al3= allele 3<BR>
Al4= allele 4<BR>
<BR>
<BR>
Any help would be much appreciated.<BR>
<BR>
Thank you<BR>
Sarrah Castillo<BR>
<BR>
<BR>
____________________<BR>
Sarrah Castillo<BR>
MSc Candidate<BR>
Environmental &amp; Life Sciences Graduate Program<BR>
Trent University, 2140 East Bank Drive,<BR>
Peterborough, Ontario, K9J 7B8, Canada<BR>
e-mail:scastillo@nrdpfc.ca<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>