kpHeatmap | R Documentation |
Plots the given data as a heatmap along the genome
kpHeatmap(karyoplot, data=NULL, chr=NULL, x0=NULL, x1=x0, y=NULL, ymax=NULL, ymin=NULL, r0=NULL, r1=NULL, data.panel=1, colors=c("blue", "white", "yellow"), clipping=TRUE, ...)
karyoplot |
(a |
data |
(a |
chr |
(a charecter vector) A vector of chromosome names specifying the chromosomes of the data points. If |
x0 |
(numeric) the position (in base pairs) where the data region starts |
x1 |
(numeric) the position (in base pairs) where the data region ends |
y |
(a numeric vector) A numeric vector with the values of the data points. If |
ymax |
(numeric) The maximum value of |
ymin |
(numeric) The minimum value of |
r0 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
r1 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
data.panel |
(numeric) The identifier of the data panel where the data is to be plotted. The available data panels depend on the plot type selected in the call to |
colors |
(colors) A set of color used to determine the color associated with each value. Internally, it uses |
clipping |
(boolean) Only used if zooming is active. If TRUE, the data representation will be not drawn out of the drawing area (i.e. in margins, etc) even if the data overflows the drawing area. If FALSE, the data representation may overflow into the margins of the plot. (defaults to TRUE) |
... |
The ellipsis operator can be used to specify any additional graphical parameters. Any additional parameter will be passed to the internal calls to the R base plotting functions. |
Given regions of the genome with a start, end and a value, draws a heatmap-like
representation, with the color of the region determined by its value. It is important to
note that kpHeatmap
will not extend the regions in any way, so if regions are not
contiguous, they will appear as a series of rectangles and not as a continuous plot.
Returns the original karyoplot object, unchanged.
plotKaryotype
, kpRect
, kpLines
dd <- toGRanges(data.frame(chr="chr1", start=4980000*(0:49), end=4980000*(1:50)))
y <- sin(x=c(1:length(dd))/2)
kp <- plotKaryotype("hg19", plot.type=1, chromosomes=c("chr1", "chr2"))
kpLines(kp, dd, y=y, r0=0.4, r1=0.6, ymin=-1, ymax=1)
kpAxis(kp, r0=0.4, r1=0.6, ymin=-1, ymax=1, cex=0.5)
kpHeatmap(kp, dd, y=y, colors = c("red", "black", "green"), r0=0, r1=0.2)
kpHeatmap(kp, dd, y=y, colors = c("green", "black", "red"), r0=0.2, r1=0.4)
#or we can provide all data into a single GRanges object
mcols(dd) <- data.frame(y=y)
kpHeatmap(kp, dd, r0=0.6, r1=0.8)
#non-contiguous regions appear as solitary rectangles
kpHeatmap(kp, sample(x = dd, 10), r0=0.8, r1=1, color=c("orange", "black", "purple", "green"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.