sim_en_masse: Simulate random spores en masse

Description Usage Arguments Value Author(s) See Also Examples

View source: R/simulate.R

Description

This is a wrapper function of many other functions that simulates a given number of haploids each recombinant between two parents. As the name implies, information of the all four products are lost since spores are random. See sim_tetrad if all four haploid recombinants are desired.

Usage

1
2
sim_en_masse(n.spores, scale, snps, p.assign, mu.rate, f.cross, f.convert,
  length.conversion, coverage, chr.name = "I")

Arguments

n.spores

An integer specifying the number of spores to simulate.

p.assign

a numeric between 0 and 1 (inclusive) that gives the probability of correct sequencing assignment. A value of 1 means that no sequencing error or ancestral polymorphism is to be simulated.

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).

chr.name

a numeric or character value specifying the chromosome name (default to "I")

scale

either vector of length 1 specifying the genome-wide recombination rate (Morgans/bp) or a vector of length snps-1 specifying the recombination rate between all snps. In either case rates must be positive.

snps

a vector gving the locations of snps along a chromosome

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.

Value

A data.frame of class en.masse. Each row contains the following information: which contains three elements:

Author(s)

Tyler D. Hether

See Also

recombine, make_parents, simulate_coverage, recombine_index, id_hotspots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Simulating 5 haploid recombinants
set.seed(1234567)        # For reproducibility
n_spores <- 5          # number of tetrads (meiosis events)
l <- 75                  # number of snps to simulate
c <- 3.5e-05             # recombination rate between snps (Morgan/bp)
snps <- c(1:l)*1.3e4     # snps are evenly spaced 20kbp apart
p_a <- 0.95              # assignment probability
coverage <- 2.1          # mean coverage
# Now simulate
sim5 <- sim_en_masse(n.spores=n_spores, scale=c, snps=snps,
	p.assign=p_a, mu.rate=0, f.cross=0.8, f.convert=0.3,
	length.conversion=2e3, coverage=coverage)
sim5

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