Learn R Programming

sequoia (version 2.3.5)

ErrToM: Generate Genotyping Error Matrix

Description

Generate a matrix with the probabilities of observed genotypes (columns) conditional on actual genotypes (rows), or return a function to generate such matrices (using a single value Err as input to that function).

Usage

ErrToM(Err = NA, flavour = "version2.0", Return = "matrix")

Arguments

Err

estimated genotyping error rate, as a single number or 3x3 or 4x4 matrix. If a single number, an error model is used that aims to deal with scoring errors typical for SNP arrays. If a matrix, this should be the probability of observed genotype (columns) conditional on actual genotype (rows). Each row must therefore sum to 1. If Return='function', this may be NA.

flavour

matrix-generating function, or one of 'version2.0', 'version1.3' (='SNPchip'), 'version1.1' (='version111'), referring to the sequoia version in which it was used as default. Ignored if Err is a matrix and Return='matrix' (in which case the matrix will only be checked for validity).

Return

output, 'matrix' (always 3x3) or 'function'.

Value

Either a 3x3 matrix, or a function generating a 3x3 matrix.

Details

By default (flavour = "SNPchip"), Err is interpreted as a locus-level error rate (rather than allele-level), and equals the probability that an actual heterozygote is observed as either homozygote (i.e., the probability that it is observed as AA = probability that observed as aa = Err/2). The probability that one homozygote is observed as the other is (Err/2\()^2\).

The inbuilt 'flavours' correspond to the presumed and simulated error structures, which have changed with sequoia versions. The most appropriate error structure will depend on the genotyping platform; 'version0.9' and 'version1.1' were inspired by SNP array genotyping while 'version1.3' and 'version2.0' are intended to be more general.

Pr(observed genotype (columns) | actual genotype (rows)):

version2.0:

0 1 2
0 \((1-E/2)^2\) \(E(1-E/2)\) \((E/2)^2\)
1 \(E/2\) \(1-E\) \(E/2\)
2 \((E/2)^2\) \(E(1-E/2)\) \((1-E/2)^2\)

version1.3

0 1 2
0 \(1-E-(E/2)^2\) \(E\) \((E/2)^2\)
1 \(E/2\) \(1-E\) \(E/2\)
2 \((E/2)^2\) \(E\) \(1-E-(E/2)^2\)

version1.1

0 1 2
0 \(1-E\) \(E/2\) \(E/2\)
1 \(E/2\) \(1-E\) \(E/2\)
2 \(E/2\) \(E/2\) \(1-E\)

version0.9 (not recommended)

0 1 2
0 \(1-E\) \(E\) \(0\)
1 \(E/2\) \(1-E\) \(E/2\)
2 \(0\) \(E\) \(1-E\)