haploNet: Haplotype Networks

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

haploNet computes a haplotype network. There is a plot method and two conversion functions towards other packages.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
haploNet(h, d = NULL)
## S3 method for class 'haploNet'
plot(x, size = 1, col = "black", bg = "white",
     col.link = "black", lwd = 1, lty = 1, pie = NULL,
     labels = TRUE, font = 2, cex = 1, scale.ratio = 1,
     asp = 1, legend = FALSE, fast = FALSE, ...)
## S3 method for class 'haploNet'
as.network(x, directed = FALSE, ...)
## S3 method for class 'haploNet'
as.igraph(x, directed = FALSE, use.labels = TRUE, ...)

Arguments

h

an object of class "haplotype".

d

an object giving the distances among haplotypes (see details).

x

an object of class "haploNet".

size

a numeric vector giving the diameter of the circles representing the haplotypes: this is in the same unit than the links and eventually recycled.

col

a character vector specifying the colours of the circles; eventually recycled.

bg

a character vector specifying the colours of the background of the circles; eventually recycled.

col.link

a character vector specifying the colours of the links; eventually recycled.

lwd

a numeric vector giving the width of the links; eventually recycled.

lty

idem for the line types.

pie

a matrix used to draw pie charts for each haplotype; its number of rows must be equal to the number of haplotypes.

labels

a logical specifying whether to identify the haplotypes with their labels (the default).

font

the font used for these labels (bold by default); must be an integer between 1 and 4.

cex

a numerical specifying the character expansion of the labels.

scale.ratio

the ratio of the scale of the links representing the number of steps on the scale of the circles representing the haplotypes. It may be needed to give a value greater than one to avoid overlapping circles.

asp

the aspect ratio of the plot. Do not change the default unless you want to distort your network.

legend

a logical specifying whether to draw the legend, or a vector of length two giving the coordinates where to draw the legend; FALSE by default. If TRUE, the user is asked to click where to draw the legend.

fast

a logical specifying whether to optimize the spacing of the circles; FALSE by default.

directed

a logical specifying whether the network is directed (FALSE by default).

use.labels

a logical specifying whether to use the original labels in the returned network.

...

further arguments passed to plot.

Details

By default, the haplotype network is built using an infinite site model (i.e., uncorrected or Hamming distance). Users may specify their own distance with the argument d. Currently, there is no check of labels, so the user must make sure that the distances are ordered in the same way than the haplotypes.

Value

haploNet returns an object of class "haploNet" which is a matrix where each row represents a link in the network, the first and second columns give the numbers of the linked haplotypes, the third column, named "step", gives the number of steps in this link, and the fourth column, named "Prob", gives the probability of a parsimonious link as given by Templeton et al. (1992). There are two additional attributes: "freq", the absolute frequencies of each haplotype, and "labels", their labels.

as.network and as.igraph return objects of the appropriate class.

Author(s)

Emmanuel Paradis

References

Templeton, A. R., Crandall, K. A. and Sing, C. F. (1992) A cladistic analysis of phenotypic association with haplotypes inferred from restriction endonuclease mapping and DNA sequence data. III. Cladogram estimation. Genetics, 132, 619–635.

See Also

haplotype

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## generate some artificial data from 'woodmouse':
data(woodmouse)
x <- woodmouse[sample(15, size = 110, replace = TRUE), ]
h <- haplotype(x)
(net <- haploNet(h))
plot(net)
## symbol sizes equal to haplotype sizes:
plot(net, size = attr(net, "freq"), fast = TRUE)
plot(net, size = attr(net, "freq"))
plot(net, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8)

dwinter/Pegas documentation built on May 15, 2019, 6:21 p.m.