I'm using the ASMap
package to construct a linkage map for a doubled haploid (DH) maize population with the mstmap()
function.
I have formatted my genotype data strictly according to the requirements described in the ASMap documentation:
- Only
"A"
and"B"
alleles are used (withU
for missing data) - All columns are of class
character
, not factors - Marker names are in
rownames()
, individuals are in columns - No spaces in row or column names
- No underscores in names (I've replaced them with hyphens)
Here is the code I'm running:
library(bigsnpr)
library(ASMap)
plink_prefix <- "C2_ImputationTarget_1K"
snp_readBed(paste0(plink_prefix, ".bed"))
obj.bigSNP <- snp_attach(paste0(plink_prefix, ".rds"))
G <- obj.bigSNP$genotypes[]
map_bed <- obj.bigSNP$map
ids <- obj.bigSNP$fam$sample.ID
geno_char <- matrix(NA, nrow = nrow(G), ncol = ncol(G))
table(unlist(geno_char))
geno_char[G == 0] <- "A"
geno_char[G == 2] <- "B"
geno_char[G == 1] <- "U"
colnames(geno_char) <- obj.bigSNP$map$marker.ID
rownames(geno_char) <- obj.bigSNP$fam$sample.ID
geno_df <- as.data.frame(t(geno_char),stringsAsFactors = FALSE)
rownames(geno_df) <- gsub("_","-",rownames(geno_df))
map_list <- mstmap(geno_df,
dist.fun = "kosambi",
trace = TRUE)
And I get the following error:
Error in mstmap.data.frame(geno_df, dist.fun = "kosambi", trace = FALSE):
Non-allowable allele encodings in DH marker set
To troubleshoot, I’ve verified the following:
str(geno_df)
# Check allele counts
table(unlist(geno_df))
# Ensure all columns are characters
all(sapply(geno_df, is.character)) # returns TRUE
# Check for spaces in column and row names
any(grepl(" ", colnames(geno_df))) # FALSE
any(grepl(" ", rownames(geno_df))) # FALSE
My question
Despite confirming that my data follows the expected format for mstmap()
with pop.type = "DH"
, I still encounter the error about non-allowable allele encodings.
Is there something I might be missing or a way to debug this further?
Thank you in advance!