poppa.amova() error

95 views
Skip to first unread message

John Whale

unread,
Feb 9, 2021, 1:39:44 AM2/9/21
to poppr
Hi, 

I keep getting the following error when trying to run poppr.amova

       Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length

The code I'm using is:

>blake.amova <- read.table("blakeAMOVA.txt", header = TRUE) #diploid genotypes 0,1,2, NA
>blake.amova[1:5, 1:9]
                    ID Population     Region X00001 X00002 X00003 X00004 X00005 X00006 
1 blaASCA712        ASCA NWNENG           0           0           0            0           0            0  
2 blaASCA713        ASCA NWNENG         NA          0           0            0           0            2 
3 blaASCA714        ASCA NWNENG           0        NA           0            0           1            0  
4 blaASCA715        ASCA NWNENG           0        NA           0            0           0            0  
5 blaASCA716        ASCA NWNENG           0           0        NA            2           0            0  

# Move the Population and Region columns to its own df
>blahier <- blake.amova[, c(2, 3)]
# Convert the df to genind object 
>blake <- df2genind(blake.amova, sep = " ", ncode = 2L)
>blake$other$hierarchy <- blahier
>blake$pop <- blahier$Population

>strata(blake) <- other(blake)$hierarchy
>blakeclone <- as.genclone(blake)
>blaAMOVA <- poppr.amova(blakeclone, ~Population/Region)

Any assistance would be greatly appreciated.

Cheers,
John

Zhian Kamvar

unread,
Feb 12, 2021, 3:55:48 PM2/12/21
to poppr
Hello,

I think one of the main reasons why this is not working is because df2genind expects the the value of alleles to be concatenated within a single locus (e.g. A/T or C/G). What you appear to have is SNP data with dosage information of the minor allele.

If your data is indeed dosage of the minor allele, then you need a genlight object as detailed in section 2.2 of the adegenet genomics manual: https://raw.githubusercontent.com/thibautjombart/adegenet/master/tutorials/tutorial-genomics.pdf

Additionally, these lines are unnecessary:

>blake$other$hierarchy <- blahier
>blake$pop <- blahier$Population
>strata(blake) <- other(blake)$hierarchy

Instead, you can use

strata(blake) <- blahier
setPop(blake) <- ~Population

Best,
Zhian

Reply all
Reply to author
Forward
0 new messages