Learn R Programming

pedtools (version 0.9.0)

plot.ped: Plot pedigrees with genotypes

Description

This is the main function for pedigree plotting, with many options for controlling the appearance of pedigree symbols and accompanying labels. Most of the work is done by the plotting functionality in the 'kinship2' package.

Usage

# S3 method for ped
plot(x, marker = NULL, sep = "/", missing = "-",
  skip.empty.genotypes = FALSE, id.labels = labels(x), title = NULL,
  col = 1, shaded = NULL, deceased = NULL, starred = NULL,
  fouInb = "autosomal", margins = c(0.6, 1, 4.1, 1), keep.par = F,
  ...)

# S3 method for singleton plot(x, marker = NULL, sep = "/", missing = "-", skip.empty.genotypes = FALSE, id.labels = labels(x), title = NULL, col = 1, shaded = NULL, deceased = NULL, starred = NULL, fouInb = "autosomal", margins = c(8, 0, 0, 0), ...)

as_kinship2_pedigree(x, deceased = NULL, shaded = NULL)

# S3 method for pedList plot(x, ...)

Arguments

x

a ped() object.

marker

either NULL, a vector of positive integers, a marker object, or a list of such. If NULL, no genotypes are plotted. If a vector of integers is given, the corresponding marker objects are extracted from x$MARKERS. The genotypes are written below each individual in the pedigree, in the format determined by sep and missing. See also skip.empty.genotypes below.

sep

a character of length 1 separating alleles for diploid markers.

missing

the symbol (integer or character) for missing alleles.

skip.empty.genotypes

a logical. If TRUE, and marker is non-NULL, empty genotypes (which by default looks like '-/-') are not printed.

id.labels

a vector with labels for each pedigree member. This defaults to labels(x). Several syntaxes are possible:

  • If id.labels is NULL or the empty character "", then no labels are drawn.

  • If id.labels is the word "num", then all individuals are numerically labelled following the internal ordering.

  • If id.labels is a subset of labels(x), then only this subset will be labelled. If the vector is named, then the (non-empty) names are used instead of the ID label. See Examples.

title

the plot title. If NULL or '', no title is added to the plot.

col

a vector of colours for the pedigree members, recycled if necessary. Alternatively, col can be a list assigning colours to specific members. For example if col = list(red = "a", blue = c("b", "c")) then individual "a" will be red, "b" and "c" blue, and everyone else black. By default everyone is drawn black.

shaded

a vector of ID labels indicating pedigree members whose plot symbols should appear shaded.

deceased

a vector of ID labels indicating deceased pedigree members.

starred

a vector of ID labels indicating pedigree members that should be marked with a star in the pedigree plot.

fouInb

either "autosomal" (default), "x" or NULL. If "autosomal" or "x", inbreeding coefficients are added to the plot above the inbred founders. If NULL, or if no founders are inbred, nothing is added.

margins

a numeric of length 4 indicating the plot margins. For singletons only the first element (the 'bottom' margin) is used.

keep.par

A logical (default = FALSE). If TRUE, the graphical parameters are not reset after plotting, which may be useful for adding additional annotation.

arguments passed on to plot.pedigree in the kinship2 package. In particular symbolsize and cex can be useful.

Details

plot.ped is in essence an elaborate wrapper for kinship2::plot.pedigree().

See Also

kinship2::plot.pedigree()

Examples

Run this code
# NOT RUN {
x = nuclearPed(father = "fa", mother = "mo", child = "boy")
m = marker(x, fa = 1, boy = 1:2, name = "SNP")

plot(x, marker = m)

# Alternative syntax if the marker is attached to x
x = setMarkers(x, m)
plot(x, marker = "SNP")

# Other options
plot(x, marker = "SNP", shaded = typedMembers(x),
     starred = "fa", deceased = "mo")

# Labelling only some members
plot(x, id.labels = c("fa", "boy"))

# Labelling only some members, and renaming the father
plot(x, id.labels = c(FATHER = "fa", "boy"))

# Colours
plot(x, col = list(red = "fa", green = "boy"))

# Founder inbreeding is shown by default
founderInbreeding(x, "mo") = 0.1
plot(x)

# ... but can be suppressed
plot(x, fouInb = NULL)

# }

Run the code above in your browser using DataLab