LDheatmap()
is used to produce a graphical display, as a heat map,
of pairwise linkage disequilibrium (LD) measurements for SNPs.
The heat map is a false color image in the upper-left diagonal of a square plot.
Optionally, a line parallel to the diagonal of the image indicating
the physical or genetic map positions of the SNPs may be added, along
with text reporting the total length of the genomic region considered.
plot_LDheatmap(
hap,
gff,
Chr,
start,
end,
geneID = NULL,
distances = "physical",
LDmeasure = "r",
title = "Pairwise LD",
add.map = TRUE,
map.height = 1,
colorLegend = TRUE,
geneMapLocation = 0.15,
geneMapLabelX = NULL,
geneMapLabelY = NULL,
SNP.name = TRUE,
color = NULL,
color_gmodel = "grey",
color_snp = "grey",
color_snpname = "grey40",
cex_snpname = 0.8,
snpmarks_height = NULL,
newpage = TRUE,
name = "ldheatmap",
vp.name = NULL,
pop = FALSE,
text = FALSE
)
An object of class "LDheatmap"
which contains the following components:
The matrix of pairwise LD measurements plotted in the heat map.
A grid graphical object (grob) representing the produced heat map.
The viewport in which the heat map is drawn. See viewport.
The vector of the supplied physical or genetic map locations, or the vector of equispaced marker distances when no distance vector is supplied.
A character string specifying whether the provided map distances are physical or genetic.
The range of colors used for drawing the heat map.
The grob
LDheatmapGrob
has three grob
s as its children (components).
They are listed below along with their own children and respectively represent
the color image with main title, genetic map and color key of the heat map:
"heatMap"
- "heatmap"
, "title"
;
"geneMap"
- "diagonal"
, "segments"
,
"title"
, "symbols"
, "SNPnames"
; and
"Key"
- "colorKey"
, "title"
, "labels"
,
"ticks"
, "box"
.
R object of hapSummary or hapResult class.
annotations
chromosome, start and end position, gene ID for extract annotation in target range.
A character string to specify whether the provided map locations
are in physical or genetic distances.
If distances = "physical"
(default), the text describing the total
length of the region will be “Physical Length:XXkb” where XX is the
length of the region in kilobases. If distances = "genetic"
, the
text will be “Genetic Map Length:YYcM” where YY is
the length of the region in centiMorgans.
If gdat
is an object of class LDheatmap,
distances
is taken from gdat
.
A character string specifying the measure of LD
either allelic correlation \(r^2\) or Lewontin's
|D\('\)|; default = "r"
for \(r^2\);
type "D'"
for |D\('\)|. This argument is ignored when the user has already
supplied calculated LD measurements through gdat
(i.e., when gdat
is a matrix of pairwise LD measurements or an object of class "LDheatmap"
).
A character string for the main title of the plot. Default is “Pairwise LD”.
If TRUE
(default) a diagonal line indicating
the physical or genetic map positions of the SNPs will be added to
the plot, along with text indicating the total length of the
genetic region.
the height of gene map, default is 0.02
If TRUE
(default) the color legend is drawn.
A numeric value specifying the position of the line
parallel to the diagonal of the matrix; the larger the value, the
farther it lies from the matrix diagonal. Ignored when add.map = FALSE
.
A numeric value specifying the x-coordinate
of the text indicating the total length of the genomic region
being considered. Ignored when add.map = FALSE
.
A numeric value specifying the y-coordinate
of the text indicating the total length of the genomic region
being considered. Ignored when add.map = FALSE
.
a logical vector indicated wherther display SNP names using positions.
A range of colors to be used for drawing the heat map. Default
is grDevices::colorRampPalette(c("red", "grey"))(30)
.
the color of gene model and snp and snp names respectively, default as grey80.
the size of snp names/labels
the height of snp marks, if set as NULL, nothing will display on gene model where the heat map is going to be drawn.
If TRUE
(default), the heat map will be drawn on a new page.
A character string specifying the name of the LDheatmap
graphical object (grob
) to be produced.
A character string specifying the name of the viewport
If TRUE
, the viewport where the heat map is drawn is
pop
ped (i.e. removed) from the viewport tree after drawing.
Default = FALSE
.
If TRUE
, the LD measurements are printed on each cell.
The input object gdat
can be a data frame of genotype
objects
(a data structure from the genetics package), a SnpMatrix
object
(a data structure from the snpStats package), or
any square matrix with values between 0 and 1 inclusive.
LD computation is much faster for SnpMatrix
objects than for
genotype
objects.
In the case of a matrix of LD values between 0 and 1,
the values above the diagonal will be plotted.
In the display of LD, SNPs appear in the order supplied by the
user as the horizontal and vertical coordinates are increased
and one moves along the off-diagonal line, from the bottom-left
to the top-right corner. To achieve this, the conventions of
the image()
function have been adopted, in which horizontal
coordinates correspond to the rows of the matrix and vertical coordinates
correspond to columns, and vertical coordinates are indexed in increasing
order from bottom to top.
See the package vignette LDheatmap
for more examples and details
of the implementation. Examples of adding ``tracks'' of genomic
annotation above a flipped heatmap are in the package vignette
addTracks
.
Shin J-H, Blay S, McNeney B and Graham J (2006). LDheatmap: An R Function for Graphical Display of Pairwise Linkage Disequilibria Between Single Nucleotide Polymorphisms. Journal of Statistical Software, 16 Code Snippet 3
# Pass LDheatmap a SnpMatrix object
data(geneHapR_test)
plot_LDheatmap(hap = hapResult,
gff = gff,
Chr = hapResult[1,2],
start = 4000, end = 8200)
Run the code above in your browser using DataLab