calc_entropy: Calculate entropy of genotype probability distribution

Description Usage Arguments Details Value Examples

View source: R/calc_entropy.R

Description

For each individual at each genomic position, calculate the entropy of the genotype probability distribution, as a quantitative summary of the amount of missing information.

Usage

1
calc_entropy(probs, quiet = TRUE, cores = 1)

Arguments

probs

Genotype probabilities, as calculated from calc_genoprob().

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

We calculate -sum(p log_2 p), where we take 0 log 0 = 0.

Value

A list of matrices (each matrix is a chromosome and is arranged as individuals x markers).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
grav2 <- read_cross2(system.file("extdata", "grav2.zip", package="qtl2"))

probs <- calc_genoprob(grav2, error_prob=0.002)
e <- calc_entropy(probs)
e <- do.call("cbind", e) # combine chromosomes into one big matrix

# summarize by individual
mean_ind <- rowMeans(e)

# summarize by marker
mean_marker <- colMeans(e)

qtl2 documentation built on Oct. 18, 2021, 1:06 a.m.