recombine: Simulate recombination (crossovers or non-crossovers) along a...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/simulate.R

Description

This function simulates recombination between two parent chromosomes generated from class parent.genomes.

Usage

1
2
recombine(parents, r.index, mu.rate = 0, f.cross = 0.5, f.convert = 0,
  length.conversion = 20)

Arguments

parents

an object of class parent.genomes specifying the parental ancestry at each simulated snp.

r.index

a vector of length snps-1 specifying whether a recombination is to be simulated (1) or not (0) in between two adjacent snps.

mu.rate

a numeric between 0 and 1 (inclusive) specifying the per snp mutation rate.

f.cross

a numeric between 0 and 1 (inclusive) giving the frequency of recombination events that result in crossing over. This is same as 1 minus the frequency of non-crossovers.

f.convert

a numeric between 0 and 1 (inclusive) that gives the frequency of gene conversion during recombination.

length.conversion

an integer specifying the mean (and variance) of a given gene conversion tract (in bps).

Details

This function simulates crossover events (with or without gene conversions) and non-crossover events given the parental snps and location of recombination events. First, parental chromosomes are duplicated into 2 pairs of sister chromatids. During this step mutations occur at rate mu.rate that switch parental alleles. Second, recombination is simulated by systematically going down the length of the chromosome. At recombination points, idenitfied in r.index, two non-sister chromatids are picked at random. Third, a CO or NCO is simulated; this is done at a frequency of f.cross or 1-f.cross, respectively. If a CO occurs, the genotypes of the 3' end of the non-sister chromatids are simply switched. If a NCO occurs, no such switch takes place. Note that is is impossible to detect NCO events without an associated gene conversion tract. Following every CO or NCO event gene conversion is simulated at a rate of f.convert. During a gene conversion, one of the two unpicked chromatids' genotypes are switched. The length of the gene conversion tract is sampled from a poission distribution with mean (variance) of length.conversion. Note that the gene conversion tract will stop at the end of the chromosme if necessary.

Value

an object of class recombine that contains the following data:

Author(s)

Tyler D. Hether

See Also

recombine_index

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(1234567)        # For reproducibility
l <- 50                  # number of snps to simulate
c <- 3e-05               # recombination rate between snps (Morgan/bp)
snps <- c(1:l)*1e4       # snps are evenly spaced 10kbp apart
p <- make_parents(snps)  # make the parents
#
# The recombination indeces are:
r_points <- recombine_index(scale=c, snps=snps)
#
# Now recombine the parents:
recomb_sim <- recombine(parents=p, r.index=r_points, mu.rate=1e-05,
	f.cross=0.6, f.convert=0.2, length.conversion=15000)
recomb_sim

tylerhether/HMMancestry documentation built on May 3, 2019, 1:53 p.m.