Simple Livestock Examples

10 generations of individuals with 20 sires per generation, and 10 dams per sire, 2 offspring per dam with 1:1 male female ratio (1 male 1 female). This leads to 400 individuals at each generation, of which 200 is males and 200 is females. The 20 sires can be either selected randomly (with or without replacement, to allow some sires to be heavily used) or based on some phenotype.

Step 0. Load XSim
using XSim
Step 1. Setup genome and phenome information
build_demo()
[ Info: --------- Genome Summary ---------
[ Info: Number of Chromosome  : 4
[ Info:
[ Info: Chromosome Length (cM): 200.0
[ Info: [55.0, 35.0, 65.0, 45.0]
[ Info:
[ Info: Number of Loci        : 10
[ Info: [2, 3, 3, 2]
[ Info:
[ Info: Genotyping Error      : 0.0
[ Info: Mutation Rate         : 0.0
[ Info:
[ Info: --------- Phenome Summary ---------
[ Info: Number of Traits      : 2
┌ Info:
│   Genetic_Variance =
│    2×2 Array{Float64,2}:
│     1.0  0.5
└     0.5  1.0
[ Info: Number of QTLs        : [2 4]
Step 2. Define breed size
n_sires = 20
n_dams  = 10
Step 3. Initialize sires and dams
sires = Founders(n_sires)
[ Info: Cohort (20 individuals)
[ Info:
[ Info: Mean of breeding values:
[ Info: [-1.818 0.294]
[ Info:
[ Info: Variance of breeding values:
[ Info: [1.569 1.199]
dams  = Founders(n_dams)
[ Info: Cohort (10 individuals)
[ Info:
[ Info: Mean of breeding values:
[ Info: [-2.034 -0.589]
[ Info:
[ Info: Variance of breeding values:
[ Info: [1.527 0.824]
Step 4. Mate
params_mate        = Dict(:n_per_mate       => 2,
                          :ratio_malefemale => 1)
f1_male, f1_female = mate(sires, dams; params_mate...)
[ Info: --------- Mating Summary ---------
[ Info: Generate 400 individuals from 20 shared breeds
[ Info: Every shared breeds mates with 10 breeds
[ Info: And each mating produce 2 progenies
[ Info: 
[ Info: --------- Offsprings Summary ---------
([ Info: Cohort (200 individuals)
[ Info: 
[ Info: Mean of breeding values: 
[ Info: [-1.885 -0.117]
[ Info: 
[ Info: Variance of breeding values: 
[ Info: [1.08 0.89]
, [ Info: Cohort (200 individuals)
[ Info: 
[ Info: Mean of breeding values: 
[ Info: [-1.978 -0.186]
[ Info: 
[ Info: Variance of breeding values: 
[ Info: [1.073 0.751]
)
Step 5. Select
params_select = Dict(:h2 => .8)
f1_sires      = select(f1_male,   n_sires; params_select...)
[ Info: --------- Selection Summary ---------
[ Info: Select 20 individuals out of 200 individuals
[ Info: Selection differential (P): [1.324 1.31]
[ Info: Selection response     (G): [1.152 1.125]
┌ Info: 
│   Residual_Variance =
│    2×2 Array{Float64,2}:
│     0.25  0.0
└     0.0   0.25
[ Info: --------- Offsprings Summary ---------
[ Info: Cohort (20 individuals)
[ Info: 
[ Info: Mean of breeding values: 
[ Info: [-0.363 1.296]
[ Info: 
[ Info: Variance of breeding values: 
[ Info: [0.107 0.318]
f1_dams       = select(f1_female, n_sires; params_select...)
[ Info: --------- Selection Summary ---------
[ Info: Select 20 individuals out of 200 individuals
[ Info: Selection differential (P): [1.49 1.323]
[ Info: Selection response     (G): [1.333 1.05]
┌ Info: 
│   Residual_Variance =
│    2×2 Array{Float64,2}:
│     0.25  0.0
└     0.0   0.25
[ Info: --------- Offsprings Summary ---------
[ Info: Cohort (20 individuals)
[ Info: 
[ Info: Mean of breeding values: 
[ Info: [-0.211 1.422]
[ Info: 
[ Info: Variance of breeding values: 
[ Info: [0.047 0.42]