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

Thibaut Jombart thibautjombart at gmail.com
Wed Oct 11 13:19:59 CEST 2017

Hi Didier,

you are looking for 'pop(x) <- ...'.

Accessors like this one, and other useful things are in the 'basics' tutorial:


Dr Thibaut Jombart
Lecturer, Department of Infectious Disease Epidemiology, Imperial College London
Head of RECON: repidemicsconsortium.org
WHO Consultant - outbreak analysis
Twitter: @TeebzR
+44(0)20 7594 3658

On 11 October 2017 at 11:08, Didier Aurelle <aurelle.didier at gmail.com> wrote:
> 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

More information about the adegenet-forum mailing list