thierrygosselin / radiator

RADseq Data Exploration, Manipulation and Visualization using R
https://thierrygosselin.github.io/radiator/
GNU General Public License v3.0
58 stars 23 forks source link

error in genomic_converter() #160

Closed danielsangarci closed 1 year ago

danielsangarci commented 2 years ago

Hello Thierry,

I need to convert a genind dataset in the structure format. I am trying with your function, but I get an error i cannot solve. I am using the function genomic_converter(micro_popgen_dataset9, strata = strata, output = "structure")

I get the next error:

Importing data: genind
Error in sample.int(length(x), size, replace, prob) : 
  cannot take a sample larger than the population when 'replace = FALSE'

I have also tried with genomic_converter(micro_popgen_dataset9, strata = NULL, output = "structure") still getting the same error and I have check the object type by radiator::detect_genomic_format(data = micro_popgen_dataset9) and the output is correct (genind object).

You can get the genind object I am using in genomic_converter() by running the next code with the attached dataset.

library(readxl)
microsat_df9 <- as.data.frame(read_excel('microsatellite_dataset9.xlsx', sheet = "Sheet1", col_names=T))
[microsatellite_dataset9.xlsx](https://github.com/thierrygosselin/radiator/files/8901097/microsatellite_dataset9.xlsx)

micro_popgen9<- data.frame(mapply(paste0, microsat_df9[5:22][c(T,F)], "_", microsat_df9[5:22][c(F,T)]))
micro_popgen9[micro_popgen9=="0_0"]<-NA

library(adegenet)
micro_popgen_dataset9 <- df2genind(micro_popgen9, sep = "_", ind.names = microsat_df9$individual, pop = microsat_df9$population)

microsatellite_dataset9.xlsx

Thank you very much in advance, Dani

thierrygosselin commented 1 year ago

Hi Dani, Thanks for reporting and giving everything needed to fix the problem.

Sorry for the long delay, I'll have a look today, it might be of futur help in your arsenal of genomic tools.

Thierry

thierrygosselin commented 1 year ago

Ok so I had a look and the data is not bi-allelic. It's written in the Get Started vignette. Sorry. I'll try to make it more obvious in the next update.

https://thierrygosselin.github.io/radiator/articles/get_started.html#overview