whitlock / OutFLANK

A procedure to find Fst outliers based on an inferred distribution of neutral Fst
18 stars 9 forks source link

NumberOfSamples error help #26

Open EveTC opened 4 years ago

EveTC commented 4 years ago

Hi,

I am receiving the same error as @katymoo on this chain. I commente on this chain but it hasn't been active since 2017, so I thought it may be best to create a new one. Did anyone find a solution to this error?

I have made sure to include the number of populations in the NumberOfSamples argument as so:

sw_out <- OutFLANK(FstDataFrame=sw.Fs, LeftTrimFraction=0.05, RightTrimFraction=0.05, Hmin=0.1, NumberOfSamples=36, qthreshold=0.1)

but it outputs this error:

Error in optim(NumberOfSamples, localNLLAllData, lower = 2, method = "L-BFGS-B") :
  L-BFGS-B needs finite values of 'fn'

I also recieve the same error message when I set the argument to the number of individuals. Is there a limit to how many popualtion OutFLANK can handle?

Any help would be greatly appreciated! Thanks, Eve

jcaccavo commented 1 year ago

I am experiencing the same error as Eve, and as recounted in #8 .

I created my input file as follows: My .vcf file was converted to a .raw file using PLINK, with the following code: plink -vcf 3_subarea_p3_p1r0.6singleSNP_populations.snps.SORTED_min10max120miss0.75_1SNPperlocus.vcf --double-id --allow-extra-chr --set-missing-var-ids @:# --make-bed --recodeAD --out 3_subarea_p3_p1r0.6singleSNP_populations.snps.SORTED_min10max120miss0.75_1SNPperlocus.raw

I then transformed the .raw file into a genlight object in R using the function read.PLINK dm_all_ade <- read.PLINK("3_subarea_p3_p1r0.6singleSNP_populations.snps.SORTED_min10max120miss0.75_1SNPperlocus.raw")

I then transformed the genlight object into an FstDataFrame using the following code:

gl <- dm_all_ade
SNPmat <- as.matrix(gl)
colnames(SNPmat) <- NULL
row.names(SNPmat) <- NULL
SNPmat[is.na(SNPmat)] <- 9
FstDataFrame <- OutFLANK::MakeDiploidFSTMat(SNPmat, gl@loc.names,
                                            as.character(gl@pop))

Then, when trying to run OutFLANK, I ran into the same error as Eve, and as described in #8 .

Outliers <- OutFLANK::OutFLANK(FstDataFrame, NumberOfSamples = length(levels(gl@pop)),
                               qthreshold = 0.01, LeftTrimFraction = 0.01,
                               RightTrimFraction = 0.1,
                               Hmin = 0.0001)
Error in optim(NumberOfSamples, localNLLAllData, lower = 2, method = "L-BFGS-B") : 
  L-BFGS-B needs finite values of 'fn'

Any assistance on this issue would be greatly appreciated!

My R session info is as follows: devtools::session_info()

