Learn R Programming

ibdsim2 (version 1.2)

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,
  pos = 1,
  cols = NULL,
  height = 4,
  width = 0.5,
  sep = 0.75,
  dist = 1.5,
  ...
)

Arguments

x

A ped object.

ibd

A genomeSim object.

chrom

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

pos

A vector recycled to the length of labels(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 haplotype height divided by the height of a pedigree symbol.

width

The haplotype width divided by the width of a pedigree symbol.

sep

The separation between haplotypes within a pair, given as a fraction of width.

dist

The distance between pedigree symbols and the closest haplotype, given as a fraction of width.

...

Arguments passed on to plot.ped().

Value

None.

Examples

Run this code
# NOT RUN {
op = par()

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

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

haploDraw(x, s[[1]], pos = c(2,4,1,1), cols = c(3,7,2,4),
          margin = c(3, 5, 3, 5), cex = 1.2)


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

x = halfCousinPed(0, child = TRUE)
s = ibdsim(x, N = 1, map = uniformMap(M = 1),
           skipRecomb = spouses(x, 1), seed = 19499)
s[[1]]

# Gray colour (8) for irrelevant founder alleles
haploDraw(x, s[[1]], pos = c(1,0,2,0,4,4),
          cols = c(3,7,8,8,8,8), margin = c(2, 2, 2, 2))


# Restore graphics parameters
par(op)

# }

Run the code above in your browser using DataLab