sim_geno: Simulate genotypes given observed marker data

View source: R/sim_geno.R

sim_genoR Documentation

Simulate genotypes given observed marker data

Description

Uses a hidden Markov model to simulate from the joint distribution Pr(g | O) where g is the underlying sequence of true genotypes and O is the observed multipoint marker data, with possible allowance for genotyping errors.

Usage

sim_geno(
  cross,
  map = NULL,
  n_draws = 1,
  error_prob = 0.0001,
  map_function = c("haldane", "kosambi", "c-f", "morgan"),
  lowmem = FALSE,
  quiet = TRUE,
  cores = 1
)

Arguments

cross

Object of class "cross2". For details, see the R/qtl2 developer guide.

map

Genetic map of markers. May include pseudomarker locations (that is, locations that are not within the marker genotype data). If NULL, the genetic map in cross is used.

n_draws

Number of simulations to perform.

error_prob

Assumed genotyping error probability

map_function

Character string indicating the map function to use to convert genetic distances to recombination fractions.

lowmem

If FALSE, split individuals into groups with common sex and crossinfo and then precalculate the transition matrices for a chromosome; potentially a lot faster but using more memory.

quiet

If FALSE, print progress messages.

cores

Number of CPU cores to use, for parallel calculations. (If 0, use parallel::detectCores().) Alternatively, this can be links to a set of cluster sockets, as produced by parallel::makeCluster().

Details

After performing the backward equations, we draw from Pr(g_1 = v | O) and then Pr(g_{k+1} = v | O, g_k = u).

Value

An object of class "sim_geno": a list of three-dimensional arrays of imputed genotypes, individuals x positions x draws. Also contains three attributes:

  • crosstype - The cross type of the input cross.

  • is_x_chr - Logical vector indicating whether chromosomes are to be treated as the X chromosome or not, from input cross.

  • alleles - Vector of allele codes, from input cross.

See Also

cbind.sim_geno(), rbind.sim_geno()

Examples

grav2 <- read_cross2(system.file("extdata", "grav2.zip", package="qtl2"))
map_w_pmar <- insert_pseudomarkers(grav2$gmap, step=1)
draws <- sim_geno(grav2, map_w_pmar, n_draws=4, error_prob=0.002)

rqtl/qtl2 documentation built on March 20, 2024, 6:35 p.m.