christianparobek / skeleSim

Null models, performance testing, and power estimation with population simulations
3 stars 6 forks source link

need help rmetasim simulation (stopped at HWE test) #69

Closed paiklinsawat closed 6 years ago

paiklinsawat commented 6 years ago

I've encountered a problem when trying to simulate using genotype data (9 microsatellite loci) with rmetasim v3.1.5 with skeleSim v0.9.5 and R 3.4.1. I'm currently using a Window 7 OS.

Once I've loaded the input.rdata and "ssClass <- runSim(ssClass)", then the simulation stopped at the HWE test "[1] "HWE tests started" Error in pop(x) : could not find function "pop"

When I switched to skeleSimGUI(), it seemed that the simulation couldn't carry out because there is no output generated. This problem also occurred once I used MacOS Sierra and R3.4.2 for the GUI(). Thank you very much for your help.

EricArcher commented 6 years ago

Would you print out the result of sessionInfo()?

paiklinsawat commented 6 years ago

Dear Eric,

Here is the print out of sessionInfo()

sessionInfo()

R version 3.4.1 (2017-06-30)

Platform: x86_64-pc-linux-gnu (64-bit)

Running under: Ubuntu 16.04.2 LTS

Matrix products: default

BLAS: /usr/lib/libblas/libblas.so.3.6.0

LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:

