Skip to contents

Creates an initial Pop-class from an object of MapPop-class or NamedMapPop-class. The function is intended for use with output from functions such as runMacs, newMapPop, or quickHaplo.

Usage

newPop(rawPop, simParam = NULL, ...)

Arguments

rawPop

an object of MapPop-class or NamedMapPop-class

simParam

an object of SimParam

...

additional arguments used internally

Value

Returns an object of Pop-class

Details

Note that newPop takes genomes from the rawPop and uses them without recombination! Hence, if you call newPop(rawPop = founderGenomes) twice, you will get two sets of individuals with different id but the same genomes. To get genetically different sets of individuals you can subset the rawPop input, say first half for one set and the second half for the other set.

Examples

#Create founder haplotypes
founderPop = quickHaplo(nInd=2, nChr=1, segSites=10)

#Set simulation parameters
SP = SimParam$new(founderPop)
SP$addTraitA(10)

#Create population
pop = newPop(founderPop, simParam=SP)
isPop(pop)
#> [1] TRUE

#Misc
pop@misc$tmp1 = rnorm(n=2)
pop@misc$tmp2 = rnorm(n=2)

#MiscPop
pop@miscPop$tmp1 = sum(pop@misc$tmp1)
pop@miscPop$tmp2 = sum(pop@misc$tmp2)