heatmapChr | R Documentation |
A function to create a heatmap or a graphical representation of data where the individual values contained in a matrix are represented as colors of the GRanges object.
heatmapChr(
GR,
filename = NULL,
chr,
sample.id = NULL,
factor.scale = 10^6,
absolute = FALSE,
xtitle = NULL,
Barpalette,
format = "tiff",
width = 4000,
height = 790,
fontfamily = "sans",
font = 2,
mar.scale = c(2, 2, 2, 2),
mgp.scale = c(3, 1, 0),
mar.heatmap = c(2, 2, 2, 2),
mgp.heatmap = c(3.5, 1, 0),
compression = "lzw",
res = 900,
pointsize = 1,
col.bar.lwd = 1,
cex = 1,
cex.xaxis = 1.6,
cex.yaxis = 2,
cex.xtitle = 2,
cex.bar.lab = 2,
lwd.ticks = 0.5,
xaxis.labels.pos = 0.1,
oma = c(2, 2, 2, 2),
oma.scale = c(0, 0, 0, 0),
xaxis.adj = c(0.5, 1),
tick.breaks = 500,
line.xtitle = NA,
jpg.type = c("cairo", "cairo-png", "Xlib", "quartz"),
ylas = 1,
bar.las = 1,
...
)
GR |
A Grange object with the variable of interest in its metacolumn. |
filename |
This is the name of the image file in which we want to output the heatmap. |
chr |
This is a required argument which corresponds to the chromosome of interest in the data. |
sample.id |
This is the id or column name which is the sample of the GRange object. |
factor.scale |
A number to scale chromosome position into "bp", "kbp", or "Mbp", depending on chromosome size |
absolute |
If absolute == TRUE, all the values taken for the heatmap would be absolute values of the GRange object. |
xtitle |
This is the x axis title for the heatmap which will be produced.. |
Barpalette |
This is a required argument which defines the barpalette for the heatmap which can be a colorRampPalette object. |
format |
This is the format of the output file which will have the heatmap. Possible formats are "jpg", "png", "tiff" and "pdf". The default value for this is "tiff with compression = "lzw" and res = 600. |
width |
This is the width of the heatmap image which will be produced. |
height |
This is the height of the heatmap image which will be produced. |
fontfamily |
This value defines the name of the font family which will be used in text or labels for the heatmap. Standard values are "serif", "sans" and "mono", and the Hershey font families are also available. |
font |
value to pass in to parameter 'font' from function
|
mar.scale |
A numeric vector of length 4, which sets the margin sizes in the following order: bottom, left, top, and right. |
mgp.scale |
A numeric vector of length 3, which sets the axis label locations relative to the edge of the inner plot window. The first value represents the location the labels (i.e. xlab and ylab in plot), the second the tick-mark labels, and third the tick marks. |
compression |
This is the the type of compression to be used. The default compression type is "lzw". |
res |
This is the nominal resolution in ppi which will be recorded in the bitmap file, if a positive integer. Also used for units other than the default, and to convert points to pixels. The defualt resolution is 300ppi. |
pointsize |
The pointsize of plotted text, interpreted as big points (1/72 inch) at res ppi. The default value for this is 1. |
col.bar.lwd |
Line width grphical parameter for the color bar. |
cex |
As in |
cex.xaxis, cex.yaxis, cex.xtitle, cex.bar.lab |
Cex values for x-axis,
y-axis, x-title, and color-bar labels, respectively. As in
|
lwd.ticks |
Line width for axis and ticks (heatmap only). |
xaxis.labels.pos |
Y-coordinate for x-axis labels. |
oma, oma.scale |
Same as 'oma' graphical parameter (see
|
xaxis.adj |
Adjustment of the x-axis labels. |
tick.breaks |
An integer number used to introduce the number breaks in the chromosome scale where the tick will be located. |
line.xtitle |
specifying a value for xline.label overrides the default placement of x-axis title, and places them this many lines outwards from the plot edge |
jpg.type |
Paramter 'type' from 'jpeg' functions (see ?jpeg). |
ylas, bar.las |
numeric in 0,1,2,3; the style of y-axis and colo-bar
labels, as given for graphical parameters "las" (see
|
... |
Additional graphical parameters for 'par' R function used in the heatmap (not in the color bar). |
This function creates a heatmap is a false color image with a color scale added to the right side and a chromosome scale to the bottom.
A GRanges object with the new genomic regions and their corresponding summarized statistic.
Robersy Sanchez
data(GRMatrix)
## The pallette used in the bar color
bar.palette <- colorRampPalette(c(rep("cyan",4), "green",rep("yellow", 2),
rep("red", 3), rep("darkblue", 2),
rep("black",2)), bias = 1.1, space = "rgb")
## heatmap construction
k <- "Chr1"
file <- paste0(getwd(), "/heatmap_", k)
xlab <- paste0("CG. Chromosome ", sub("Chr", "", k), " (Mbp)")
heatmapChr(GR = GRMatrix, filename = file, format = "tiff",
chr = k, xtitle = xlab,
Barpalette = bar.palette, mar = c(4, 6, 0, 0), res = 600,
height = 350, width =2500, font = 2, fontfamily = "serif", ylas=1,
lwd = 0.1, mar.scale = c(4, 5, 0.5, 3), cex.xtitle = 2.5,
cex.bar.lab = 2, mgp = c(3,1,0), pointsize = 2, cex.xaxis = 2,
cex.yaxis = 2, oma=c(1,1,1,0), xaxis.adj = c(0.5, 0.7),
lwd.ticks = 0.1, line.xtitle = 3, mgp.scale = c(3, 1, 0),
col.bar.lwd = 0.1, factor.scale = 10^3,
sample.id = c("CT1", "CT2", "CT3", "TT1", "TT2", "TT3"))
## To remove the file containing the heatmap
file.remove(paste0(file, ".tiff"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.