Learn R Programming

ibdsim2 (version 2.2.0)

haploDraw: Draw haplotypes onto a pedigree plot

Description

Visualise the IBD pattern of a single chromosome, by drawing haplotypes onto the pedigree.

Usage

haploDraw(
  x,
  ibd,
  chrom = NULL,
  ids = NULL,
  unit = "mb",
  L = NULL,
  pos = 1,
  cols = NULL,
  height = 4,
  width = 0.75,
  sep = 0.75,
  dist = 1,
  keep.par = FALSE,
  ...
)

Value

None.

Arguments

x

A ped object.

ibd

A genomeSim object, typically made by ibdsim().

chrom

A chromosome number, needed if ibd contains data from multiple chromosomes.

ids

A vector indicating for which pedigree members haplotypes should be drawn. If NULL (default), all individuals in ibd are included.

unit

Either "mb" (default) or "cm".

L

A positive number: the chromosome length. By default derived from ibd.

pos

A vector recycled to pedsize(x), indicating where haplotypes should be drawn relative to the pedigree symbols: 0 = no haplotypes; 1 = below; 2 = left; 3 = above; 4 = right. By default, all are placed below.

cols

A colour vector corresponding to the alleles in ibd.

height

The height of the haplotype rectangles in units of the pedigree symbol height. Default: 4.

width

The width of the haplotype rectangles in units of the pedigree symbol width. Default: 0.75.

sep

The separation between haplotypes within a pair, measured in pedigree symbol widths.

dist

The distance between pedigree symbols and the closest haplotype, measured in pedigree symbol widths.

keep.par

A logical, by default FALSE; passed on to plot.ped().

...

Further arguments passed on to plot.ped(), e.g. margins and cex. See ?plotmethods for a complete list.

Examples

Run this code

###############################
# Example 1: A family quartet #
###############################

x = nuclearPed(2)
map = uniformMap(M = 1)
s = ibdsim(x, map = map, seed = 4276)

haploDraw(x, s)

# Custom colours and placements
haploDraw(x, s, cols = c(3,7,2,4), pos = c(2,4,2,4))

# Standard plot options apply
haploDraw(x, s, margins = 3, cex = 1.5, title = "Full sibs")
 

###########################
# Example 2: Autozygosity #
###########################

x = halfCousinPed(0, child = TRUE)
map = uniformMap(M = 1)
s = ibdsim(x, map = map, skipRecomb = c(1,3), seed = 2)

# Only include relevant individuals (skip 1 and 3)
haploDraw(x, s, ids = c(2,4,5,6), pos = c(1,2,4,4))

###############################
# Example 3: X-chromosomal sims
###############################

x = nuclearPed(2, sex = 2:1)
s = ibdsim(x, N = 1, map = uniformMap(M = 1, chrom = "X"), seed = 123)

haploDraw(x, s)


Run the code above in your browser using DataLab