simulate_coverage: Simulate sequencing across simulated data:

Description Usage Arguments Value Author(s) See Also Examples

View source: R/simulate.R

Description

This function populates simulated data of class recombine with read counts given a specified coverage and assignment probability.

Usage

1
simulate_coverage(simdata, p.assign, coverage)

Arguments

simdata

an object of class recombine

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.

coverage

the mean (and variance) of sequencing read coverage to be simlated. coverage is sampled from a poisson distribution.

Value

an object of class simulated.coverage providing the a list of simulated sequencing reads for each parental type for each of the four haploid recombinants. There are four lists in the output – one for each recombinant. Within each list the read counts for parent 0 and parent 1 are given as well as the snp locations and given (simulated) states.

Author(s)

Tyler D. Hether

See Also

recombine

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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_a <- 0.97              # assignment probability
coverage <- 1            # mean coverage
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)
# And finally simulated read coverage for each haploid recombinant
sim_cov <- simulate_coverage(simdata=recomb_sim,
 p.assign=p_a, coverage=coverage)
sim_cov

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