| ibdDraw | R Documentation | 
This is a pedagogical tool for illustrating the concept of identity-by-descent, by representing the alleles in a pedigree by coloured points or letters. By default, the alleles are placed below each pedigree symbol, but this may be modified. (See examples.)
ibdDraw(
  x,
  alleles,
  symbol = c("point", "text"),
  pos = 1,
  cols = NULL,
  cex = NA,
  sep = 1,
  dist = 1,
  labs = FALSE,
  checkFounders = TRUE,
  checkParents = TRUE,
  ...
)
x | 
 A   | 
alleles | 
 A list of length   | 
symbol | 
 Either "point" or "text".  | 
pos | 
 A vector recycled to the length of   | 
cols | 
 A colour vector corresponding to the integers occurring in
  | 
cex | 
 An expansion factor for the allele points/letters. Default: 3 for points and 2 for text.  | 
sep | 
 The separation between alleles within a pair, given as a multiple
of the width of a pedigree symbol. Default is 1 when   | 
dist | 
 The distance between pedigree symbols and the alleles, given as a
multiple of symbol size. Default: 1. Ignored when   | 
labs | 
 A logical indicating if labels should be included.  | 
checkFounders | 
 A logical. If TRUE (default), a warning is issued if a founder has two equal alleles other than 0.  | 
checkParents | 
 A logical. If TRUE (default), a warning is issued if someone's alleles don't match those of the parents. This a superficial test and does not catch all Mendelian errors.  | 
... | 
 Further arguments passed on to   | 
The plot structure is returned invisibly.
pedtools::plot.ped(), ibdsim2::haploDraw()
op = par(no.readonly = TRUE)
###############################
# Example 1: A family quartet #
###############################
x = nuclearPed(2)
als = list(1:2, 3:4, c(1,3), c(2,3))
# Default options
ibdDraw(x, als)
# Nicer colors
cols = c(7, 3, 2, 4)
ibdDraw(x, als, cols = cols)
# Inside the pedigree symbols
ibdDraw(x, als, cols = cols, pos = 0, symbolsize = 2.5)
# Other placements
ibdDraw(x, als, cols = cols, pos = c(2, 3, 1, 4))
# Letters instead of points
ibdDraw(x, als, cols = cols, symbol = "text")
# Further arguments (note that `col` is an argument of `ped.plot()`)
ibdDraw(x, als, cols = cols, pos = 0, symbolsize = 2.5,
        labs = TRUE, fill = "lightgray")
# Mutations are warned about (unless `checkParents = FALSE`)
ibdDraw(x, alleles = list(1:2, 3:4, 5, 6))
##############################
# Example 2: Cousin pedigree #
##############################
x = cousinPed(1) |> swapSex(3) |> relabel()
als = list(1:2, 3:4, NULL, c(1,3), c(2,3), NULL, 3, 3)
cols = c(7, 3, 2, 4)
ibdDraw(x, als, cols = cols, dist = 0.8)
ibdDraw(x, als, cols = cols, dist = 0.8, symbol = "text")
# Alternative: 0's give greyed-out alleles
als2 = list(1:2, 3:4, c(0,0), c(1,3), c(2,3), c(0,0), c(0,3), c(3,0))
ibdDraw(x, als2, cols = cols, dist = 0.8)
ibdDraw(x, als2, cols = cols, dist = 0.8, symbol = "text")
############################
# Example 3: X inheritance #
############################
x = nuclearPed(2, sex = c(1, 2))
als = list(1, 2:3, 3, c(1, 3))
ibdDraw(x, als, cols = c(3, 7, 2))
#################################
# Example 4: mtDNA inheritance  #
#################################
x = linearPed(2, sex = 2)
als = list(1, 2, 3, 2, 2)
ibdDraw(x, als, cols = 2:4)
# Restore graphics parameters
par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.