HighlanderLab / SIMplyBee

SIMplyBee R package extends AlphaSimR for simulating honeybee populations and breeding programmes
http://www.simplybee.info/
Other
0 stars 5 forks source link

Problem with csd locus when choosing to simulate only two csd alleles #585

Open janaobsteter opened 2 weeks ago

janaobsteter commented 2 weeks ago
founderGenomes <- quickHaplo(nInd = 4, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes, nCsdAlleles = 2)
basePop <- createCastePop(founderGenomes, caste = "virginQueens")

This returns the error

Error in x[1, ] : incorrect number of dimensions

Because of the following check in the editCsdLocus()

  if (any(sapply(alleles, FUN = function(x) all(x[1, ] == x[2, ])))) {
    stop("You must provide two different alleles for each individual!")
  }
gregorgorjanc commented 2 weeks ago

It looks like more that x has lost a dimension somewhere and is now not a matrix anymore? Sometimes this happens if we do x = x[,n] but n is 1 and then R is clever and converts matrix to a vector. I think it must be some to like that.