[adegenet-forum] sPCA - xy coordinate matrix

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Dec 10 04:16:12 CET 2013


Hello there, 

I don't think the basic genepop format handles information beside the markers themselves. The easiest way for you to proceed is to have xy coordinates in a separate file (e.g. csv or tab-delimited txt file), read them into R using read.csv (csv file) or read.table (tab-delimited txt file), and then pass the xy coordinates as argument to the sPCA function (see ?spca and sPCA vignette). This will look like:

###

myXY <- read.csv("myFilewithXY.csv") # read xy coord
head(myXY) # check that it's OK

spca1 <- spca(myGenindObject, xy=myXY)

###

Note that this is assuming that your xy coordinates are in the same order as the genotypes in your .gen file.

Cheers
Thibaut



________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Margarita Lopez Uribe [mayalopez at gmail.com]
Sent: 09 December 2013 18:42
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] sPCA - xy coordinate matrix

Dear all,

I am relatively new to ADEGENET. I have used this program in the past for DAPC and now I am trying to use sPCA. What I usually do is import genepop files into genind files to work in adegenet. However, for the sPCA I need to add the binary L mastrix as an xy coordinate object. I have tried adding the L matrix after the last individual of the genepop file (as shown below), but adegenet cannot read the file. I would really appreciate it if someone can help me get started with the input file. It is a very basic question, but I read the sPCA documentation and it is not clear how you add this matrix to your file.

Thanks in advance for your help.

Best,
Margarita

___________________
Microsatellite dataset
PP4, PP8, PP11, PP356, PP420, PP588
Pop
Pep001_NYI, 220220 154154 194194 130130 380380 430430
Pep002_NYI, 220220 154154 194194 130130 372372 430430
Pep003_NYI, 218218 154154 194194 130130 380380 431431
....
Pep655_CA, 226226 146146 194194 134134 372372 428428
Pep656_CA, 226226 146146 194194 134134 372372 428428
Pep657_CA, 226226 146146 194194 134134 372372 428428
xy
Pep001_NYI Pep002_NYI 1
Pep002_NYI Pep003_NYI 1
....
....
Pep001_NYI Pep655_CA, 0



More information about the adegenet-forum mailing list