Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

image.DNAbin

Plot of DNA Sequence Alignement


Description

This function plots an image of an alignment of nucleotide sequences.

Usage

## S3 method for class 'DNAbin'
image(x, what, col, bg = "white", xlab = "", ylab = "",
      show.labels = TRUE, cex.lab = 1, legend = TRUE,
      grid = FALSE, show.bases = FALSE, base.cex = 1,
      base.font = 1, base.col = "black", ...)

Arguments

x

a matrix of DNA sequences (class "DNAbin").

what

a vector of characters specifying the bases to visualize. If missing, this is set to “a”, “g”, “c”, “t”, “n”, and “-” (in this order).

col

a vector of colours. If missing, this is set to “red”, “yellow”, “green”, “blue”, “grey”, and “black”. If it is shorter (or longer) than what, it is recycled (or shortened).

bg

the colour used for nucleotides whose base is not among what.

xlab

the label for the x-axis; none by default.

ylab

Idem for the y-axis. Note that by default, the labels of the sequences are printed on the y-axis (see next option).

show.labels

a logical controlling whether the sequence labels are printed (TRUE by default).

cex.lab

a single numeric controlling the size of the sequence labels. Use cex.axis to control the size of the annotations on the x-axis.

legend

a logical controlling whether the legend is plotted (TRUE by default).

grid

a logical controlling whether to draw a grid (FALSE by default).

show.bases

a logical controlling whether to show the base symbols (FALSE by default).

base.cex, base.font, base.col

control the aspect of the base symbols (ignored if the previous is FALSE).

...

further arguments passed to image.default (e.g., xlab, cex.axis).

Details

The idea of this function is to allow flexible plotting and colouring of a nucleotide alignment. By default, the most common bases (a, g, c, t, and n) and alignment gap are plotted using a standard colour scheme.

It is possible to plot only one base specified as what with a chosen colour: this might be useful to check, for instance, the distribution of alignment gaps (image(x, "-")) or missing data (see examples).

Author(s)

Emmanuel Paradis

See Also

Examples

data(woodmouse)
image(woodmouse)
rug(seg.sites(woodmouse), -0.02, 3, 1)
image(woodmouse, "n", "blue") # show missing data
image(woodmouse, c("g", "c"), "green") # G+C
par(mfcol = c(2, 2))
### barcoding style:
for (x in c("a", "g", "c", "t"))
    image(woodmouse, x, "black", cex.lab = 0.5, cex.axis = 0.7)
par(mfcol = c(1, 1))
### zoom on a portion of the data:
image(woodmouse[11:15, 1:50], c("a", "n"), c("blue", "grey"))
grid(50, 5, col = "black")
### see the guanines on a black background:
image(woodmouse, "g", "yellow", "black")

ape

Analyses of Phylogenetics and Evolution

v5.5
GPL-2 | GPL-3
Authors
Emmanuel Paradis [aut, cre, cph] (<https://orcid.org/0000-0003-3092-2199>), Simon Blomberg [aut, cph] (<https://orcid.org/0000-0003-1062-0839>), Ben Bolker [aut, cph] (<https://orcid.org/0000-0002-2127-0443>), Joseph Brown [aut, cph] (<https://orcid.org/0000-0002-3835-8062>), Santiago Claramunt [aut, cph] (<https://orcid.org/0000-0002-8926-5974>), Julien Claude [aut, cph] (<https://orcid.org/0000-0002-9267-1228>), Hoa Sien Cuong [aut, cph], Richard Desper [aut, cph], Gilles Didier [aut, cph] (<https://orcid.org/0000-0003-0596-9112>), Benoit Durand [aut, cph], Julien Dutheil [aut, cph] (<https://orcid.org/0000-0001-7753-4121>), RJ Ewing [aut, cph], Olivier Gascuel [aut, cph], Thomas Guillerme [aut, cph] (<https://orcid.org/0000-0003-4325-1275>), Christoph Heibl [aut, cph] (<https://orcid.org/0000-0002-7655-3299>), Anthony Ives [aut, cph] (<https://orcid.org/0000-0001-9375-9523>), Bradley Jones [aut, cph] (<https://orcid.org/0000-0003-4498-1069>), Franz Krah [aut, cph] (<https://orcid.org/0000-0001-7866-7508>), Daniel Lawson [aut, cph] (<https://orcid.org/0000-0002-5311-6213>), Vincent Lefort [aut, cph], Pierre Legendre [aut, cph] (<https://orcid.org/0000-0002-3838-3305>), Jim Lemon [aut, cph], Guillaume Louvel [aut, cph] (<https://orcid.org/0000-0002-7745-0785>), Eric Marcon [aut, cph] (<https://orcid.org/0000-0002-5249-321X>), Rosemary McCloskey [aut, cph] (<https://orcid.org/0000-0002-9772-8553>), Johan Nylander [aut, cph], Rainer Opgen-Rhein [aut, cph], Andrei-Alin Popescu [aut, cph], Manuela Royer-Carenzi [aut, cph], Klaus Schliep [aut, cph] (<https://orcid.org/0000-0003-2941-0161>), Korbinian Strimmer [aut, cph] (<https://orcid.org/0000-0001-7917-2056>), Damien de Vienne [aut, cph] (<https://orcid.org/0000-0001-9532-5251>)
Initial release
2021-04-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.