[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C

[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8

[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8

[7] LC_PAPER=en_US.UTF-8 LC_NAME=C

[9] LC_ADDRESS=C LC_TELEPHONE=C

[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] skeleSim_0.9.5 shinyFiles_0.6.2 shiny_1.0.5 igraph_1.1.2

[5] rmetasim_3.1.5

loaded via a namespace (and not attached):

[1] nlme_3.1-124 hierfstat_0.04-22 gmodels_2.16.2

[4] RColorBrewer_1.1-2 numDeriv_2016.8-1 tools_3.4.1

[7] backports_1.1.1 R6_2.2.2 vegan_2.4-4

[10] DT_0.2 rpart_4.1-10 Hmisc_4.0-3

[13] lazyeval_0.2.1 mgcv_1.8-11 colorspace_1.3-2

[16] permute_0.9-4 ade4_1.7-8 nnet_7.3-12

[19] sp_1.2-5 gridExtra_2.3 phangorn_2.2.0

[22] compiler_3.4.1 pspline_1.0-18 htmlTable_1.9

[25] expm_0.999-2 strataG_2.0.2 scales_0.5.0

[28] checkmate_1.8.4 mvtnorm_1.0-6 quadprog_1.5-5

[31] goftest_1.1-1 spatstat_1.52-1 stringr_1.2.0

[34] digest_0.6.12 spatstat.utils_1.7-1 foreign_0.8-66

[37] base64enc_0.1-3 pkgconfig_2.0.1 htmltools_0.3.6

[40] pegas_0.10 maps_3.2.0 stabledist_0.7-1

[43] ADGofTest_0.3 htmlwidgets_0.9 rlang_0.1.4

[46] bindr_0.1 gtools_3.5.0 acepack_1.4.1

[49] spdep_0.6-15 dplyr_0.7.4 magrittr_1.5

[52] Formula_1.2-2 apex_1.0.3 Matrix_1.2-3

[55] Rcpp_0.12.13 munsell_0.4.3 abind_1.4-5

[58] ape_5.0 stringi_1.1.5 MASS_7.3-45

[61] RJSONIO_1.3-0 plyr_1.8.4 grid_3.4.1

[64] parallel_3.4.1 gdata_2.18.0 adegenet_2.1.1

[67] deldir_0.1-14 lattice_0.20-33 splines_3.4.1

[70] tensor_1.5 knitr_1.17 swfscMisc_1.2

[73] boot_1.3-17 seqinr_3.4-5 markdown_0.8

[76] reshape2_1.4.2 stats4_3.4.1 fastmatch_1.1-0

[79] LearnBayes_2.15 glue_1.2.0 latticeExtra_0.6-28

[82] mapdata_2.2-6 data.table_1.10.4 httpuv_1.3.5

[85] polyclip_1.6-1 gtable_0.2.0 assertthat_0.2.0

[88] ggplot2_2.2.1 mime_0.5 xtable_1.8-2

[91] coda_0.19-1 survival_2.41-3 pcaPP_1.9-72

[94] gsl_1.9-10.3 tibble_1.3.4 copula_0.999-18

[97] bindrcpp_0.2 cluster_2.0.3

Below is the output following runSim(ssClass)

ssClass <- runSim(ssClass)

[1] 1

[1] "microsatellite"

0 1 2 3

112 112 112 112

[1] "simulate for 100 years"

[1] "was able to simulate a rmetasim landscape"

[1] "returned from convert; returning params obj"

Global analysis...

Locus analysis...

[1] "HWE tests started"

Error in pop(x) : could not find function "pop"

Thank you very much for your prompt reply. Best, Pai

EricArcher commented 6 years ago

Would you mind attaching your ssClass object, so I can run some more tests? Thanks!

paiklinsawat commented 6 years ago

Hello Eric,

Here is the ssClass object with the attached input file (t1.rdata) below. t1.rdata.zip

Formal class 'skeleSim.params' [package "skeleSim"] with 25 slots ..@ title : chr "t1" ..@ date : POSIXct[1:1], format: "2017-10-22 07:00:00" ..@ quiet : logi FALSE ..@ question : NULL ..@ simulator.type : chr "f" ..@ simulator : chr "rms" ..@ wd : chr "wdTest" ..@ scenarios :List of 3 .. ..$ :Formal class 'scenario.params' [package "skeleSim"] with 10 slots .. .. .. ..@ num.pops : num 2 .. .. .. ..@ pop.size : int [1:2] 200 250 .. .. .. ..@ sample.size : int [1:2] 49 45 .. .. .. ..@ migration :List of 1 .. .. .. .. ..$ : num [1:2, 1:2] 0 0.02 0.02 0 .. .. .. ..@ mig.helper :List of 5 .. .. .. .. ..$ migModel: chr "island" .. .. .. .. ..$ migRate : num 0.02 .. .. .. .. ..$ rows : num 1 .. .. .. .. ..$ cols : int 1 .. .. .. .. ..$ distfun : chr "dexp" .. .. .. ..@ locus.type : chr "microsatellite" .. .. .. ..@ num.loci : num 9 .. .. .. ..@ sequence.length : num 100 .. .. .. ..@ mut.rate : num [1:9] 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 .. .. .. ..@ simulator.params:Formal class 'rmetasim.params' [package "skeleSim"] with 10 slots .. .. .. .. .. ..@ num.stgs : num 2 .. .. .. .. .. ..@ selfing : num 0 .. .. .. .. .. ..@ surv.matr : num [1:2, 1:2] 0.5 0.2 0.2 0.5 .. .. .. .. .. ..@ repr.matr : int [1:2, 1:2] 0 0 1 0 .. .. .. .. .. ..@ male.matr : int [1:2, 1:2] 0 0 0 1 .. .. .. .. .. ..@ carrying : NULL .. .. .. .. .. ..@ init.pop.sizes: num [1:4] 100 100 100 100 .. .. .. .. .. ..@ num.alleles : num [1:9] 11 9 11 6 14 13 7 13 7 .. .. .. .. .. ..@ allele.freqs :List of 9 .. .. .. .. .. .. ..$ : num [1:11] 0.0053 0.1436 0.117 0.0957 0.0372 ... .. .. .. .. .. .. ..$ : num [1:9] 0.0213 0.0691 0.0745 0.016 0.1968 ... .. .. .. .. .. .. ..$ : num [1:11] 0.0851 0.0319 0.1542 0.25 0.0957 ... .. .. .. .. .. .. ..$ : num [1:6] 0.0319 0.1809 0.234 0.25 0.117 ... .. .. .. .. .. .. ..$ : num [1:14] 0.0532 0.4415 0.0638 0.0585 0.0479 ... .. .. .. .. .. .. ..$ : num [1:13] 0.1329 0.0425 0.0106 0.1436 0.0213 ... .. .. .. .. .. .. ..$ : num [1:7] 0.0372 0.2819 0.2181 0.2926 0.0266 ... .. .. .. .. .. .. ..$ : num [1:13] 0.0957 0.1596 0.1436 0.0053 0.0479 ... .. .. .. .. .. .. ..$ : num [1:7] 0.0053 0.0479 0.3936 0.0957 0.2766 ... .. .. .. .. .. ..@ num.gen : int 100 .. ..$ :Formal class 'scenario.params' [package "skeleSim"] with 10 slots .. .. .. ..@ num.pops : num 2 .. .. .. ..@ pop.size : int [1:2] 200 250 .. .. .. ..@ sample.size : int [1:2] 49 45 .. .. .. ..@ migration :List of 1 .. .. .. .. ..$ : num [1:2, 1:2] 0 0 0 0 .. .. .. ..@ mig.helper :List of 5 .. .. .. .. ..$ migModel: chr "island" .. .. .. .. ..$ migRate : int 0 .. .. .. .. ..$ rows : num 1 .. .. .. .. ..$ cols : int 1 .. .. .. .. ..$ distfun : chr "dexp" .. .. .. ..@ locus.type : chr "microsatellite" .. .. .. ..@ num.loci : num 9 .. .. .. ..@ sequence.length : num 100 .. .. .. ..@ mut.rate : num [1:9] 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 .. .. .. ..@ simulator.params:Formal class 'rmetasim.params' [package "skeleSim"] with 10 slots .. .. .. .. .. ..@ num.stgs : num 2 .. .. .. .. .. ..@ selfing : num 0 .. .. .. .. .. ..@ surv.matr : num [1:2, 1:2] 0.2 0.4 0 0.1 .. .. .. .. .. ..@ repr.matr : num [1:2, 1:2] 0 0 4 0 .. .. .. .. .. ..@ male.matr : num [1:2, 1:2] 0 0 0 1 .. .. .. .. .. ..@ carrying : NULL .. .. .. .. .. ..@ init.pop.sizes: num [1:4] 100 100 100 100 .. .. .. .. .. ..@ num.alleles : num [1:9] 1 1 1 1 1 1 1 1 1 .. .. .. .. .. ..@ allele.freqs :List of 9 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. ..@ num.gen : num 50 .. ..$ :Formal class 'scenario.params' [package "skeleSim"] with 10 slots .. .. .. ..@ num.pops : num 2 .. .. .. ..@ pop.size : int [1:2] 200 250 .. .. .. ..@ sample.size : int [1:2] 49 45 .. .. .. ..@ migration :List of 1 .. .. .. .. ..$ : num [1:2, 1:2] 0 0.04 0.04 0 .. .. .. ..@ mig.helper :List of 5 .. .. .. .. ..$ migModel: chr "island" .. .. .. .. ..$ migRate : num 0.04 .. .. .. .. ..$ rows : num 1 .. .. .. .. ..$ cols : int 1 .. .. .. .. ..$ distfun : chr "dexp" .. .. .. ..@ locus.type : chr "microsatellite" .. .. .. ..@ num.loci : num 9 .. .. .. ..@ sequence.length : num 100 .. .. .. ..@ mut.rate : num [1:9] 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 1e-04 .. .. .. ..@ simulator.params:Formal class 'rmetasim.params' [package "skeleSim"] with 10 slots .. .. .. .. .. ..@ num.stgs : num 2 .. .. .. .. .. ..@ selfing : num 0 .. .. .. .. .. ..@ surv.matr : num [1:2, 1:2] 0.2 0.4 0 0.1 .. .. .. .. .. ..@ repr.matr : int [1:2, 1:2] 0 0 4 0 .. .. .. .. .. ..@ male.matr : int [1:2, 1:2] 0 0 0 1 .. .. .. .. .. ..@ carrying : NULL .. .. .. .. .. ..@ init.pop.sizes: num [1:4] 100 100 100 100 .. .. .. .. .. ..@ num.alleles : num [1:9] 1 1 1 1 1 1 1 1 1 .. .. .. .. .. ..@ allele.freqs :List of 9 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. .. ..$ : num 1 .. .. .. .. .. ..@ num.gen : num 50 ..@ num.sim.reps : num 10 ..@ sim.func :function (params) ..@ current.scenario : num 1 ..@ current.replicate : num 1 ..@ rep.sample : NULL ..@ rep.analysis.func :function (params) ..@ num.perm.reps : num 4 ..@ rep.result : NULL ..@ analysis.results : NULL ..@ sim.summary.func : NULL ..@ summary.results : NULL ..@ sim.check.func :function (params) ..@ sim.scen.checks : NULL ..@ other.checks : NULL ..@ scenario.reps : NULL ..@ analyses.requested: Named logi [1:3] TRUE TRUE TRUE .. ..- attr(*, "names")= chr [1:3] "Global" "Pairwise" "Locus" ..@ timing : NULL

Thank you very much!

EricArcher commented 6 years ago

This has been fixed. The primary error was due to a function not being exported in pegas. There was also a formatting issue in a strataG function. You should re-install strataG, pegas, and skeleSim from GitHub. You will have to rebuild your skeleSim object for the fixes to take effect.