[adegenet-forum] define population level for PCA analysis in adegenet

Roman Luštrik roman.lustrik at biolitika.si
Wed Oct 11 13:49:14 CEST 2017


It goes without saying that order in your vcf (pops_list) file should correspond to the order in your datapop. 

To assign population to your pops_list should be a vector or a factor like so: 

library(adegenet) 
data(nancycats) 
pop(nancycats) <- 1:237 

(see basics manual at https://github.com/thibautjombart/adegenet/wiki/Tutorials) 

If you want to assign names to your populations, you can use popNames(x) <- y. 

Cheers, 
Roman 

---- 
In god we trust, all others bring data. 
> Zahtevaj IJZ na https://kurc.biolitika.si 


From: "Didier Aurelle" <aurelle.didier at gmail.com> 
To: adegenet-forum at lists.r-forge.r-project.org 
Sent: Wednesday, October 11, 2017 12:08:05 PM 
Subject: [adegenet-forum] define population level for PCA analysis in adegenet 

Dear all 



I want to perform a PCA analysis in adegenet starting from a genepop file without defined populations. I imported the data like this: datapop <- read.genepop('tous.gen', ncode=3, quiet = FALSE) 

it works, and I can perform a PCA after scaling the data. But I would like to plot the results / individuals on the PCA axis according to their population of origin using s.class. I have a vcf file with a three lettre code for each individual. I imported it in R: pops_list <- read.csv('liste_pops.csv', header=FALSE) 

but now how can I use it to define population levels in the genind object 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) 

setPop(datapop) <- pops_list but it doesn't work; even the first line doesn't work: I get this message: "Erreur : formula must be a valid formula object." 

And then how should I use it in s.class? 


thanks 

Didier 

_______________________________________________ 
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/20171011/3667846c/attachment.html>


More information about the adegenet-forum mailing list