calc_exp_genvar: Calculate the expected genetic variance in simulated families

View source: R/family_genetic_variance.R

calc_exp_genvarR Documentation

Calculate the expected genetic variance in simulated families

Description

Calculates the expected genetic variance of a cross, assuming complete selfing.

Usage

calc_exp_genvar(genome, pedigree, founder.pop, crossing.block)

Arguments

genome

An object of class genome.

pedigree

A pedigree detailing the scheme to develop the family. Use sim_pedigree to generate.

founder.pop

An object of class pop with the geno information for the parents. Additional individuals can be present in parent_pop. They will be filtered according to the parents in the crossing.block.

crossing.block

A crossing block detailing the crosses to make. Must be a data.frame with 2 columns: the first gives the name of parent 1, and the second gives the name of parent 2. See sim_crossing.block.

Examples


# Simulate a genome
n.mar  <- c(505, 505, 505)
len <- c(120, 130, 140)

genome <- sim_genome(len, n.mar)

# Simulate a quantitative trait influenced by 50 QTL
qtl.model <- matrix(NA, 50, 4)
genome <- sim_gen_model(genome = genome, qtl.model = qtl.model, 
                        add.dist = "geometric", max.qtl = 50)

# Simulate the genotypes for 8 founders
founder.pop <- sim_founders(genome = genome, n.str = 8)

# Generate a crossing block with 5 crosses
cb <- sim_crossing_block(parents = indnames(founder.pop), n.crosses = 5)

# Create a pedigree with 100 individuals selfed to the F_3 generation
ped <- sim_pedigree(n.par = 2, n.ind = 100, n.selfgen = 2)

calc_exp_genvar(genome = genome, pedigree = ped, founder.pop = founder.pop, 
                crossing.block = cb)
                

## If two traits are present, the genetic correlation is calculated
# Simulate two quantitative traits influenced by 50 pleiotropic QTL
qtl.model <- replicate(2, matrix(NA, 50, 4), simplify = FALSE)
genome <- sim_multi_gen_model(genome = genome, qtl.model = qtl.model, corr = 0.99, 
                              prob.corr = cbind(0, 1), add.dist = "normal")

# Simulate the genotypes for 8 founders
founder.pop <- sim_founders(genome = genome, n.str = 8)

calc_exp_genvar(genome = genome, pedigree = ped, founder.pop = founder.pop, 
                crossing.block = cb)




neyhartj/pbsim documentation built on Nov. 11, 2023, 4:07 p.m.