Hi there,<br><br>I've been trying to perfomr a PCA on mitochondrial data but there's been a problem that I haven't been able to solve. <br><br>I've been able to open my phylip file :<br><br><style> <!--
/* Font Definitions */
@font-face
{font-family:"Times New Roman";
panose-1:0 2 2 6 3 5 4 5 2 3;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
@font-face
{font-family:Calibri;
panose-1:0 2 15 5 2 2 2 4 3 2;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Calibri;
mso-ansi-language:EN-NZ;
mso-fareast-language:EN-US;}
table.MsoNormalTable
{mso-style-parent:"";
font-size:10.0pt;
font-family:"Times New Roman";}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<p class="MsoNormal"><i><span lang="EN-NZ">> kea<-read.dna("kea.phy")</span></i></p><i>
<span lang="EN-NZ">> kea</span></i><style><!--
/* Font Definitions */
@font-face
{font-family:"Times New Roman";
panose-1:0 2 2 6 3 5 4 5 2 3;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
@font-face
{font-family:Calibri;
panose-1:0 2 15 5 2 2 2 4 3 2;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Calibri;
mso-ansi-language:EN-NZ;
mso-fareast-language:EN-US;}
table.MsoNormalTable
{mso-style-parent:"";
font-size:10.0pt;
font-family:"Times New Roman";}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}</style>
<p class="MsoNormal"><i><span lang="EN-NZ">53 DNA sequences in binary format stored in
a matrix.</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> All sequences of same length: 1026 </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">Labels: Arth_Jo105 Arth_Jo98 Arth_V0610
Arth_V0391 Arth_V0753 Arth_V1280 ...</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> Base composition:</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>a <span style> </span>c<span style> </span>g<span style> </span>t</span></i></p><p class="MsoNormal"><i><span lang="EN-NZ">0.276 0.254 0.158 0.312</span></i></p>
<p class="MsoNormal"><span lang="EN-NZ"> ..and then created a genind object<br></span></p>
<p class="MsoNormal"><i><span lang="EN-NZ">> obj <- DNAbin2genind(kea, polyThres
= 0.01)</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">> obj</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>#####################</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>### Genind object ### </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>#####################</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">- genotypes of individuals - </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">S4 class:<span style> </span>genind</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@call: DNAbin2genind(x = kea, polyThres =
0.01)</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@tab:<span style>
</span>53 x 14 matrix of genotypes</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@ind.names: vector of<span style> </span>53 individual names</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@loc.names: vector of<span style> </span>7 locus names</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@loc.nall: number of alleles per locus</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@loc.fac: locus factor for the<span style> </span>14 columns of @tab</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@all.names: list of<span style> </span>7 components yielding allele names for
each locus</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@ploidy:<span style> </span>1</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@type:<span style> </span>codom</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">Optionnal contents: </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@pop:<span style>
</span>- empty -</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@pop.names:<span style> </span>- empty -</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">@other: - empty -</span></i></p>
...then I performed a PCA:<br><br><style> <!--
/* Font Definitions */
@font-face
{font-family:"Times New Roman";
panose-1:0 2 2 6 3 5 4 5 2 3;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
@font-face
{font-family:Calibri;
panose-1:0 2 15 5 2 2 2 4 3 2;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:50331648 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin-top:0cm;
margin-right:0cm;
margin-bottom:10.0pt;
margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Calibri;
mso-ansi-language:EN-NZ;
mso-fareast-language:EN-US;}
table.MsoNormalTable
{mso-style-parent:"";
font-size:10.0pt;
font-family:"Times New Roman";}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<p class="MsoNormal"><i><span lang="EN-NZ">> pca1 <- dudi.pca(obj$tab, cent =
TRUE, scale = FALSE, scannf = FALSE, nf = 3)</span><br></i></p><p class="MsoNormal"><i>> pca1</i></p><i><span lang="EN-NZ">Duality diagramm</span></i>
<p class="MsoNormal"><i><span lang="EN-NZ">class: pca dudi</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">$call: dudi.pca(df = obj$tab, center =
TRUE, scale = FALSE, scannf = FALSE, </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>nf = 3)</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">$nf: 3 axis-components saved</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">$rank: 5</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">eigen values: 1.296 0.3866 0.2515 0.05097
0.03569</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style>
</span>vector length mode<span style>
</span>content<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">1 $cw<span style> </span>14<span style> </span>numeric column weights</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">2 $lw<span style> </span>53<span style> </span>numeric row weights<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">3 $eig<span style> </span>5<span style> </span>numeric eigen values<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"> </span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ"><span style> </span>data.frame nrow ncol content<span style>
</span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">1 $tab<span style> </span>53<span style> </span>14<span style>
</span>modified array<span style>
</span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">2 $li<span style> </span>53<span style> </span>3<span style> </span>row coordinates<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">3 $l1<span style> </span>53<span style> </span>3<span style> </span>row normed scores<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">4 $co<span style> </span>14<span style> </span>3<span style> </span>column coordinates<span style> </span></span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">5 $c1<span style> </span>14<span style> </span>3<span style> </span>column normed scores</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ">other elements: cent norm </span></i></p>
<br>but then, when I try to crate a scatter plot:<br><br><i>>s.class(pca1$li, obj$pop, lab = obj$pop.names, sub = "PCA 1-2", csub = 2)</i><br clear="all"><br>I get the following error message:<br><br><b><i>Erreur dans s.class(pca1$li, obj$pop, lab = obj$pop.names, sub = "PCA 1-2", : <br>
factor expected for fac</i></b><br><br>Is it because my object lacks population information (groupings)? If so, how can I eiterh modify my .phy file or add the population information in R.<br><br>Many Thanks!<br><br><br>
Nic<br>-- <br>Nicolas Dussex<br>PhD Candidate<br>Department of Zoology<br>University of Otago<br>340 Great King Street<br>P.O.Box 56<br>Dunedin 9054<br>New Zealand<br><br>Mobile: 021 02790938<br><br>