A typical workflow involves creating a page, defining genomic parameters using pgParams, and then adding various tracks (Hi-C, signal, genes, etc.) to that page.
Key steps:
- Initialize a page: Use
pageCreate() to set the overall dimensions. - Define genomic regions: Use
pgParams() to create a parameter object containing chrom, chromstart, chromend, assembly, and layout properties like x, width, and just. - Add tracks: Use specialized functions like
plotHicSquare(), plotHicTriangle(), plotSignal(), or plotGenes(). These functions take the params object to ensure correct genomic alignment. - Add annotations: Use functions like
plotText(), annoHeatmapLegend(), or annoGenomeLabel() to add context to your plots.
library("plotgardener")
library("plotgardenerData")
# 1. Create a page
pageCreate(width = 7, height = 4.25, default.units = "inches")
# 2. Define genomic parameters
params_a <- pgParams(chrom = "chr21", chromstart = 28000000, chromend = 30300000,
assembly = "hg19",
x = 0.25, width = 2.75, just = c("left", "top"), default.units = "inches")
# 3. Plot tracks (e.g., Hi-C and Genes)
hicPlot_top <- plotHicSquare(data = GM12878_HiC_10kb, params = params_a,
zrange = c(0, 200), resolution = 10000,
half = "top", y = 0.5, height = 2.75)
genes_a <- plotGenes(params = params_a, stroke = 1, fontsize = 6,
y = 3.35, height = 0.4)
# 4. Add annotations
plotText(label = "A", fontsize = 12, x = 0.25, y = 0.25, just = "left", default.units = "inches")
annoGenomeLabel(plot = genes_a, params = params_a, scale = "Mb", fontsize = 7, y = 3.85)
# Hide page guides when finished
pageGuideHide()