[adegenet-forum] truenames error
Jombart, Thibaut
t.jombart at imperial.ac.uk
Wed Jan 13 12:45:26 CET 2010
Dear Sofie,
One thing that may explain the problem you experience is that Genepop format gives the same label to all individuals of a given population. Internally, adegenet uses generic labels so as to avoid that kind of issue, but when using original labels (setting truenames to TRUE), duplications can cause failures, for instance when constructing a data.frame (which doesn't tolerate duplicated row names). This is the meaning of the warning:
"
Warning message:
In validityMethod(object) :
duplicate names in ind.names:
"
To check this, you can replace the labels of individuals directly in the genind object:
##
data <- read.genepop("microsats_pararge_28_04_09.gen")
data at ind.names <- as.character(1:nrow(data at tab))
##
Does this solve the problem?
Best regards,
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 Sofie Vandewoestijne [sofie.vandewoestijne at uclouvain.be]
Sent: 13 January 2010 10:56
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] truenames error
Hello,
I'm stuck with probably a very simple error. I keep getting the truenames error, although when I check truenames(datagen), it refers to the correct elements. It would be great if anyone could help me out!
Thanks,
Sofie Vandewoestijne
error message
> summary(mySPCA2)
Spatial principal component analysis
Call: spca(obj = datagen, xy = datagen$other$xy, cn = cn2, scale = FALSE,
scannf = TRUE, nfposi = 1, nfnega = 1, type = NULL, ask = TRUE,
plot.nb = TRUE, edit.nb = FALSE, truenames = TRUE, d1 = NULL,
d2 = NULL, k = NULL, a = NULL, dmin = NULL)
Error in if (truenames) { : argument is not interpretable as logical
for info, entire procedure:
> data <- read.genepop("microsats_pararge_28_04_09.gen")
Converting data from a Genepop .gen file to a genind object...
File description: microsatellite data phylo study 30/04/09
...done.
> datagen=genind2genpop(data)
C213 D221
2 2
Converting data from a genind to a genpop object...
...done.
Warning message:
In validityMethod(object) :
duplicate names in ind.names:
> dataID <- read.table("PaIDpop.txt",header=TRUE, sep="\t")
> colnames(dataID)
[1] "pop" "region" "habitat" "X" "Y"
> # conversion of lat/long data into ulm data
> LL=dataID[,4:5]
> attr(LL,"projection") <- "LL"
> dataULM <- convUL(LL)
Warning message:
In convUL(LL) : For the UTM conversion, automatically detected zone 39.
> xy=dataULM
> datagen$other$xy=xy
> datagen$other$xy
X Y
1 635.926951 601.7774
2 650.283947 673.4652
3 632.100233 622.1934
4 626.815317 664.1664
5 512.720689 533.8739
6 521.772138 547.5091
7 515.556688 522.4521
8 525.868004 547.2340
9 475.761671 539.6493
10 461.440868 540.7914
11 479.175718 522.9447
12 463.920431 508.6416
13 357.665999 613.7382
14 347.481265 640.2679
15 356.447826 619.5458
16 244.134995 497.6459
17 255.662775 485.2579
18 258.906401 527.6824
19 232.054698 518.7366
20 -28.533087 543.7054
21 -12.953761 566.3001
22 -34.345305 547.7221
23 -7.574944 575.5029
> obj=dataID[,1:3]
> datagen$other$obj=obj
> datagen$other$obj
pop region habitat
1 A1 A A
2 A2 A A
3 A3 A W
4 A4 A W
5 B1 B A
6 B2 B A
7 B3 B W
8 B4 B W
9 C1 C A
10 C2 C A
11 C3 C W
12 C4 C W
13 D1 D A
14 D2 D W
15 D3 D W
16 E1 E A
17 E2 E A
18 E3 E W
19 E4 E W
20 F1 F A
21 F2 F A
22 F3 F W
23 F4 F W
> cn2 <- chooseCN(datagen$other$xy,ask=FALSE,type=2)
> mySPCA2 <- spca(datagen, xy = datagen$other$xy, cn = cn2, scale = FALSE, scannf = TRUE, nfposi = 1, nfnega = 1, type = NULL,
+ ask = TRUE, plot.nb = TRUE, edit.nb = FALSE, truenames = TRUE,
+ d1 = NULL, d2 = NULL, k = NULL, a = NULL, dmin = NULL)
Select the first number of axes (>=1): 1
Select the second number of axes (>=0): 2
> summary(mySPCA2)
Spatial principal component analysis
Call: spca(obj = datagen, xy = datagen$other$xy, cn = cn2, scale = FALSE,
scannf = TRUE, nfposi = 1, nfnega = 1, type = NULL, ask = TRUE,
plot.nb = TRUE, edit.nb = FALSE, truenames = TRUE, d1 = NULL,
d2 = NULL, k = NULL, a = NULL, dmin = NULL)
Error in if (truenames) { : argument is not interpretable as logical
>
More information about the adegenet-forum
mailing list