LDheatmap | R Documentation |
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
)
hap |
R object of hapSummary or hapResult class. |
gff |
annotations |
Chr , start , end , geneID |
chromosome, start and end position, gene ID for extract annotation in target range. |
distances |
A character string to specify whether the provided map locations
are in physical or genetic distances.
If |
LDmeasure |
A character string specifying the measure of LD
|
title |
A character string for the main title of the plot. Default is “Pairwise LD”. |
add.map |
If |
map.height |
the height of gene map, default is 0.02 |
colorLegend |
If |
geneMapLocation |
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 |
geneMapLabelX |
A numeric value specifying the x-coordinate
of the text indicating the total length of the genomic region
being considered. Ignored when |
geneMapLabelY |
A numeric value specifying the y-coordinate
of the text indicating the total length of the genomic region
being considered. Ignored when |
SNP.name |
a logical vector indicated wherther display SNP names using positions. |
color |
A range of colors to be used for drawing the heat map. Default
is |
color_gmodel , color_snp , color_snpname |
the color of gene model and snp and snp names respectively, default as grey80. |
cex_snpname |
the size of snp names/labels |
snpmarks_height |
the height of snp marks, if set as NULL, nothing will display on gene model where the heat map is going to be drawn. |
newpage |
If |
name |
A character string specifying the name of the LDheatmap
graphical object ( |
vp.name |
A character string specifying the name of the viewport |
pop |
If |
text |
If |
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
.
An object of class "LDheatmap"
which contains the following components:
LDmatrix |
The matrix of pairwise LD measurements plotted in the heat map. |
LDheatmapGrob |
A grid graphical object (grob) representing the produced heat map. |
heatmapVP |
The viewport in which the heat map is drawn. See viewport. |
genetic.distances |
The vector of the supplied physical or genetic map locations, or the vector of equispaced marker distances when no distance vector is supplied. |
distances |
A character string specifying whether the provided map distances are physical or genetic. |
color |
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"
.
The produced heat map can be modified in two ways.
First, it is possible to edit interactively the grob components of the heat map,
by using the function grid.edit
;
the function will not work if there is no
open graphical device showing the heat map.
Alternatively, the user can use the function
editGrob
and work with
the grob LDheatmapGrob
returned by LDheatmap
.
See Examples for usage.
LDheatmap()
uses Grid
, which
does not respond to par()
settings.
Hence modifying par()
settings of mfrow
and mfcol
will not work with LDheatmap()
. The Examples section shows how to
display multiple heat maps on one plot without the use
of par()
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.