grunwaldlab / poppr

🌶 An R package for genetic analysis of populations with mixed (clonal/sexual) reproduction

Home Page:https://grunwaldlab.github.io/poppr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single locus genalex files cannot be imported

zkamvar opened this issue · comments

This post in the poppr forum showed that a single locus data set could not be imported. Here's a reproducible example.

# Note, this is a subset of the monpop data set, which is haploid. I'm treating it as a diploid here
zz <- "1    6   1   6
7_09_BB         
Ind Pop CHMFc4  CHMFc5
A004    7_09_BB 224 85
A002    7_09_BB 224 97
A011    7_09_BB 224 97
A009    7_09_BB 224 97
A006    7_09_BB 224 97
A013    7_09_BB 224 97"

read.genalex(textConnection(z), sep = "\t")
 Error in gena2[, ((x - 1)/ploidy) + 1] <<- pop_combiner(gena, hier = x:(x +  : 
  incorrect number of subscripts on matrix 

The reason for this error was because of our old friend drop = TRUE being default for subsetting matrices. I am scouring the code and setting drop = FALSE everywhere.