Simulation parameters
Container for global simulation parameters. Saving this object as SP will allow it to be accessed by function defaults.
nThreadsnumber of threads used on platforms with OpenMP support
snpChipslist of SNP chips
invalidQtllist of segregating sites that aren't valid QTL
invalidSnplist of segregating sites that aren't valid SNP
founderPopfounder population used for variance scaling
finalizePopfunction applied to newly created populations. Currently does nothing and should only be changed by expert users.
vthe crossover interference parameter for a gamma model of recombination. A value of 1 indicates no crossover interference (e.g. Haldane mapping function). A value of 2.6 approximates the degree of crossover interference implied by the Kosambi mapping function. (default is 1)
quadProbthe probability of quadrivalent pairing in an autopolyploid. (default is 0)
traitslist of traits
nChrnumber of chromosomes
nTraitsnumber of traits
nSnpChipsnumber of SNP chips
segSitessegregating sites per chromosome
sexessexes used for mating
sepMapare there seperate genetic maps for males and females
genMap"matrix" of chromosome genetic maps
femaleMap"matrix" of chromosome genetic maps for females
maleMap"matrix" of chromosome genetic maps for males
centromereposition of centromeres genetic map
femaleCentromereposition of centromeres on female genetic map
maleCentromereposition of centromeres on male genetic map
lastIdlast ID number assigned
isTrackPedis pedigree being tracked
pedigreepedigree matrix for all individuals
isTrackRecis recombination being tracked
recHistlist of historic recombination events
varAadditive genetic variance in founderPop
varGtotal genetic variance in founderPop
varEdefault error variance
versionthe version of AlphaSimR used to generate this object
new()
Starts the process of building a new simulation by creating a new SimParam object and assigning a founder population to the class. It is recommended that you save the object with the name "SP", because subsequent functions will check your global enviroment for an object of this name if their simParam arguments are NULL. This allows you to call these functions without explicitly supplying a simParam argument with every call.
SimParam$new(founderPop)
founderPopan object of MapPop-class
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop)
setTrackPed()
Sets pedigree tracking for the simulation.
By default pedigree tracking is turned off. When turned on,
the pedigree of all individuals created will be tracked,
except those created by hybridCross. Turning
off pedigree tracking will turn off recombination tracking
if it is turned on.
SimParam$setTrackPed(isTrackPed, force = FALSE)
isTrackPedshould pedigree tracking be on.
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$setTrackPed(TRUE)
setTrackRec()
Sets recombination tracking for the simulation.
By default recombination tracking is turned off. When turned
on recombination tracking will also turn on pedigree tracking.
Recombination tracking keeps records of all individuals created,
except those created by hybridCross, because their
pedigree is not tracked.
SimParam$setTrackRec(isTrackRec, force = FALSE)
isTrackRecshould recombination tracking be on.
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$setTrackRec(TRUE)
resetPed()
Resets the internal lastId, the pedigree and recombination tracking (if in use) to the supplied lastId. Be careful using this function because it may introduce a bug if you use individuals from the deleted portion of the pedigree.
SimParam$resetPed(lastId = 0L)
lastIdlast ID to include in pedigree
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) #Create population pop = newPop(founderPop, simParam=SP) pop@id # 1:10 #Create another population after reseting pedigree SP$resetPed() pop2 = newPop(founderPop, simParam=SP) pop2@id # 1:10
restrSegSites()
Sets restrictions on which segregating sites can serve as SNP and/or QTL.
SimParam$restrSegSites( minQtlPerChr = NULL, minSnpPerChr = NULL, overlap = FALSE, minSnpFreq = NULL )
minQtlPerChrthe minimum number of segSites for QTLs. Can be a single value or a vector values for each chromosome.
minSnpPerChrthe minimum number of segSites for SNPs. Can be a single value or a vector values for each chromosome.
overlapshould SNP and QTL sites be allowed to overlap.
minSnpFreqminimum allowable frequency for SNP loci. No minimum SNP frequency is used if value is NULL.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$restrSegSites(minQtlPerChr=5, minSnpPerChr=5)
setSexes()
Changes how sexes are determined in the simulation. The default sexes is "no", indicating all individuals are hermaphrodites. To add sexes to the simulation, run this function with "yes_sys" or "yes_rand". The value "yes_sys" will systematically assign sexes to newly created individuals as first male and then female. Populations with an odd number of individuals will have one more male than female. The value "yes_rand" will randomly assign a sex to each individual.
SimParam$setSexes(sexes, force = FALSE)
sexesacceptable value are "no", "yes_sys", or "yes_rand"
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$setSexes("yes_sys")
addSnpChip()
Randomly assigns eligble SNPs to a SNP chip
SimParam$addSnpChip(nSnpPerChr, minSnpFreq = NULL, refPop = NULL)
nSnpPerChrnumber of SNPs per chromosome. Can be a single value or nChr values.
minSnpFreqminimum allowable frequency for SNP loci. If NULL, no minimum frequency is used.
refPopreference population for calculating SNP frequency. If NULL, the founder population is used.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addSnpChip(10)
addStructuredSnpChip()
Randomly selects the number of snps in structure and then assigns them to chips based on structure
SimParam$addStructuredSnpChip(nSnpPerChr, structure, force = FALSE)
nSnpPerChrnumber of SNPs per chromosome. Can be a single value or nChr values.
structurea matrix. Rows are snp chips, columns are chips. If value is true then that snp is on that chip.
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
addTraitA()
Randomly assigns eligble QTLs for one or more additive traits. If simulating more than one trait, all traits will be pleiotrophic with correlated additive effects.
SimParam$addTraitA( nQtlPerChr, mean = 0, var = 1, corA = NULL, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
corAa matrix of correlations between additive effects
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitA(10)
addTraitAD()
Randomly assigns eligble QTLs for one or more traits with dominance. If simulating more than one trait, all traits will be pleiotrophic with correlated effects.
SimParam$addTraitAD( nQtlPerChr, mean = 0, var = 1, meanDD = 0, varDD = 0, corA = NULL, corDD = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
meanDDmean dominance degree
varDDvariance of dominance degree
corAa matrix of correlations between additive effects
corDDa matrix of correlations between dominance degrees
useVarAtune according to additive genetic variance if true. If FALSE, tuning is performed according to total genetic variance.
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitAD(10, meanDD=0.5)
addTraitAG()
Randomly assigns eligble QTLs for one ore more additive GxE traits. If simulating more than one trait, all traits will be pleiotrophic with correlated effects.
SimParam$addTraitAG( nQtlPerChr, mean = 0, var = 1, varGxE = 1e-06, varEnv = 0, corA = NULL, corGxE = NULL, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
varGxEa vector of total genotype-by-environment variances for the traits
varEnva vector of environmental variances for one or more traits
corAa matrix of correlations between additive effects
corGxEa matrix of correlations between GxE effects
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitAG(10, varGxE=2)
addTraitADG()
Randomly assigns eligble QTLs for a trait with dominance and GxE.
SimParam$addTraitADG( nQtlPerChr, mean = 0, var = 1, varEnv = 1e-06, varGxE = 1e-06, meanDD = 0, varDD = 0, corA = NULL, corDD = NULL, corGxE = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
varEnva vector of environmental variances for one or more traits
varGxEa vector of total genotype-by-environment variances for the traits
meanDDmean dominance degree
varDDvariance of dominance degree
corAa matrix of correlations between additive effects
corDDa matrix of correlations between dominance degrees
corGxEa matrix of correlations between GxE effects
useVarAtune according to additive genetic variance if true
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitADG(10, meanDD=0.5, varGxE=2)
addTraitAE()
Randomly assigns eligble QTLs for one or more additive and epistasis traits. If simulating more than one trait, all traits will be pleiotrophic with correlated additive effects.
SimParam$addTraitAE( nQtlPerChr, mean = 0, var = 1, relAA = 0, corA = NULL, corAA = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
relAAthe relative value of additive-by-additive variance compared to additive variance in a diploid organism with allele frequency 0.5
corAa matrix of correlations between additive effects
corAAa matrix of correlations between additive-by-additive effects
useVarAtune according to additive genetic variance if true. If FALSE, tuning is performed according to total genetic variance.
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
addTraitADE()
Randomly assigns eligble QTLs for one or more traits with dominance and epistasis. If simulating more than one trait, all traits will be pleiotrophic with correlated effects.
SimParam$addTraitADE( nQtlPerChr, mean = 0, var = 1, meanDD = 0, varDD = 0, relAA = 0, corA = NULL, corDD = NULL, corAA = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
meanDDmean dominance degree
varDDvariance of dominance degree
relAAthe relative value of additive-by-additive variance compared to additive variance in a diploid organism with allele frequency 0.5
corAa matrix of correlations between additive effects
corDDa matrix of correlations between dominance degrees
corAAa matrix of correlations between additive-by-additive effects
useVarAtune according to additive genetic variance if true. If FALSE, tuning is performed according to total genetic variance.
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitADE(10)
addTraitAEG()
Randomly assigns eligble QTLs for one or more additive and epistasis GxE traits. If simulating more than one trait, all traits will be pleiotrophic with correlated effects.
SimParam$addTraitAEG( nQtlPerChr, mean = 0, var = 1, relAA = 0, varGxE = 1e-06, varEnv = 0, corA = NULL, corAA = NULL, corGxE = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
relAAthe relative value of additive-by-additive variance compared to additive variance in a diploid organism with allele frequency 0.5
varGxEa vector of total genotype-by-environment variances for the traits
varEnva vector of environmental variances for one or more traits
corAa matrix of correlations between additive effects
corAAa matrix of correlations between additive-by-additive effects
corGxEa matrix of correlations between GxE effects
useVarAtune according to additive genetic variance if true. If FALSE, tuning is performed according to total genetic variance.
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitAEG(10, varGxE=2)
addTraitADEG()
Randomly assigns eligble QTLs for a trait with dominance, epistasis and GxE.
SimParam$addTraitADEG( nQtlPerChr, mean = 0, var = 1, varEnv = 1e-06, varGxE = 1e-06, meanDD = 0, varDD = 0, relAA = 0, corA = NULL, corDD = NULL, corAA = NULL, corGxE = NULL, useVarA = TRUE, gamma = FALSE, shape = 1, force = FALSE )
nQtlPerChrnumber of QTLs per chromosome. Can be a single value or nChr values.
meana vector of desired mean genetic values for one or more traits
vara vector of desired genetic variances for one or more traits
varEnva vector of environmental variances for one or more traits
varGxEa vector of total genotype-by-environment variances for the traits
meanDDmean dominance degree
varDDvariance of dominance degree
relAAthe relative value of additive-by-additive variance compared to additive variance in a diploid organism with allele frequency 0.5
corAa matrix of correlations between additive effects
corDDa matrix of correlations between dominance degrees
corAAa matrix of correlations between additive-by-additive effects
corGxEa matrix of correlations between GxE effects
useVarAtune according to additive genetic variance if true
gammashould a gamma distribution be used instead of normal
shapethe shape parameter for the gamma distribution
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing.
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitADEG(10, meanDD=0.5, varGxE=2)
manAddTrait()
Manually add a new trait to the simulation.
SimParam$manAddTrait(lociMap, varE = NA_real_, force = FALSE)
lociMapa new object descended from
LociMap-class
varEdefault error variance for phenotype, optional
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing
switchTrait()
Switch a trait in the simulation.
SimParam$switchTrait(traitPos, lociMap, varE = NA_real_, force = FALSE)
traitPosan integer indicate which trait to switch
lociMapa new object descended from
LociMap-class
varEdefault error variance for phenotype, optional
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing
removeTrait()
Remove a trait from the simulation
SimParam$removeTrait(traits, force = FALSE)
traitsan integer vector indicating which traits to remove
forceshould the check for a running simulation be ignored. Only set to TRUE if you know what you are doing
setVarE()
Defines a default value for error variances in the simulation.
SimParam$setVarE(h2 = NULL, H2 = NULL, varE = NULL)
h2a vector of desired narrow-sense heritabilities
H2a vector of desired broad-sense heritabilities
varEa vector or matrix of error variances
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitA(10) SP$setVarE(h2=0.5)
setCorE()
Defines a correlation structure for default
error variances. You must call setVarE first to define
the default error variances.
SimParam$setCorE(corE)
corEa correlation matrix for the error variances
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitA(10, mean=c(0,0), var=c(1,1), corA=diag(2)) SP$setVarE(varE=c(1,1)) E = 0.5*diag(2)+0.5 #Positively correlated error SP$setCorE(E)
rescaleTraits()
Linearly scales all traits to achieve desired values of means and variances in the founder population.
SimParam$rescaleTraits( mean = 0, var = 1, varEnv = 0, varGxE = 1e-06, useVarA = TRUE )
meana vector of new trait means
vara vector of new trait variances
varEnva vector of new environmental variances
varGxEa vector of new GxE variances
useVarAtune according to additive genetic variance if true
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$addTraitA(10) #Create population pop = newPop(founderPop, simParam=SP) meanG(pop) #Change mean to 1 SP$rescaleTraits(mean=1) #Run resetPop for change to take effect pop = resetPop(pop, simParam=SP) meanG(pop)
setRecombRatio()
Set the relative recombination rates between males and females. This allows for sex-specific recombination rates, under the assumption of equivalent recombination landscapes.
SimParam$setRecombRatio(femaleRatio)
femaleRatiorelative ratio of recombination in females compared to males. A value of 2 indicate twice as much recombination in females. The value must be greater than 0. (default is 1)
#Create founder haplotypes founderPop = quickHaplo(nInd=10, nChr=1, segSites=10) #Set simulation parameters SP = SimParam$new(founderPop) SP$setRecombRatio(2) #Twice as much recombination in females
switchGenMap()
Replaces existing genetic map.
SimParam$switchGenMap(genMap, centromere = NULL)
genMapa list of length nChr containing numeric vectors for the position of each segregating site on a chromosome.
centromerea numeric vector of centromere positions. If NULL, the centromere are assumed to be metacentric.
switchFemaleMap()
Replaces existing female genetic map.
SimParam$switchFemaleMap(genMap, centromere = NULL)
genMapa list of length nChr containing numeric vectors for the position of each segregating site on a chromosome.
centromerea numeric vector of centromere positions. If NULL, the centromere are assumed to be metacentric.
switchMaleMap()
Replaces existing male genetic map.
SimParam$switchMaleMap(genMap, centromere = NULL)
genMapa list of length nChr containing numeric vectors for the position of each segregating site on a chromosome.
centromerea numeric vector of centromere positions. If NULL, the centromere are assumed to be metacentric.
addToRec()
For internal use only.
SimParam$addToRec(hist)
histnew recombination history
updateLastId()
For internal use only.
SimParam$updateLastId(lastId)
lastIdlast ID assigned
addToPed()
For internal use only.
SimParam$addToPed(lastId, mother, father, isDH)
lastIdID of last individual
mothervector of mother IDs
fathervector of father IDs
isDHvector of DH indicators
clone()
The objects of this class are cloneable with this method.
SimParam$clone(deep = FALSE)
deepWhether to make a deep clone.
By default the founder population is the population used to
initalize the SimParam object. This population can be changed by
replacing the population in the founderPop slot. You must run
resetPop on any existing populations to obtain the
new trait values.
## ------------------------------------------------
## Method `SimParam$new`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
## ------------------------------------------------
## Method `SimParam$setTrackPed`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$setTrackPed(TRUE)
## ------------------------------------------------
## Method `SimParam$setTrackRec`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$setTrackRec(TRUE)
## ------------------------------------------------
## Method `SimParam$resetPed`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
#Create population
pop = newPop(founderPop, simParam=SP)
pop@id # 1:10
#Create another population after reseting pedigree
SP$resetPed()
pop2 = newPop(founderPop, simParam=SP)
pop2@id # 1:10
## ------------------------------------------------
## Method `SimParam$restrSegSites`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$restrSegSites(minQtlPerChr=5, minSnpPerChr=5)
## ------------------------------------------------
## Method `SimParam$setSexes`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$setSexes("yes_sys")
## ------------------------------------------------
## Method `SimParam$addSnpChip`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addSnpChip(10)
## ------------------------------------------------
## Method `SimParam$addTraitA`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10)
## ------------------------------------------------
## Method `SimParam$addTraitAD`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitAD(10, meanDD=0.5)
## ------------------------------------------------
## Method `SimParam$addTraitAG`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitAG(10, varGxE=2)
## ------------------------------------------------
## Method `SimParam$addTraitADG`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitADG(10, meanDD=0.5, varGxE=2)
## ------------------------------------------------
## Method `SimParam$addTraitAE`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
## ------------------------------------------------
## Method `SimParam$addTraitADE`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitADE(10)
## ------------------------------------------------
## Method `SimParam$addTraitAEG`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitAEG(10, varGxE=2)
## ------------------------------------------------
## Method `SimParam$addTraitADEG`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitADEG(10, meanDD=0.5, varGxE=2)
## ------------------------------------------------
## Method `SimParam$setVarE`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10)
SP$setVarE(h2=0.5)
## ------------------------------------------------
## Method `SimParam$setCorE`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10, mean=c(0,0), var=c(1,1), corA=diag(2))
SP$setVarE(varE=c(1,1))
E = 0.5*diag(2)+0.5 #Positively correlated error
SP$setCorE(E)
## ------------------------------------------------
## Method `SimParam$rescaleTraits`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10)
#Create population
pop = newPop(founderPop, simParam=SP)
meanG(pop)
#Change mean to 1
SP$rescaleTraits(mean=1)
#Run resetPop for change to take effect
pop = resetPop(pop, simParam=SP)
meanG(pop)
## ------------------------------------------------
## Method `SimParam$setRecombRatio`
## ------------------------------------------------
#Create founder haplotypes
founderPop = quickHaplo(nInd=10, nChr=1, segSites=10)
#Set simulation parameters
SP = SimParam$new(founderPop)
SP$setRecombRatio(2) #Twice as much recombination in femalesPlease choose more modern alternatives, such as Google Chrome or Mozilla Firefox.