mendelianCheck: Check for Mendelian errors

View source: R/mendelianCheck.R

mendelianCheckR Documentation

Check for Mendelian errors

Description

Check marker data for Mendelian inconsistencies

Usage

mendelianCheck(x, remove = FALSE, verbose = !remove)

Arguments

x

a linkdat object

remove

a logical. If FALSE, the function returns the indices of markers found to incorrect. If TRUE, a new linkdat object is returned, where the incorrect markers have been deleted.

verbose

a logical. If TRUE, details of the markers failing the tests are shown.

Value

A numeric containing the indices of the markers that did not pass the tests, or (if remove=TRUE) a new linkdat object where the failing markers are removed.

Examples


x = nuclearPed(3)

# Adding a SNP with a mendelian error:
# Individual 3 has an allele 'c' not carried by either parents
m1 = marker(x, 1, c('a','a'), 2, c('a','b'), 3, c('a','c'))

# Another erroneous marker: The siblings carry more than 4 different alleles.
m2 = marker(x, 3, c(1,2), 4, c(3,4), 5, c(1,5))

# Another marker with incosistent genotypes among the siblings:
m3 = marker(x, 3, c(1,1), 4, c(2,2), 5, c(3,3))

# Another marker with incosistent genotypes among the siblings:
m4 = marker(x, 3, c(1,1), 4, c(2,3), 5, c(1,4))

# A correct marker (all homozygous for allele 'A')
m5 = marker(x, 1:5, 'A')

# An empty marker
m6 = marker(x)

x = setMarkers(x, list(m1,m2,m3,m4,m5,m6))

# Finding the errors
err_index = mendelianCheck(x, remove=FALSE)
stopifnot(all.equal(err_index, 1:4))

x_remove = mendelianCheck(x, remove=TRUE)
stopifnot(x_remove$nMark == 2)


paramlink documentation built on April 15, 2022, 9:06 a.m.