─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.2 (2022-10-31)
 os       macOS Monterey 12.6
 system   x86_64, darwin17.0
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Paris
 date     2023-02-07
 rstudio  2022.12.0+353 Elsbeth Geranium (desktop)
 pandoc   2.19.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package      * version  date (UTC) lib source
 abind          1.4-5    2016-07-21 [1] CRAN (R 4.2.0)
 ade4         * 1.7-20   2022-11-01 [1] CRAN (R 4.2.0)
 adegenet     * 2.1.10   2023-01-26 [1] CRAN (R 4.2.2)
 ape            5.6-2    2022-03-02 [1] CRAN (R 4.2.0)
 apex           1.0.4    2020-04-11 [1] CRAN (R 4.2.0)
 backports      1.4.1    2021-12-13 [1] CRAN (R 4.2.0)
 base64enc      0.1-3    2015-07-28 [1] CRAN (R 4.2.0)
 cachem         1.0.6    2021-08-19 [1] CRAN (R 4.2.0)
 callr          3.7.3    2022-11-02 [1] CRAN (R 4.2.0)
 checkmate      2.1.0    2022-04-21 [1] CRAN (R 4.2.2)
 cli            3.6.0    2023-01-09 [1] CRAN (R 4.2.0)
 cluster        2.1.4    2022-08-22 [1] CRAN (R 4.2.2)
 codetools      0.2-18   2020-11-04 [1] CRAN (R 4.2.2)
 colorspace     2.1-0    2023-01-23 [1] CRAN (R 4.2.0)
 corpcor        1.6.10   2021-09-16 [1] CRAN (R 4.2.0)
 crayon         1.5.2    2022-09-29 [1] CRAN (R 4.2.0)
 data.table     1.14.6   2022-11-16 [1] CRAN (R 4.2.0)
 DBI            1.1.3    2022-06-18 [1] CRAN (R 4.2.0)
 deldir         1.0-6    2021-10-23 [1] CRAN (R 4.2.0)
 devtools       2.4.5    2022-10-11 [1] CRAN (R 4.2.0)
 digest         0.6.31   2022-12-11 [1] CRAN (R 4.2.0)
 diveRsity      1.9.89   2016-12-09 [1] CRAN (R 4.2.2)
 dplyr          1.1.0    2023-01-29 [1] CRAN (R 4.2.2)
 ellipsis       0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
 evaluate       0.20     2023-01-17 [1] CRAN (R 4.2.2)
 fansi          1.0.4    2023-01-22 [1] CRAN (R 4.2.0)
 fastmap        1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
 fastmatch      1.1-3    2021-07-23 [1] CRAN (R 4.2.0)
 fdrtool        1.2.17   2021-11-13 [1] CRAN (R 4.2.0)
 foreign        0.8-84   2022-12-06 [1] CRAN (R 4.2.0)
 Formula        1.2-4    2020-10-16 [1] CRAN (R 4.2.2)
 fs             1.6.0    2023-01-23 [1] CRAN (R 4.2.0)
 generics       0.1.3    2022-07-05 [1] CRAN (R 4.2.0)
 ggplot2        3.4.0    2022-11-04 [1] CRAN (R 4.2.0)
 glasso         1.11     2019-10-01 [1] CRAN (R 4.2.0)
 glue           1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
 gridExtra      2.3      2017-09-09 [1] CRAN (R 4.2.0)
 gtable         0.3.1    2022-09-01 [1] CRAN (R 4.2.0)
 gtools         3.9.4    2022-11-27 [1] CRAN (R 4.2.0)
 Hmisc          4.7-2    2022-11-18 [1] CRAN (R 4.2.0)
 hms            1.1.2    2022-08-19 [1] CRAN (R 4.2.0)
 htmlTable      2.4.1    2022-07-07 [1] CRAN (R 4.2.2)
 htmltools      0.5.4    2022-12-07 [1] CRAN (R 4.2.0)
 htmlwidgets    1.6.1    2023-01-07 [1] CRAN (R 4.2.0)
 httpuv         1.6.8    2023-01-12 [1] CRAN (R 4.2.0)
 httr           1.4.4    2022-08-17 [1] CRAN (R 4.2.0)
 igraph         1.3.5    2022-09-22 [1] CRAN (R 4.2.0)
 interp         1.1-3    2022-07-13 [1] CRAN (R 4.2.0)
 jpeg           0.1-10   2022-11-29 [1] CRAN (R 4.2.0)
 kableExtra     1.3.4    2021-02-20 [1] CRAN (R 4.2.0)
 knitr          1.42     2023-01-25 [1] CRAN (R 4.2.2)
 later          1.3.0    2021-08-18 [1] CRAN (R 4.2.0)
 lattice        0.20-45  2021-09-22 [1] CRAN (R 4.2.2)
 latticeExtra   0.6-30   2022-07-04 [1] CRAN (R 4.2.0)
 lavaan         0.6-13   2023-01-09 [1] CRAN (R 4.2.0)
 lifecycle      1.0.3    2022-10-07 [1] CRAN (R 4.2.0)
 magrittr       2.0.3    2022-03-30 [1] CRAN (R 4.2.0)
 MASS           7.3-58.2 2023-01-23 [1] CRAN (R 4.2.0)
 Matrix         1.5-3    2022-11-11 [1] CRAN (R 4.2.0)
 memoise        2.0.1    2021-11-26 [1] CRAN (R 4.2.0)
 mgcv           1.8-41   2022-10-21 [1] CRAN (R 4.2.2)
 mime           0.12     2021-09-28 [1] CRAN (R 4.2.0)
 miniUI         0.1.1.1  2018-05-18 [1] CRAN (R 4.2.0)
 mnormt         2.1.1    2022-09-26 [1] CRAN (R 4.2.0)
 munsell        0.5.0    2018-06-12 [1] CRAN (R 4.2.0)
 nlme           3.1-161  2022-12-15 [1] CRAN (R 4.2.0)
 nnet           7.3-18   2022-09-28 [1] CRAN (R 4.2.2)
 OutFLANK       0.2      2023-01-20 [1] Github (whitlock/OutFLANK@e502e82)
 pbapply        1.7-0    2023-01-13 [1] CRAN (R 4.2.0)
 pbivnorm       0.6.0    2015-01-23 [1] CRAN (R 4.2.0)
 pegas          1.1      2021-12-16 [1] CRAN (R 4.2.0)
 permute        0.9-7    2022-01-27 [1] CRAN (R 4.2.0)
 phangorn       2.11.1   2023-01-23 [1] CRAN (R 4.2.0)
 pillar         1.8.1    2022-08-19 [1] CRAN (R 4.2.0)
 pkgbuild       1.4.0    2022-11-27 [1] CRAN (R 4.2.0)
 pkgconfig      2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
 pkgload        1.3.2    2022-11-16 [1] CRAN (R 4.2.0)
 plyr           1.8.8    2022-11-11 [1] CRAN (R 4.2.0)
 png            0.1-8    2022-11-29 [1] CRAN (R 4.2.0)
 prettyunits    1.1.1    2020-01-24 [1] CRAN (R 4.2.0)
 processx       3.8.0    2022-10-26 [1] CRAN (R 4.2.0)
 profvis        0.3.7    2020-11-02 [1] CRAN (R 4.2.0)
 promises       1.2.0.1  2021-02-11 [1] CRAN (R 4.2.0)
 ps             1.7.2    2022-10-26 [1] CRAN (R 4.2.0)
 psych          2.2.9    2022-09-29 [1] CRAN (R 4.2.0)
 purrr          1.0.1    2023-01-10 [1] CRAN (R 4.2.0)
 qgraph         1.9.3    2022-12-09 [1] CRAN (R 4.2.0)
 quadprog       1.5-8    2019-11-20 [1] CRAN (R 4.2.0)
 R6             2.5.1    2021-08-19 [1] CRAN (R 4.2.0)
 radiator       1.2.5    2023-01-26 [1] Github (thierrygosselin/radiator@430ef84)
 RColorBrewer   1.1-3    2022-04-03 [1] CRAN (R 4.2.0)
 Rcpp           1.0.10   2023-01-22 [1] CRAN (R 4.2.0)
 readr          2.1.3    2022-10-01 [1] CRAN (R 4.2.0)
 remotes        2.4.2    2021-11-30 [1] CRAN (R 4.2.0)
 reshape2       1.4.4    2020-04-09 [1] CRAN (R 4.2.0)
 rlang          1.0.6    2022-09-24 [1] CRAN (R 4.2.0)
 rmarkdown      2.20     2023-01-19 [1] CRAN (R 4.2.0)
 rpart          4.1.19   2022-10-21 [1] CRAN (R 4.2.2)
 rstudioapi     0.14     2022-08-22 [1] CRAN (R 4.2.0)
 rvest          1.0.3    2022-08-19 [1] CRAN (R 4.2.0)
 scales         1.2.1    2022-08-20 [1] CRAN (R 4.2.0)
 seqinr         4.2-23   2022-11-28 [1] CRAN (R 4.2.0)
 sessioninfo    1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
 shiny          1.7.4    2022-12-15 [1] CRAN (R 4.2.0)
 stockR         1.0.74   2020-03-04 [1] CRAN (R 4.2.0)
 strataG        2.4.905  2020-02-28 [1] CRAN (R 4.2.2)
 stringi        1.7.12   2023-01-11 [1] CRAN (R 4.2.0)
 stringr        1.5.0    2022-12-02 [1] CRAN (R 4.2.0)
 survival       3.5-0    2023-01-09 [1] CRAN (R 4.2.0)
 svglite        2.1.1    2023-01-10 [1] CRAN (R 4.2.0)
 systemfonts    1.0.4    2022-02-11 [1] CRAN (R 4.2.0)
 tibble         3.1.8    2022-07-22 [1] CRAN (R 4.2.0)
 tidyselect     1.2.0    2022-10-10 [1] CRAN (R 4.2.0)
 tzdb           0.3.0    2022-03-28 [1] CRAN (R 4.2.0)
 urlchecker     1.0.1    2021-11-30 [1] CRAN (R 4.2.0)
 usethis        2.1.6    2022-05-25 [1] CRAN (R 4.2.0)
 utf8           1.2.3    2023-01-31 [1] CRAN (R 4.2.2)
 vctrs          0.5.2    2023-01-23 [1] CRAN (R 4.2.0)
 vegan          2.6-4    2022-10-11 [1] CRAN (R 4.2.0)
 viridisLite    0.4.1    2022-08-22 [1] CRAN (R 4.2.0)
 webshot        0.5.4    2022-09-26 [1] CRAN (R 4.2.0)
 wesanderson    0.3.6    2018-04-20 [1] CRAN (R 4.2.0)
 xfun           0.37     2023-01-31 [1] CRAN (R 4.2.2)
 xml2           1.3.3    2021-11-30 [1] CRAN (R 4.2.0)
 xtable         1.8-4    2019-04-21 [1] CRAN (R 4.2.0)

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

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────