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

'Genomic_converter' error (genlight to genepop/plink) - with and without strata #123

Closed jacksonlmartinez closed 3 years ago

jacksonlmartinez commented 3 years ago

Bug I am attempting to convert a genlight object into genepop and plink (tfam/tped) files using 'genomic_converter.' The converter is unsuccessful both with and without a strata file. This code has previously worked for me without a strata file, but it was about 6 months ago. Looking at the source code and the resulting error, I am wondering if the issue has something to do with the definitions of 'strata' and 'STRATA.' On line 426, 'strata' lower case is defined, however, on line lines 444-449, 'STRATA' all caps is used. Additionally, 'STRATA' all caps is used again on line 803. Thank you for your time and assistance.

Code used genomic_converter(data = glX, output = c("genepop", "plink"), filename = "gpX.csv")

Error message

rlang::last_trace() █ ├─<error/dplyr:::mutate_error> │ Problem with mutate() input ..1. │ x Can't subset columns that don't exist. │ x Column STRATA doesn't exist. │ ℹ Input ..1 is (function (.cols = everything(), .fns = NULL, ..., .names = NULL) .... └─<error/vctrs_error_subscript_oob> Can't subset columns that don't exist. Backtrace: █

  1. ├─global::genomic_converter(...)
  2. │ └─radiator::tidy_genomic_data(...)
  3. │ └─%>%(...)
  4. ├─dplyr::mutate(., dplyr::across(.cols = "STRATA", .fns = clean_pop_names))
  5. ├─dplyr:::mutate.data.frame(...)
  6. │ └─dplyr:::mutate_cols(.data, ...)
  7. │ ├─base::withCallingHandlers(...)
  8. │ └─dplyr:::expand_quosure(dots[[i]])
  9. │ └─rlang::eval_tidy(quo, mask$get_rlang_mask(), mask$get_caller_env())
  10. └─(function (.cols = everything(), .fns = NULL, ..., .names = NULL) ...
  11. └─dplyr:::across_setup_impl(...)
  12. └─tidyselect::eval_select(cols, data = mask$across_cols())
  13. └─tidyselect:::eval_select_impl(...)
  14. ├─tidyselect:::with_subscript_errors(...)
  15. │ ├─base::tryCatch(...)
  16. │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
  17. │ │ └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
  18. │ │ └─base:::doTryCatch(return(expr), name, parentenv, handler)
  19. │ └─tidyselect:::instrument_base_errors(expr)
  20. │ └─base::withCallingHandlers(...)
  21. └─tidyselect:::vars_select_eval(...)
  22. └─tidyselect:::as_indices_sel_impl(...)
  23. └─tidyselect:::as_indices_impl(x, vars, strict = strict)
  24. └─tidyselect:::chr_as_locations(x, vars)
  25. └─vctrs::vec_as_location(x, n = length(vars), names = vars)
  26. └─(function () ...
  27. └─vctrs:::stop_subscript_oob(...)
  28. └─vctrs:::stop_subscript(...)

Additional Error Traceback Error: Problem with mutate() input ..1. x Can't subset columns that don't exist. x Column STRATA doesn't exist. ℹ Input ..1 is (function (.cols = everything(), .fns = NULL, ..., .names = NULL) .... Run rlang::last_error() to see where the error occurred. 25. stop(fallback) 24. signal_abort(cnd) 23. abort(bullets, class = c("dplyr:::mutate_error", "dplyr_error"), error_name = error_name, error_expression = error_expression, parent = e, bullets = bullets) 22. (function (e) { local_call_step(dots = dots, .index = i, .fn = "mutate", .dot_data = inherits(e, "rlang_error_data_pronoun_not_found")) ... 21. signalCondition(cnd) 20. rlang:::signal_abort(x) 19. cnd_signal(cnd) 18. value[3L] 17. tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16. tryCatchList(expr, classes, parentenv, handlers) 15. tryCatch(instrument_base_errors(expr), vctrs_error_subscript = function(cnd) { cnd$subscript_action <- subscript_action(type) cnd$subscript_elt <- "column" cnd_signal(cnd) ... 14. with_subscript_errors(vars_select_eval(vars, expr, strict, data = x, name_spec = name_spec, uniquely_named = uniquely_named, allow_rename = allow_rename, type = type), type = type) 13. eval_select_impl(data, names(data), as_quosure(expr, env), include = include, exclude = exclude, strict = strict, name_spec = name_spec, allow_rename = allow_rename) 12. tidyselect::eval_select(cols, data = mask$across_cols()) 11. across_setup_impl({ { .cols } ... 10. (function (.cols = everything(), .fns = NULL, ..., .names = NULL) { setup <- across_setup_impl({ { ... 9. eval_tidy(quo, mask$get_rlang_mask(), mask$get_caller_env()) 8. expand_quosure(dots[[i]]) 7. withCallingHandlers({ for (i in seq_along(dots)) { mask$across_cache_reset() quosures <- expand_quosure(dots[[i]]) ... 6. mutate_cols(.data, ...) 5. mutate.data.frame(., dplyr::across(.cols = "STRATA", .fns = clean_pop_names)) 4. dplyr::mutate(., dplyr::across(.cols = "STRATA", .fns = clean_pop_names)) 3. input %<>% dplyr::mutate(dplyr::across(.cols = "INDIVIDUALS", .fns = clean_ind_names)) %>% dplyr::mutate(dplyr::across(.cols = "STRATA", .fns = clean_pop_names)) 2. radiator::tidy_genomic_data(data = data, strata = strata.bk, filename = filename, parallel.core = parallel.core, whitelist.markers = whitelist.markers, blacklist.id = blacklist.id, vcf.metadata = vcf.metadata, vcf.stats = vcf.stats, keep.allele.names = keep.allele.names, ... 1. genomic_converter(data = gl8pops, output = c("genepop", "plink"), filename = "gp8pops.csv")

devtools::session_info() output Session info setting value
version R version 4.0.4 (2021-02-15) os macOS Catalina 10.15.6
system x86_64, darwin17.0
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2021-03-14

Packages ade4 1.7-16 2020-10-28 [1] CRAN (R 4.0.2)
adegenet
2.1.3 2020-05-10 [1] CRAN (R 4.0.2)
ape 5.4-1 2020-08-13 [1] CRAN (R 4.0.2)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
BiocGenerics 0.36.0 2020-10-27 [1] Bioconductor
BiocManager 1.30.10 2019-11-16 [1] CRAN (R 4.0.2)
Biostrings 2.58.0 2020-10-27 [1] Bioconductor
bitops 1.0-6 2013-08-17 [1] CRAN (R 4.0.2)
boot 1.3-27 2021-02-12 [1] CRAN (R 4.0.2)
cachem 1.0.4 2021-02-13 [1] CRAN (R 4.0.2)
calibrate 1.7.7 2020-06-19 [1] CRAN (R 4.0.2)
callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.2)
class 7.3-18 2021-01-24 [1] CRAN (R 4.0.4)
classInt 0.4-3 2020-04-07 [1] CRAN (R 4.0.2)
cli 2.3.1 2021-02-23 [1] CRAN (R 4.0.2)
cluster 2.1.1 2021-02-14 [1] CRAN (R 4.0.2)
coda 0.19-4 2020-09-30 [1] CRAN (R 4.0.2)
codetools 0.2-18 2020-11-04 [1] CRAN (R 4.0.4)
colorspace 2.0-0 2020-11-11 [1] CRAN (R 4.0.2)
combinat 0.0-8 2012-10-29 [1] CRAN (R 4.0.2)
crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.2)
curl 4.3 2019-12-02 [1] CRAN (R 4.0.1)
dartR
1.8.3 2020-09-01 [1] CRAN (R 4.0.2)
data.table 1.14.0 2021-02-21 [1] CRAN (R 4.0.4)
DBI 1.1.1 2021-01-15 [1] CRAN (R 4.0.2)
deldir 0.2-10 2021-02-16 [1] CRAN (R 4.0.2)
DEoptimR 1.0-8 2016-11-19 [1] CRAN (R 4.0.2)
V desc 1.2.0 2021-03-05 [1] CRAN (R 4.0.2)
devtools 2.3.2 2020-09-18 [1] CRAN (R 4.0.2)
digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
dismo 1.3-3 2020-11-17 [1] CRAN (R 4.0.2)
doParallel 1.0.16 2020-10-16 [1] CRAN (R 4.0.2)
dplyr
1.0.5 2021-03-05 [1] CRAN (R 4.0.2)
e1071 1.7-4 2020-10-14 [1] CRAN (R 4.0.2)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
expm 0.999-6 2021-01-13 [1] CRAN (R 4.0.2)
fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.2)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.0.2)
foreach 1.5.1 2020-10-15 [1] CRAN (R 4.0.2)
fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2)
gap 1.2.2 2020-02-02 [1] CRAN (R 4.0.2)
gdata 2.18.0 2017-06-06 [1] CRAN (R 4.0.2)
gdistance 1.3-6 2020-06-29 [1] CRAN (R 4.0.2)
V gdsfmt 1.26.1 2020-06-16 [1] Bioconductor
generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.2)
genetics 1.3.8.1.3 2021-03-01 [1] CRAN (R 4.0.4)
GenomeInfoDb 1.26.2 2020-12-08 [1] Bioconductor
GenomeInfoDbData 1.2.4 2020-11-01 [1] Bioconductor
GenomicRanges 1.42.0 2020-10-27 [1] Bioconductor
V GGally 2.1.0 2021-03-08 [1] CRAN (R 4.0.2)
ggplot2
3.3.3.9000 2021-03-11 [1] Github (hadley/ggplot2@4555055)
glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
gmodels 2.18.1 2018-06-25 [1] CRAN (R 4.0.2)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
gtools 3.8.2 2020-03-31 [1] CRAN (R 4.0.2)
hierfstat 0.5-7 2020-07-20 [1] CRAN (R 4.0.2)
hms 1.0.0 2021-01-13 [1] CRAN (R 4.0.2)
htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.2)
htmlwidgets 1.5.3 2020-12-10 [1] CRAN (R 4.0.2)
httpuv 1.5.5 2021-01-13 [1] CRAN (R 4.0.2)
httr 1.4.2 2020-07-20 [1] CRAN (R 4.0.2)
igraph 1.2.6 2020-10-06 [1] CRAN (R 4.0.2)
IRanges 2.24.1 2020-12-12 [1] Bioconductor
iterators 1.0.13 2020-10-15 [1] CRAN (R 4.0.2)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.2)
KernSmooth 2.23-18 2020-10-29 [1] CRAN (R 4.0.4)
knitr 1.31 2021-01-27 [1] CRAN (R 4.0.2)
later 1.1.0.1 2020-06-05 [1] CRAN (R 4.0.2)
lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.4)
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.0.2)
LearnBayes 2.15.1 2018-03-18 [1] CRAN (R 4.0.2)
lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.2)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
MASS 7.3-53.1 2021-02-12 [1] CRAN (R 4.0.2)
Matrix 1.3-2 2021-01-06 [1] CRAN (R 4.0.4)
memoise 2.0.0 2021-01-26 [1] CRAN (R 4.0.2)
mgcv 1.8-34 2021-02-16 [1] CRAN (R 4.0.2)
mime 0.10 2021-02-13 [1] CRAN (R 4.0.2)
mmod 1.3.3 2017-04-06 [1] CRAN (R 4.0.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
mvtnorm 1.1-1 2020-06-09 [1] CRAN (R 4.0.2)
nlme 3.1-152 2021-02-04 [1] CRAN (R 4.0.4)
pegas 0.14 2020-09-16 [1] CRAN (R 4.0.2)
permute 0.9-5 2019-03-12 [1] CRAN (R 4.0.2)
pillar 1.5.1 2021-03-05 [1] CRAN (R 4.0.4)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.0.2)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
pkgload 1.2.0 2021-02-23 [1] CRAN (R 4.0.2)
plotly
4.9.3 2021-01-10 [1] CRAN (R 4.0.2)
plyr 1.8.6 2020-03-03 [1] CRAN (R 4.0.2)
png 0.1-7 2013-12-03 [1] CRAN (R 4.0.2)
PopGenReport 3.0.4 2019-02-04 [1] CRAN (R 4.0.2)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
processx 3.4.5 2020-11-30 [1] CRAN (R 4.0.2)
progress 1.2.2 2019-05-16 [1] CRAN (R 4.0.2)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.0.2)
ps 1.6.0 2021-02-28 [1] CRAN (R 4.0.2)
purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.2)
R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.0.2)
R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.0.2)
R.utils 2.10.1 2020-08-26 [1] CRAN (R 4.0.2)
R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
radiator 1.1.9 2021-03-15 [1] Github (thierrygosselin/radiator@5c6b865) raster 3.4-5 2020-11-14 [1] CRAN (R 4.0.2)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.2)
Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.2)
RCurl 1.98-1.2 2020-04-18 [1] CRAN (R 4.0.2)
readr 1.4.0 2020-10-05 [1] CRAN (R 4.0.2)
remotes 2.2.0 2020-07-21 [1] CRAN (R 4.0.2)
reshape 0.8.8 2018-10-23 [1] CRAN (R 4.0.2)
reshape2
1.4.4 2020-04-09 [1] CRAN (R 4.0.2)
rgdal 1.5-23 2021-02-03 [1] CRAN (R 4.0.2)
RgoogleMaps 1.4.5.3 2020-02-12 [1] CRAN (R 4.0.2)
rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.2)
robustbase 0.93-7 2021-01-04 [1] CRAN (R 4.0.2)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.2)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
S4Vectors 0.28.1 2020-12-09 [1] Bioconductor
scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
SeqArray 1.28.1 2020-06-16 [1] Bioconductor
seqinr 4.2-5 2020-12-17 [1] CRAN (R 4.0.2)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2)
sf 0.9-7 2021-01-06 [1] CRAN (R 4.0.2)
shiny 1.6.0 2021-01-25 [1] CRAN (R 4.0.2)
SNPRelate
1.22.0 2020-04-27 [1] Bioconductor
sp 1.4-5 2021-01-10 [1] CRAN (R 4.0.2)
spData 0.3.8 2020-07-03 [1] CRAN (R 4.0.2)
spdep 1.1-5 2020-06-29 [1] CRAN (R 4.0.2)
StAMPP 1.6.1 2020-03-20 [1] CRAN (R 4.0.2)
stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2)
stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.2)
testthat 3.0.2 2021-02-14 [1] CRAN (R 4.0.2)
tibble 3.1.0 2021-02-25 [1] CRAN (R 4.0.2)
tidyr 1.1.3 2021-03-03 [1] CRAN (R 4.0.2)
tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.2)
units 0.7-0 2021-02-25 [1] CRAN (R 4.0.2)
usethis * 2.0.1 2021-02-10 [1] CRAN (R 4.0.2)
V utf8 1.1.4 2021-03-12 [1] CRAN (R 4.0.2)
vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.2)
vegan 2.5-7 2020-11-28 [1] CRAN (R 4.0.2)
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.1)
withr 2.4.1 2021-01-26 [1] CRAN (R 4.0.2)
V xfun 0.21 2021-03-11 [1] CRAN (R 4.0.2)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.2)
XVector 0.30.0 2020-10-28 [1] Bioconductor
zlibbioc 1.36.0 2020-10-28 [1] Bioconductor

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

V ── Loaded and on-disk version mismatch.

thierrygosselin commented 3 years ago

try again with new version, if still relevant to you. If it's still not working, follow guidelines on reporting bug so that I can reproduce Best