Skip to content

Commit

Permalink
second round of example fixes for SimParam
Browse files Browse the repository at this point in the history
  • Loading branch information
gaynorr committed Oct 31, 2023
1 parent 7d64504 commit 3ada1fb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: AlphaSimR
Type: Package
Title: Breeding Program Simulations
Version: 1.5.1
Version: 1.5.2
Date: 2023-10-31
Authors@R: c(person("Chris", "Gaynor", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0558-6656")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# AlphaSimR 1.5.2

*fix SimParam examples for CRAN

# AlphaSimR 1.5.1

*deleted bad example code for `setMisc`
Expand Down
8 changes: 8 additions & 0 deletions R/Class-SimParam.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$setTrackPed(TRUE)
setTrackPed = function(isTrackPed, force=FALSE){
stopifnot(is.logical(isTrackPed))
Expand Down Expand Up @@ -140,6 +141,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$setTrackRec(TRUE)
setTrackRec = function(isTrackRec, force=FALSE){
stopifnot(is.logical(isTrackRec))
Expand Down Expand Up @@ -167,6 +169,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#'
#' #Create population
#' pop = newPop(founderPop, simParam=SP)
Expand Down Expand Up @@ -206,6 +209,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$restrSegSites(minQtlPerChr=5, minSnpPerChr=5)
restrSegSites = function(minQtlPerChr=NULL, minSnpPerChr=NULL, excludeQtl=NULL,
excludeSnp=NULL, overlap=FALSE, minSnpFreq=NULL){
Expand Down Expand Up @@ -299,6 +303,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$setSexes("yes_sys")
setSexes = function(sexes, force=FALSE){
if(!force){
Expand Down Expand Up @@ -346,6 +351,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$addSnpChip(10)
addSnpChip = function(nSnpPerChr, minSnpFreq=NULL, refPop=NULL, name=NULL){
if(length(nSnpPerChr)==1){
Expand Down Expand Up @@ -1299,6 +1305,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$addTraitADEG(10, meanDD=0.5, varGxE=2)
addTraitADEG = function(nQtlPerChr,mean=0,var=1,varEnv=0,
varGxE=1e-6,meanDD=0,varDD=0,relAA=0,corA=NULL,
Expand Down Expand Up @@ -1857,6 +1864,7 @@ SimParam = R6Class(
#'
#' #Set simulation parameters
#' SP = SimParam$new(founderPop)
#' \dontshow{SP$nThreads = 1L}
#' SP$setRecombRatio(2) #Twice as much recombination in females
setRecombRatio = function(femaleRatio){
stopifnot(femaleRatio>0)
Expand Down
16 changes: 16 additions & 0 deletions man/SimParam.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vignettes/intro.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ founderPop = quickHaplo(nInd=1000, nChr=10, segSites=1000)

# Setting Simulation Parameters
SP = SimParam$new(founderPop)

## ----include=FALSE------------------------------------------------------------
SP$nThreads = 1L

## -----------------------------------------------------------------------------
SP$addTraitA(nQtlPerChr=1000)
SP$setSexes("yes_sys")

Expand Down

0 comments on commit 3ada1fb

Please sign in to comment.