thierrygosselin / assigner

Population assignment analysis using R
http://thierrygosselin.github.io/assigner
GNU General Public License v3.0
17 stars 6 forks source link

Heat map error #22

Closed siberianhigh closed 3 years ago

siberianhigh commented 4 years ago

Hi Thierry,

I've got the following error when trying to make a heatmap with the assigner 0.5.7:

> heat.fst <- heatmap_fst(fst.ci$pairwise.fst.full.matrix, fst.ci$pairwise.fst.ci.matrix, n.s = TRUE,
+             digits = 3, color.low = "white", color.mid = "grey",
+             color.high = "black", text.size = 4, plot.size = 40,
+             path.folder = NULL, filename = NULL)
Error: Can't join on `x$POP1` x `y$POP1` because of incompatible types.
ℹ `x$POP1` is of type <ordered<09208>>>.
ℹ `y$POP1` is of type <ordered<58a21>>>.
Run `rlang::last_error()` to see where the error occurred.

Details:

> rlang::last_error()
<error/rlang_error>
Can't join on `x$POP1` x `y$POP1` because of incompatible types.
ℹ `x$POP1` is of type <ordered<2bfb4>>>.
ℹ `y$POP1` is of type <ordered<4d8de>>>.
Backtrace:
  1. assigner::fst_WC84(...)
  2. assigner::heatmap_fst(...)
  5. [ `%>%`(...) ] with 7 more calls
 14. dplyr:::left_join.data.frame(., ns, by = c("POP1", "POP2"))
 15. dplyr:::join_mutate(...)
 16. dplyr:::join_rows(x_key, y_key, type = type, na_equal = na_equal)
 17. base::tryCatch(...)
 18. base:::tryCatchList(expr, classes, parentenv, handlers)
 19. base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
 20. value[[3L]](cond)
Run `rlang::last_trace()` to see the full context.
Warning message:
Internal error: Trace data is not square. 
> rlang::last_trace()
<error/rlang_error>
Can't join on `x$POP1` x `y$POP1` because of incompatible types.
ℹ `x$POP1` is of type <ordered<2bfb4>>>.
ℹ `y$POP1` is of type <ordered<4d8de>>>.
Backtrace:
     █
  1. └─assigner::fst_WC84(...)
  2.   └─assigner::heatmap_fst(...)
  3.     ├─base::suppressWarnings(...)
  4.     │ └─base::withCallingHandlers(...)
  5.     └─`%>%`(...)
  6.       ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  7.       └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  8.         └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  9.           └─assigner:::`_fseq`(`_lhs`)
 10.             └─magrittr::freduce(value, `_function_list`)
 11.               ├─base::withVisible(function_list[[k]](value))
 12.               └─function_list[[k]](value)
 13.                 ├─dplyr::left_join(., ns, by = c("POP1", "POP2"))
 14.                 └─dplyr:::left_join.data.frame(., ns, by = c("POP1", "POP2"))
 15.                   └─dplyr:::join_mutate(...)
 16.                     └─dplyr:::join_rows(x_key, y_key, type = type, na_equal = na_equal)
 17.                       └─base::tryCatch(...)
 18.                         └─base:::tryCatchList(expr, classes, parentenv, handlers)
 19.                           └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
 20.                             └─value[[3L]](cond)
> devtools::session_info()
─ Session info 
────────
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Ubuntu 20.04.1 LTS          
 system   x86_64, linux-gnu           
 ─ Packages 
