sim_family: Simulate a family from a pedigree

View source: R/sim_family.R

sim_familyR Documentation

Simulate a family from a pedigree

Description

Simulate a family from a pedigree

Usage

sim_family(
  genome,
  pedigree,
  founder.pop,
  map.function = c("haldane", "kosambi", "c-f", "morgan"),
  ignore.gen.model = FALSE,
  ...
)

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 founders. Use the subset.pop function to subset a pop object.

map.function

The mapping function used to convert genetic distance to recombination fractions. Can be one of "haldane", "kosambi", "c-f", or "morgan".

ignore.gen.model

Logical - should the gene model be ignored?

Details

Other arguments can be passed to internal functions in sim_family:

dh

A logical indicating if double-haploid lines should be created at the end of selfing. Doubled-haploids are generated at the last generation of selfing (e.g. if F_3 individuals are specified in the pedigree, DH lines are induced after the F_2). Currently ignored.

marker.gen

Numeric indicating the selfing generation at which to genotype individuals in the family. For instance, if marker.gen = 2, individuals are genotyped at the F_3 stage. Currently ignored.

m

The crossover interference parameter. See sim_from_pedigree for more information.

p

The proportion of crosses from non-interference process. See sim_from_pedigree for more information.

family.num

A integer designator of the family.

cycle.num

A integer designator of the breeding cycle.

Value

An object of class pop.

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)

## 2-way population

# Simulate the founder genotypes
founder.pop <- sim_founders(genome, pat.freq = c(0, 1))

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

# Create an F_6 family, genotyped at the F_3
ped <- sim_pedigree(n.par = 2, n.ind = 100, n.selfgen = 5)
fam <- sim_family(genome = genome, pedigree = ped, founder.pop = founder.pop,
                  marker.gen = 2)

# Create a pedigree with 100 RIL individuals
ped <- sim_pedigree(n.par = 2, n.ind = 100, n.selfgen = Inf)
fam <- sim_family(genome = genome, pedigree = ped, founder.pop = founder.pop)

# Create a pedigree with 100 doubled-haploid individuals induced after the F_2
# generation.
ped <- sim_pedigree(n.par = 2, n.ind = 100, n.selfgen = 2)
fam <- sim_family(genome = genome, pedigree = ped, founder.pop = founder.pop, dh = TRUE)


## 4-way population

# Simulate founders
founder.pop <- sim_founders(genome, n.str = 4, pat.freq = c(0, 0, 1))

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

# Create a pedigree with 100 RIL individuals
ped <- sim_pedigree(n.par = 4, n.ind = 100, n.selfgen = Inf)
fam <- sim_family(genome = genome, pedigree = ped, founder.pop = founder.pop)

# Create a pedigree with 100 doubled-haploid individuals induced after the F_2
# generation.
ped <- sim_pedigree(n.par = 4, n.ind = 100, n.selfgen = 2)
fam <- sim_family(genome = genome, pedigree = ped, founder.pop = founder.pop, dh = TRUE)


                  

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