guess_phase: Guess phase of imputed genotypes

View source: R/guess_phase.R

guess_phaseR Documentation

Guess phase of imputed genotypes

Description

Turn imputed genotypes into phased genotypes along chromosomes by attempting to pick the phase that leads to the fewest recombination events.

Usage

guess_phase(cross, geno, deterministic = FALSE, cores = 1)

Arguments

cross

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

geno

Imputed genotypes, as a list of matrices, as from maxmarg().

deterministic

If TRUE, preferentially put smaller allele first when there's uncertainty. If FALSE, the order of alleles is random in such cases.

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

We randomly assign the pair of alleles at the first locus to two haplotypes, and then work left to right, assigning alleles to haplotypes one locus at a time seeking the fewest recombination events. The results are subject to arbitrary and random choices. For example, to the right of a homozygous region, either orientation is equally reasonable.

Value

If input cross is phase-known (e.g., recombinant inbred lines), the output will be the input geno. Otherwise, the output will be a list of three-dimensional arrays of imputed genotypes, individual x position x haplotype (1/2).

See Also

maxmarg()

Examples

iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
gmap <- insert_pseudomarkers(iron$gmap, step=1)
probs <- calc_genoprob(iron, gmap, error_prob=0.002)
imp_geno <- maxmarg(probs)
ph_geno <- guess_phase(iron, imp_geno)

qtl2 documentation built on May 29, 2024, 11:46 a.m.