read.genalex error

354 views
Skip to first unread message

Mason Newark

unread,
Mar 30, 2017, 5:36:31 PM3/30/17
to poppr
I'm trying to import a csv file using the latest version poppr. And I keep getting this error.

Error in .local(.Object, ...) : 
  more than one '.' in column names; please name column as [LOCUS].[ALLELE]
In addition: Warning message:
In df2genind(gena, ind.names = ind.vec, pop = pop.vec, ploidy = 1,  :
  character '.' detected in names of loci; replacing with '_'

I don't have any '.' in any column name. I'm not sure why I'm getting this error. 

Any help would be appreciated!

s.citrulli.results.structure.ga.sep.csv

Zhian Kamvar

unread,
Mar 30, 2017, 5:53:12 PM3/30/17
to poppr
Hello Mason,

Your GenAlEx file is slightly malformed. If you look at the examples in https://cran.r-project.org/web/packages/poppr/vignettes/poppr_manual.html#import-and-data-types
you can see that there are two rows above the allele names, yours only has one row.

To fix this, you have a couple of options:

a. Remove the top row and read the data in with readr::read_csv(skip = 1) or read.csv and pass the genotypic data to df2genind() (since you have haploid data)
b. Add a second blank row to your genalex file and read it in like that.

Background:

This is somewhat related to this issue: https://groups.google.com/forum/#!msg/poppr/-ufZBGUnPdY/XdDd1oxdBAAJ, except that 
the locus names are being skipped and the alleles are being interpreted as loci. If you try to read in a data frame with duplicate
column names (say a column named 221) in R, it will change the duplicate column name to 221.1, which is why you got the error
about the duplicate column name. 

Nevertheless, I've created an issue to prevent this from happening again and it will appear in the upcoming version of poppr: 

Hope that helps,
Zhian
Reply all
Reply to author
Forward
0 new messages