sim_family_cb: Simulate multiple families from a crossing block

View source: R/sim_family.R

sim_family_cbR Documentation

Simulate multiple families from a crossing block

Description

Simulate multiple families from a crossing block

Usage

sim_family_cb(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. May be a single pedigree object or (in the case of different family sizes) a list of length nrow(crossing.block).

founder.pop

An object of class pop with the geno information for the parents. Additional individuals can be present, but 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 (for 2-way crosses) or 4 columns (for 4-way crosses). See sim_crossing.block.

...

Additional arguments passed to sim_family.

Value

An object of class pop with the information for all individuals in the families specified by the crossing block.

Examples


# Simulate a genome
n.mar  <- rep(500, 7)
len <- runif(n = 7, min = 140, 170)

genome <- sim_genome(len, n.mar)

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

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

## 2-way population

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

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

# Simulate a group of families from the crossing block
fam_cb <- sim_family_cb(genome = genome, pedigree = ped, founder.pop = founder.pop, 
                        crossing.block = cb)
                        
# Create a bi-parental pedigree with 100 individuals selfed to the F_3 generation
ped <- sim_pedigree(n.par = 2, n.ind = 100, n.selfgen = 5)
                        
# Create many F_6 families, genotyped at the F_3
fam_cb <- sim_family_cb(genome = genome, pedigree = ped, founder.pop = founder.pop, 
                        crossing.block = cb, marker.gen = 2)

                        
## 4-way population

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

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

# Simulate a group of families from the crossing block
fam_cb <- sim_family_cb(genome = genome, pedigree = ped, founder.pop = founder.pop, 
                        crossing.block = cb)
                        
## Simulate RIL familes of different sizes

# Generate a crossing block with 5 crosses
cb <- sim_crossing_block(parents = indnames(founder.pop), n.crosses = 5, type = "2way")
# Number of individuals per cross
nIndCross <- c(20, 30, 40, 50, 60)

# Create a list of pedigrees
pedList <- sapply(nIndCross, sim_pedigree, n.par = 2, simplify = FALSE)

# Simulate a group of families from the crossing block
fam_cb <- sim_family_cb(genome = genome, pedigree = pedList, founder.pop = founder.pop, 
                        crossing.block = cb)




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