checkPairwise: Check pedigree data for relationship errors

View source: R/checkPairwise.R

checkPairwiseR Documentation

Check pedigree data for relationship errors

Description

This function provides a convenient way to check for pedigree errors, given the available marker data. The function calls ibdEstimate() to estimate IBD coefficients for all pairs of typed pedigree members, and computes the likelihood ratio (LR) comparing each estimate to the coefficients implied by the pedigree. By default, the estimates are shown in a colour-coded plot where unlikely relationships are easy to spot.

Usage

checkPairwise(
  x,
  excludeInbred = TRUE,
  plot = TRUE,
  labels = FALSE,
  LRthreshold = 1000,
  ...
)

Arguments

x

A ped object or a list of such.

excludeInbred

A logical, by default TRUE, indicating if inbred individuals should be excluded from the analysis.

plot

A logical (default: TRUE). If TRUE, a plot is produced, showing the IBD estimates in the IBD triangle.

labels

A logical (default: FALSE). If TRUE, labels are included in the IBD triangle plot.

LRthreshold

A positive number (default: 1000). IBD estimates whose LR exceed this, when compared to the coefficients implied by the pedigree, are encircled in the plot.

...

Further parameters passed on to ribd::ibdTriangle().

Details

By default, inbred individuals are excluded from the analysis, since pairwise relationships involving inbred individuals have undefined kappa coefficients (and therefore no position in the triangle). In some cases it may still be informative to include their estimates; set excludeInbred = FALSE to achieve this.

Value

A data frame containing both the estimated and pedigree-based IBD coefficients for each pair of typed individuals. The last column contains the likelihood ratio comparing the estimated coefficients to the pedigree-based ones.

Author(s)

Magnus Dehli Vigeland

See Also

ibdEstimate()

Examples


### Example with realistic data

x = addSon(nuclearPed(nch = 2), parent = 4)
x = setMarkers(x, locus = NorwegianFrequencies)
x = profileSim(x, N = 1, seed = 1729)[[1]]

checkPairwise(x)

### Create sample swap between 1 and 3
als = getAlleles(x)
als[c(1,3), ] = als[c(3,1), ]
y = setAlleles(x, alleles = als)

checkPairwise(y)


# Combined plot of pedigree and IBD estimates
dev.new(height = 5, width = 8, noRStudioGD = TRUE)
layout(rbind(1:2), widths = 2:3)
plot(x, margins = c(4,2,4,2))
checkPairwise(x, labels = TRUE)



forrel documentation built on March 18, 2022, 5:19 p.m.