───────────────────────────────────────────────────────
 package          * version  date       lib source                                   
 ade4               1.7-15   2020-02-13 [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)                           
 assigner         * 0.5.7    2020-09-11 [1] Github (thierrygosselin/assigner@da61eb8)
 backports          1.1.9    2020-08-24 [1] CRAN (R 4.0.2)                           
 Biobase            2.48.0   2020-04-27 [1] Bioconductor                             
 BiocGenerics       0.34.0   2020-04-27 [1] Bioconductor                             
 BiocManager        1.30.10  2019-11-16 [1] CRAN (R 4.0.2)                           
 Biostrings         2.56.0   2020-04-27 [1] Bioconductor                             
 bitops             1.0-6    2013-08-17 [1] CRAN (R 4.0.2)                           
 boot               1.3-25   2020-04-26 [4] CRAN (R 4.0.0)                           
 broom              0.7.0    2020-07-09 [1] CRAN (R 4.0.2)                           
 callr              3.4.4    2020-09-07 [1] CRAN (R 4.0.2)                           
 class              7.3-17   2020-04-26 [4] CRAN (R 4.0.0)                           
 classInt           0.4-3    2020-04-07 [1] CRAN (R 4.0.2)                           
 cli                2.0.2    2020-02-28 [1] CRAN (R 4.0.2)                           
 cluster            2.1.0    2019-06-19 [4] CRAN (R 4.0.0)                           
 coda               0.19-3   2019-07-05 [1] CRAN (R 4.0.2)                           
 codetools          0.2-16   2018-12-24 [4] CRAN (R 4.0.0)                           
 colorspace         1.4-1    2019-03-18 [1] CRAN (R 4.0.2)                           
 crayon             1.3.4    2017-09-16 [1] CRAN (R 4.0.2)                           
 curl               4.3      2019-12-02 [1] CRAN (R 4.0.2)                           
 data.table         1.13.0   2020-07-24 [1] CRAN (R 4.0.2)                           
 DBI                1.1.0    2019-12-15 [1] CRAN (R 4.0.2)                           
 deldir             0.1-28   2020-07-15 [1] CRAN (R 4.0.2)                           
 desc               1.2.0    2018-05-01 [1] CRAN (R 4.0.2)                           
 devtools         * 2.3.1    2020-07-21 [1] CRAN (R 4.0.2)                           
 digest             0.6.25   2020-02-23 [1] CRAN (R 4.0.2)                           
 dplyr              1.0.2    2020-08-18 [1] CRAN (R 4.0.2)                           
 e1071              1.7-3    2019-11-26 [1] CRAN (R 4.0.2)                           
 ellipsis           0.3.1    2020-05-15 [1] CRAN (R 4.0.2)                           
 expm               0.999-5  2020-07-20 [1] CRAN (R 4.0.2)                           
 fansi              0.4.1    2020-01-08 [1] CRAN (R 4.0.2)                           
 farver             2.0.3    2020-01-16 [1] CRAN (R 4.0.2)                           
 fastmap            1.0.1    2019-10-08 [1] CRAN (R 4.0.2)                           
 fs                 1.5.0    2020-07-31 [1] CRAN (R 4.0.2)                           
 fst                0.9.4    2020-08-27 [1] CRAN (R 4.0.2)                           
 gdata              2.18.0   2017-06-06 [1] CRAN (R 4.0.2)                           
 gdsfmt             1.24.1   2020-06-16 [1] Bioconductor                             
 generics           0.0.2    2018-11-29 [1] CRAN (R 4.0.2)                           
 GenomeInfoDb       1.24.2   2020-06-15 [1] Bioconductor                             
 GenomeInfoDbData   1.2.3    2020-09-11 [1] Bioconductor                             
 GenomicRanges      1.40.0   2020-04-27 [1] Bioconductor                             
 ggplot2          * 3.3.2    2020-06-19 [1] CRAN (R 4.0.2)                           
 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)                           
 GWASExactHW        1.01     2013-01-05 [1] CRAN (R 4.0.2)                           
 hms                0.5.3    2020-01-08 [1] CRAN (R 4.0.2)                           
 htmltools          0.5.0    2020-06-16 [1] CRAN (R 4.0.2)                           
 httpuv             1.5.4    2020-06-06 [1] CRAN (R 4.0.2)                           
 igraph             1.2.5    2020-03-19 [1] CRAN (R 4.0.2)                           
 IRanges            2.22.2   2020-05-21 [1] Bioconductor                             
 KernSmooth         2.23-17  2020-04-26 [4] CRAN (R 4.0.0)                           
 labeling           0.3      2014-08-23 [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 [4] CRAN (R 4.0.0)                           
 LearnBayes         2.15.1   2018-03-18 [1] CRAN (R 4.0.2)                           
 lifecycle          0.2.0    2020-03-06 [1] CRAN (R 4.0.2)                           
 logistf            1.23.1   2020-09-04 [1] CRAN (R 4.0.2)                           
 magrittr           1.5      2014-11-22 [1] CRAN (R 4.0.2)                           
 MASS               7.3-53   2020-09-09 [4] CRAN (R 4.0.2)                           
 Matrix             1.2-18   2019-11-27 [4] CRAN (R 4.0.0)                           
 memoise            1.1.0    2017-04-21 [1] CRAN (R 4.0.2)                           
 mgcv               1.8-33   2020-08-27 [4] CRAN (R 4.0.2)                           
 mice               3.11.0   2020-08-05 [1] CRAN (R 4.0.2)                           
 mime               0.9      2020-02-04 [1] CRAN (R 4.0.2)                           
 munsell            0.5.0    2018-06-12 [1] CRAN (R 4.0.2)                           
 nlme               3.1-149  2020-08-23 [4] CRAN (R 4.0.2)                           
 pbmcapply          1.5.0    2019-07-10 [1] CRAN (R 4.0.2)                           
 permute            0.9-5    2019-03-12 [1] CRAN (R 4.0.2)                           
 pillar             1.4.6    2020-07-10 [1] CRAN (R 4.0.2)                           
 pkgbuild           1.1.0    2020-07-13 [1] CRAN (R 4.0.2)                           
 pkgconfig          2.0.3    2019-09-22 [1] CRAN (R 4.0.2)                           
 pkgload            1.1.0    2020-05-29 [1] CRAN (R 4.0.2)                           
 plyr               1.8.6    2020-03-03 [1] CRAN (R 4.0.2)                           
 prettyunits        1.1.1    2020-01-24 [1] CRAN (R 4.0.2)                           
 processx           3.4.4    2020-09-03 [1] CRAN (R 4.0.2)                           
 promises           1.1.1    2020-06-09 [1] CRAN (R 4.0.2)                           
 ps                 1.3.4    2020-08-11 [1] CRAN (R 4.0.2)                           
 purrr              0.3.4    2020-04-17 [1] CRAN (R 4.0.2)                           
 R6                 2.4.1    2019-11-12 [1] CRAN (R 4.0.2)                           
 radiator         * 1.1.7    2020-09-11 [1] Github (thierrygosselin/radiator@ff31083)
 raster             3.3-13   2020-07-17 [1] CRAN (R 4.0.2)                           
 Rcpp               1.0.5    2020-07-06 [1] CRAN (R 4.0.2)                           
 RCurl              1.98-1.2 2020-04-18 [1] CRAN (R 4.0.2)                           
 readr              1.3.1    2018-12-21 [1] CRAN (R 4.0.2)                           
 remotes            2.2.0    2020-07-21 [1] CRAN (R 4.0.2)                           
 reshape2           1.4.4    2020-04-09 [1] CRAN (R 4.0.2)                           
 rlang              0.4.7    2020-07-09 [1] CRAN (R 4.0.2)                           
 rprojroot          1.3-2    2018-01-03 [1] CRAN (R 4.0.2)                           
 rstudioapi         0.11     2020-02-07 [1] CRAN (R 4.0.2)                           
 S4Vectors          0.26.1   2020-05-16 [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             3.6-1    2019-09-07 [1] CRAN (R 4.0.2)                           
 SeqVarTools        1.26.0   2020-04-27 [1] Bioconductor                             
 sessioninfo        1.1.1    2018-11-05 [1] CRAN (R 4.0.2)                           
 sf                 0.9-5    2020-07-14 [1] CRAN (R 4.0.2)                           
 shiny              1.5.0    2020-06-23 [1] CRAN (R 4.0.2)                           
 sp                 1.4-2    2020-05-20 [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)                           
 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           2.3.2    2020-03-02 [1] CRAN (R 4.0.2)                           
 tibble             3.0.3    2020-07-10 [1] CRAN (R 4.0.2)                           
 tidyr              1.1.2    2020-08-27 [1] CRAN (R 4.0.2)                           
 tidyselect         1.1.0    2020-05-11 [1] CRAN (R 4.0.2)                           
 units              0.6-7    2020-06-13 [1] CRAN (R 4.0.2)                           
 UpSetR             1.4.0    2019-05-22 [1] CRAN (R 4.0.2)                           
 usethis          * 1.6.1    2020-04-29 [1] CRAN (R 4.0.2)                           
 utf8               1.1.4    2018-05-24 [1] CRAN (R 4.0.2)                           
 vctrs              0.3.4    2020-08-29 [1] CRAN (R 4.0.2)                           
 vegan              2.5-6    2019-09-01 [1] CRAN (R 4.0.2)                           
 withr              2.2.0    2020-04-20 [1] CRAN (R 4.0.2)                           
 xtable             1.8-4    2019-04-21 [1] CRAN (R 4.0.2)                           
 XVector            0.28.0   2020-04-27 [1] Bioconductor                             
 zlibbioc           1.34.0   2020-04-27 [1] Bioconductor
thierrygosselin commented 4 years ago

Sorry about that I'll only be able to look at the problem next Tuesday, maybe Monday night.

In the meantime could you try running the fst (W&C) function and use the heatmap argument inside it ?

Best Thierry

siberianhigh commented 3 years ago

I did, and there is no difference, I've got the same error.

thierrygosselin commented 3 years ago

Re-install assigner in a new R session. Should work now, re-open the issue if you're still experiencing a bug. Thanks!