# calc_kinship: Calculate kinship matrix In qtl2: Quantitative Trait Locus Mapping in Experimental Crosses

 calc_kinship R Documentation

## Calculate kinship matrix

### Description

Calculate genetic similarity among individuals (kinship matrix) from conditional genotype probabilities.

### Usage

calc_kinship(
probs,
type = c("overall", "loco", "chr"),
omit_x = FALSE,
use_allele_probs = TRUE,
quiet = TRUE,
cores = 1
)


### Arguments

 probs Genotype probabilities, as calculated from calc_genoprob(). type Indicates whether to calculate the overall kinship ("overall", using all chromosomes), the kinship matrix leaving out one chromosome at a time ("loco"), or the kinship matrix for each chromosome ("chr"). omit_x If TRUE, only use the autosomes; ignored when type="chr". use_allele_probs If TRUE, assess similarity with allele probabilities (that is, first run genoprob_to_alleleprob()); otherwise use the genotype probabilities. 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

If use_allele_probs=TRUE (the default), we first convert the genotype probabilities are converted to allele probabilities (using genoprob_to_alleleprob()). This is recommended, as then the result is twice the empirical kinship coefficient (e.g., the expected value for an intercross is 1/2; using genotype probabilities, the expected value is 3/8).

We then calculate \sum_{kl}(p_{ikl} p_{jkl}) where k = position, l = allele, and i,j are two individuals.

For crosses with just two possible genotypes (e.g., backcross), we don't convert to allele probabilities but just use the original genotype probabilities.

### Value

If type="overall" (the default), a matrix of proportion of matching alleles. Otherwise a list with one matrix per chromosome.

### Examples

grav2 <- read_cross2(system.file("extdata", "grav2.zip", package="qtl2"))
map <- insert_pseudomarkers(grav2$gmap, step=1) probs <- calc_genoprob(grav2, map, error_prob=0.002) K <- calc_kinship(probs) # using only markers/pseudomarkers on the grid grid <- calc_grid(grav2$gmap, step=1)
probs_sub <- probs_to_grid(probs, grid)
K_grid <- calc_kinship(probs_sub)


qtl2 documentation built on April 22, 2023, 1:10 a.m.