### Example: Reshowing Page Guides - plotgardener Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideShow.html This example demonstrates the typical workflow of creating a page, adding guides, plotting data, hiding guides, and then reshowing them. Ensure the plotgardenerData package is loaded and data is available. ```r library(plotgardenerData) data("IMR90_HiC_10kb") pageCreate(width = 3, height = 3, default.units = "inches") pageGuideHorizontal(y = 0.5, default.units = "inches") hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, x = 0.5, y = 0.5, width = 2, height = 2, just = c("left", "top"), default.units = "inches" ) pageGuideHide() pageGuideShow() annoGenomeLabel( plot = hicPlot, scale = "Mb", axis = "x", x = 0.5, y = 2.53, just = c("left", "top") ) ``` -------------------------------- ### Load Example Data for Multi-omic Plotting Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Loads necessary datasets for plotting multi-omic data. Ensure plotgardenerData is installed. ```R library(plotgardenerData) data("IMR90_HiC_10kb") data("IMR90_DNAloops_pairs") data("IMR90_ChIP_H3K27ac_signal") data("hg19_insulin_GWAS") ``` -------------------------------- ### Place a Hi-C Plot on a Page Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pagePlotPlace.html This example demonstrates how to create a Hi-C plot object without drawing it, then place it onto a plotgardener page with specified dimensions and justification. It also shows how to add a heatmap legend and hide page guides. ```R library(plotgardenerData) data("IMR90_HiC_10kb") hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, draw = FALSE ) pageCreate(width = 3.75, height = 3.5, default.units = "inches") pagePlotPlace( plot = hicPlot, x = 0.25, y = 0.25, width = 3, height = 3, just = c("left", "top"), default.units = "inches", draw = TRUE ) annoHeatmapLegend( plot = hicPlot, x = 3.4, y = 0.25, width = 0.12, height = 1.2, just = c("left", "top"), default.units = "inches" ) pageGuideHide() ``` -------------------------------- ### Install plotgardener and plotgardenerData Source: https://github.com/phanstiellab/plotgardener/blob/devel/README.md Installs the plotgardener package and its associated data package from Bioconductor. Ensure BiocManager is installed first. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(version = "3.19") BiocManager::install("plotgardener") ``` ```r BiocManager::install("plotgardenerData") ``` -------------------------------- ### Load Example Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Loads necessary datasets for multi-omic plotting. Ensure these datasets are available in your R environment. ```R data("IMR90_HiC_10kb") data("IMR90_DNAloops_pairs") data("IMR90_ChIP_H3K27ac_signal") data("hg19_insulin_GWAS") ``` -------------------------------- ### Show Page Guides - plotgardener Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideShow.html Use this function to reshow page guides that have been hidden. It does not require any arguments. ```r pageGuideShow() ``` -------------------------------- ### Reshow Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideShow.html This snippet demonstrates how to use the pageGuideShow() function to make previously hidden page guides visible again. It's typically called after pageGuideHide(). ```APIDOC ## pageGuideShow() ### Description Reshow guides drawn with `pageCreate`, `pageGuideHorizontal`, and `pageGuideVertical`. ### Method `pageGuideShow()` ### Parameters None ### Value None. ### See also [pageCreate](pageCreate.html), [pageGuideHorizontal](pageGuideHorizontal.html), [pageGuideVertical](pageGuideVertical.html) ### Examples ```R ## Load Hi-C data library(plotgardenerData) data("IMR90_HiC_10kb") ## Create a page pageCreate(width = 3, height = 3, default.units = "inches") ## Add a page guide pageGuideHorizontal(y = 0.5, default.units = "inches") ## Plot and place Hi-C plot hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, x = 0.5, y = 0.5, width = 2, height = 2, just = c("left", "top"), default.units = "inches" ) ## Hide page guides pageGuideHide() ## Re-show page guides pageGuideShow() ## Annotate genome label annoGenomeLabel( plot = hicPlot, scale = "Mb", axis = "x", x = 0.5, y = 2.53, just = c("left", "top") ) ``` ``` -------------------------------- ### Example: Plot Hi-C Data with Heatmap Legend Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoHeatmapLegend.html Demonstrates plotting Hi-C data and adding a heatmap legend. Requires loading plotgardenerData and creating a plot page. ```R ## Load Hi-C data library(plotgardenerData) data("IMR90_HiC_10kb") ## Create page pageCreate(width = 4, height = 3.5, default.units = "inches") ## Plot and place a square Hi-C plot hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", ``` -------------------------------- ### Download and Read .cool file Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/readCool.html Demonstrates how to download an example .cool file and read a specific region with a given resolution. Ensure the file path and region parameters are correctly set for your data. ```R coolFile <- file.path(tempdir(), "Rao2014-IMR90-MboI-allreps-filtered.1000kb.cool") download.file(url = "https://usgs2.osn.mghpcc.org/cooler01/examples/hg19/Rao2014-IMR90-MboI-allreps-filtered.1000kb.cool", destfile = coolFile, mode = "wb") ## Read in region `chr2:10000000-22000000` at 1000Kb cool file resolution coolData <- readCool(file = coolFile, chrom = "chr2", chromstart = 10000000, chromend = 22000000, resolution = 1000000) #> Read in .cool file with NONE normalization at 1e+06 BP resolution. ``` -------------------------------- ### Load and Inspect Sample Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotgardener_meta_functions.html Loads the IMR90_ChIP_CTCF_reads dataset and displays the first few rows to show its structure, including columns like 'chrom', 'start', 'end', and 'strand'. ```r data("IMR90_ChIP_CTCF_reads") head(IMR90_ChIP_CTCF_reads) ``` -------------------------------- ### Load data and create plotgardener page Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Loads example multi-omic datasets and initializes a plotgardener page with specified dimensions and grid settings. Ensure necessary libraries are loaded before execution. ```R ## Load example data data("IMR90_HiC_10kb") data("IMR90_DNAloops_pairs") data("IMR90_ChIP_H3K27ac_signal") data("hg19_insulin_GWAS") ## Create a plotgardener page pageCreate( width = 3, height = 5, default.units = "inches", showGuides = FALSE, xgrid = 0, ygrid = 0 ) ``` -------------------------------- ### Get Default Packages for a Genome Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotgardener_meta_functions.html Retrieves the default annotation packages (TxDb, OrgDb, etc.) associated with a specified genome build. ```r defaultPackages("hg19") ``` -------------------------------- ### Create and Annotate Hi-C Plot Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoPixels.html This example demonstrates loading Hi-C and loop data, creating a page, plotting a square Hi-C plot, and then annotating loops on both sides of the plot with squares. ```r library(plotgardenerData) data("IMR90_HiC_10kb") data("IMR90_DNAloops_pairs") ## Create page pageCreate(width = 4.5, height = 4, default.units = "inches") ## Plot and place a square Hi-C plot hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 0.5, width = 3, height = 3, just = c("left", "top"), default.units = "inches" ) #> Read in dataframe. Assuming 'chrom' in column1 and 'altchrom' in column2. 10000 BP resolution detected. #> hicSquare[hicSquare1] ## Annotate loops of both sides of Hi-C plot with squares pixels <- annoPixels( plot = hicPlot, data = IMR90_DNAloops_pairs, type = "box", half = "both" ) #> pixel[pixel1] ``` -------------------------------- ### Plot rectangles with varied properties Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotRect.html Shows how to plot rectangles with differing widths, heights, positions, and colors. This example also demonstrates setting `linecolor = NA` to remove borders and using `alpha` for transparency. ```R plotRect( x = 3.75, y = c(4, 5.25), width = c(6.5, 4.5), height = c(1, 0.25), just = "top", default.units = "inches", fill = c("#7ecdbb", "#37a7db"), linecolor = NA, alpha = 0.4 ) #> #> rect[rect2] # ``` -------------------------------- ### Get Default Bioconductor Packages for an Assembly Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/bioconductor_integration.html Retrieve the default TxDb, OrgDb, and BSgenome packages for a specified genomic assembly. Useful for setting up standard genomic annotations. ```R defaultPackages("hg38") #> 'data.frame': 1 obs. of 6 variables: #> $ Genome : chr "hg38" #> $ TxDb : chr "TxDb.Hsapiens.UCSC.hg38.knownGene" #> $ OrgDb : chr "org.Hs.eg.db" #> $ gene.id.column: chr "ENTREZID" #> $ display.column: chr "SYMBOL" #> $ BSgenome : chr "BSgenome.Hsapiens.UCSC.hg38" ``` ```R defaultPackages("hg19") #> 'data.frame': 1 obs. of 6 variables: #> $ Genome : chr "hg19" #> $ TxDb : chr "TxDb.Hsapiens.UCSC.hg19.knownGene" #> $ OrgDb : chr "org.Hs.eg.db" #> $ gene.id.column: chr "ENTREZID" #> $ display.column: chr "SYMBOL" #> $ BSgenome : chr "BSgenome.Hsapiens.UCSC.hg19" ``` ```R defaultPackages("mm10") #> 'data.frame': 1 obs. of 6 variables: #> $ Genome : chr "mm10" #> $ TxDb : chr "TxDb.Mmusculus.UCSC.mm10.knownGene" #> $ OrgDb : chr "org.Mm.eg.db" #> $ gene.id.column: chr "ENTREZID" #> $ display.column: chr "SYMBOL" #> $ BSgenome : chr "BSgenome.Mmusculus.UCSC.mm10" ``` -------------------------------- ### Download and Read .mcool file at 100Kb resolution Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/readCool.html Shows how to download an example .mcool file and read a specific region at 100Kb resolution. This is useful for analyzing Hi-C data at finer scales. Note the chromosome is specified as '2' instead of 'chr2'. ```R mcoolFile <- file.path(tempdir(), "LEUK_HEK_PJA27_inter_30.mcool") download.file(url = "https://zenodo.org/records/10906240/files/LEUK_HEK_PJA27_inter_30.mcool?download=1", destfile = mcoolFile, mode = "wb") ## Read in region `chr2:1000000-5000000` at 100Kb resolution mcoolData_100Kb <- readCool(file = mcoolFile, chrom = "2", chromstart = 1000000, chromend = 5000000, resolution = 100000) #> Read in .mcool file with NONE normalization at 1e+05 BP resolution. ``` -------------------------------- ### Plotting Flipped Ideogram Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotIdeogram.html This example demonstrates how to plot a chromosome ideogram with reversed start and end positions by setting 'flip' to TRUE. This effectively reverses the direction of the ideogram. ```R library(plotgardener) pag <- pageCreate() # Plot flipped ideogram for chr1 plotIdeogram(chrom = "chr1", flip = TRUE) pageDraw(pag) ``` -------------------------------- ### Create a Page and Add Vertical Guideline Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideVertical.html Demonstrates how to initialize a plotgardener page and then add a blue vertical guideline at a specific x-coordinate. ```R pageCreate(width = 6, height = 5, default.units = "inches") ``` ```R pageGuideVertical(x = 1.7, linecolor = "blue") ``` -------------------------------- ### Plotting Ideogram with Custom Cytoband Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotIdeogram.html This example shows how to plot a chromosome ideogram using custom cytoband data provided as a data frame. The data frame must include columns: 'seqnames', 'start', 'end', 'width', 'strand', 'name', 'gieStain'. ```R library(plotgardener) pag <- pageCreate() # Define custom cytoband data (example for a small region) custom_cytobands <- data.frame( seqnames = rep("chr1", 3), start = c(1000000, 5000000, 10000000), end = c(4000000, 9000000, 15000000), width = c(3000000, 4000000, 5000000), strand = rep(".", 3), name = paste0("band", 1:3), gieStain = c("gneg", "gpos50", "gpos25") ) # Plot ideogram with custom data plotIdeogram(chrom = "chr1", data = custom_cytobands) pageDraw(pag) ``` -------------------------------- ### Hide Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideHide.html This snippet demonstrates how to hide the guides on a plotgardener page after it has been created. ```APIDOC ## pageGuideHide() ### Description Remove guides from a plotgardener page. ### Method pageGuideHide() ### Parameters None ### Response None. ### Note Due to the implementation of `grid` removal functions, using `pageGuideHide` within a `pdf` call will result in the rendering of a separate, new page with the plot guides removed. To avoid this artifact, hide guides in the `pageCreate` function call with `showGuides = FALSE`. ### Example ```R ## Make a page pageCreate(width = 7, height = 4, default.units = "inches") ## Hide page guides pageGuideHide() ``` ``` -------------------------------- ### Create a Custom Sized Page with Custom Gridlines Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotgardener_page.html Demonstrates creating a page with specified dimensions, units, and custom grid spacing using `pageCreate`. ```r pageCreate(width = 8, height = 8, xgrid = 1, ygrid = 1, default.units = "cm") ``` -------------------------------- ### Hide Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoHighlight.html Hides the page guides, which are visual aids for plot layout. ```APIDOC ## pageGuideHide ### Description Hides the page guides. ### Method `pageGuideHide()` ### Parameters None ### Returns None ``` -------------------------------- ### Create a Page and Add Horizontal Guideline Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideHorizontal.html Demonstrates how to initialize a plotgardener page and add a horizontal guideline at a specific y-coordinate with a custom color. ```r pageCreate(width = 6, height = 5, default.units = "inches") ## Add red horizontal guideline at y = 2.5 inches pageGuideHorizontal(y = 2.5, linecolor = "red") ``` -------------------------------- ### Create and Plot Raster Images Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/ideograms_and_shapes.html Demonstrates creating a page and plotting two raster images (pg_type and gene_gnome) at specified coordinates and dimensions. Ensure the 'plotgardener' package is loaded. ```R library(plotgardener) pageCreate( width = 5, height = 6, default.units = "inches", showGuides = FALSE, xgrid = 0, ygrid = 0 ) plotRaster( image = pg_type, x = 2.5, y = 0.25, width = 4, height = 1.5, just = "top" ) plotRaster( image = gene_gnome, x = 2.5, y = 1, width = 3.5, height = 3.5, just = "top" ) ``` -------------------------------- ### Hide Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/pageGuideHide.html Call pageGuideHide() to remove guides from the current plotgardener page. Note: Using this function within a pdf call will render a new page with guides removed. To avoid this, set showGuides = FALSE in pageCreate. ```r pageCreate(width = 7, height = 4, default.units = "inches") pageGuideHide() ``` -------------------------------- ### Remove All Guides from the Page Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotgardener_page.html Call `pageGuideHide()` to remove all previously added horizontal and vertical guides from the plot page. ```r ## Create page pageCreate(width = 3, height = 3, default.units = "inches") ``` ```r ## Remove guides pageGuideHide() ``` -------------------------------- ### Initialize plotgardener page and load data Source: https://github.com/phanstiellab/plotgardener/blob/devel/README.md Loads necessary libraries and datasets, then creates a new plotgardener page with specified dimensions. This sets up the canvas for subsequent plotting. ```r ## Load libraries and datasets library("plotgardener") library("org.Hs.eg.db") library("TxDb.Hsapiens.UCSC.hg19.knownGene") library("plotgardenerData") library("AnnotationHub") data("GM12878_HiC_10kb") data("IMR90_HiC_10kb") data("GM12878_ChIP_CTCF_signal") data("IMR90_ChIP_CTCF_signal") data("GM12878_ChIP_H3K27ac_signal") data("IMR90_ChIP_H3K27ac_signal") ## Create a plotgardener page pageCreate(width = 7, height = 4.25, default.units = "inches") ``` -------------------------------- ### Hide plotgardener Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/introduction_to_plotgardener.html Hides all page guides created by pageCreate(). This is typically done before exporting the plot. ```R pageGuideHide() ``` -------------------------------- ### Add Specific Horizontal and Vertical Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotgardener_page.html Use `pageGuideHorizontal` and `pageGuideVertical` to add specific guide lines to the plot page after creation. ```r pageCreate(width = 3, height = 3, default.units = "inches") ## Add a horizontal guide at y = 2.25 inches pageGuideHorizontal(y = 2.25, default.units = "inches") ## Add a vertical guide at x = 0.75 inches pageGuideVertical(x = 0.75, default.units = "inches") ``` -------------------------------- ### Hide Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotRanges.html Hides the page guides, which are typically used for layout and alignment during plot creation. This is usually called at the end of the plotting process. ```R ## Hide page guides pageGuideHide() ``` -------------------------------- ### Load plotgardener and Plot Example GWAS Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/introduction_to_plotgardener.html Loads the plotgardener library, necessary annotation packages, example GWAS data, and generates a quick Manhattan plot. ```R library(plotgardener) ## Load hg19 genomic annotation packages library(TxDb.Hsapiens.UCSC.hg19.knownGene) ## Load example GWAS data library(plotgardenerData) data("hg19_insulin_GWAS") ## Quick plot GWAS data plotManhattan( data = hg19_insulin_GWAS, assembly = "hg19", fill = c("steel blue", "grey"), ymax = 1.1, cex = 0.20 ) ``` -------------------------------- ### Create Plotting Page and Plot Signal Tracks Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Initialize a plotting page and then plot multiple signal tracks, ensuring they are aligned by specifying common parameters and positioning. ```R ## Create a page pageCreate(width = 7.5, height = 2.1, default.units = "inches", showGuides = FALSE, xgrid = 0, ygrid = 0) ## Plot and place signal plots signal1 <- plotSignal( data = IMR90_ChIP_H3K27ac_signal, params = params, x = 0.5, y = 0.25, width = 6.5, height = 0.65, just = c("left", "top"), default.units = "inches" ) signal2 <- plotSignal( data = GM12878_ChIP_H3K27ac_signal, params = params, linecolor = "#7ecdbb", x = 0.5, y = 1, width = 6.5, height = 0.65, just = c("left", "top"), default.units = "inches" ) ``` -------------------------------- ### Annotate Genome Label and Hide Page Guides Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/index.html This snippet demonstrates annotating a genome label and hiding page guides. Ensure the plot object and parameters are correctly specified. ```R ## Annotate genome label annoGenomeLabel(plot = genes_imr, params = params_d, scale = "Kb", fontsize = 7, digits = 0, y = 3.85, just = c("right", "top")) ## Hide page guides pageGuideHide() ``` -------------------------------- ### Create Page and Plot Signal Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoHighlight.html Initializes a plotgardener page and plots a signal track. This sets up the canvas and the primary plot before annotation. ```R pageCreate(width = 7.5, height = 1.5, default.units = "inches") library(plotgardenerData) data("IMR90_ChIP_H3K27ac_signal") region <- pgParams( chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", range = c(0, 45) ) signalPlot <- plotSignal( data = IMR90_ChIP_H3K27ac_signal, params = region, x = 0.5, y = 0.25, width = 6.5, height = 0.65, just = c("left", "top"), default.units = "inches" ) #> signal[signal1_h] ``` -------------------------------- ### readCoolBpResolutions Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/readCoolBpResolutions.html Reads basepair resolutions from a specified .mcool file. ```APIDOC ## readCoolBpResolutions ### Description Reads basepair resolutions from an .(m)cool file. ### Arguments #### Path Parameters - **file** (character) - Description: A character value specifying the path to the .(m)cool file. ### Value Vector of basepair resolutions ``` -------------------------------- ### Plot Genome Label Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Adds a genome label to the plot, indicating scale and chromosome. Requires chromosome, start, end, and assembly. ```R plotGenomeLabel( chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 4.5, length = 2, scale = "Mb", just = c("left", "top"), default.units = "inches" ) ``` -------------------------------- ### Plotting and Placing a Hi-C Square Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotHicSquare.html This example demonstrates how to plot a Hi-C square with specified genomic regions, resolution, color range, and placement parameters. It also shows how to annotate the plot with a heatmap legend and genome labels. ```R library(plotgardenerData) data("IMR90_HiC_10kb") ## Create a page pageCreate(width = 3, height = 3, default.units = "inches") ## Plot and place Hi-C plot hicPlot <- plotHicSquare( data = IMR90_HiC_10kb, resolution = 10000, zrange = c(0, 70), chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 0.5, width = 2, height = 2, just = c("left", "top"), default.units = "inches", bg = "black" ) #> Read in dataframe. Assuming 'chrom' in column1 and 'altchrom' in column2. 10000 BP resolution detected. #> hicSquare[hicSquare1] ## Annotate heatmap legend annoHeatmapLegend( plot = hicPlot, x = 2.6, y = 0.5, width = 0.12, height = 1.2, just = c("left", "top"), default.units = "inches" ) #> heatmapLegend[heatmapLegend1] ## Annotate x-axis and y-axis genome labels annoGenomeLabel( plot = hicPlot, scale = "Mb", axis = "x", x = 0.5, y = 2.53, just = c("left", "top") ) #> genomeLabel[genomeLabel1] annoGenomeLabel( plot = hicPlot, scale = "Mb", axis = "y", x = 0.47, y = 0.5, just = c("right", "top") ) #> genomeLabel[genomeLabel2] ## Hide page guides pageGuideHide() ``` -------------------------------- ### plotGG Function Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotGG.html This snippet details the plotGG function, its parameters, and provides an example of its usage for placing a ggplot object within a plotgardener layout. ```APIDOC ## plotGG ### Description Plot a ggplot2 plot, gtable, or grob object in a plotgardener layout. ### Signature plotGG( plot, x, y, width, height, just = c("left", "top"), default.units = "inches", params = NULL ) ### Arguments * **plot** (ggplot, gtable, or grob object): The plot object to be placed. * **x** (numeric or unit object): The x-location for the plot. * **y** (numeric, unit object, or character): The y-location for the plot. Can be a character string like "b10" to place relative to the bottom of the page. * **width** (numeric or unit object): The width of the plot. * **height** (numeric or unit object): The height of the plot. * **just** (character vector): Justification of the plot relative to its (x, y) location. Defaults to `c("left", "top")`. * **default.units** (string): Default units for `x`, `y`, `width`, and `height` if specified as numerics. Defaults to "inches". * **params** (pgParams object, optional): Additional parameters for the plot. ### Value Returns a `pg_gg` object containing placement and grob information. ### Example ```R library(ggplot2) # Create a sample ggplot object p <- ggplot(mtcars) + geom_point(aes(mpg, disp)) # Create a plotgardener page pageCreate(width = 4, height = 4, default.units = "inches") # Place the ggplot object on the page plotGG( plot = p, x = 0.5, y = 0.5, width = 3, height = 3, just = c("left", "top"), default.units = "inches" ) # Add a title plotText(label = "mtcars", fontsize = 14, fontface = "bold", x = 1, y = 0.35) # Hide page guides pageGuideHide() ``` ``` -------------------------------- ### Plot Loop Annotations Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Visualizes DNA loop annotations using arches. Requires loop data, chromosome, start, end, and assembly. ```R plotPairsArches( data = IMR90_DNAloops_pairs, chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 2.5, width = 2, height = 0.25, just = c("left", "top"), default.units = "inches", fill = "black", linecolor = "black", flip = TRUE ) ``` -------------------------------- ### .coolAutoResolution Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/dot-coolAutoResolution.html Determines the best resolution for .(m)cool files based on the size of the region. ```APIDOC ## .coolAutoResolution ### Description Determines the best resolution for .(m)cool files based on the size of the region. ### Arguments * **file** (Path to .(m)cool file) * **chromstart** (Chromstart of region) * **chromend** (Chromend of region) ``` -------------------------------- ### Plotting a Basic Chromosome Ideogram Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotIdeogram.html This snippet demonstrates how to plot a basic chromosome ideogram for a specified chromosome. Ensure the 'plotgardener' package is installed and loaded. ```R library(plotgardener) # Create a plotgardener page object pag <- pageCreate() # Plot the ideogram for chromosome 1 plotIdeogram(chrom = "chr1") # Draw the plot\npageDraw(pag) ``` -------------------------------- ### Plot Signal Track Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/introduction_to_plotgardener.html Quickly plot signal data using the plotSignal function. Requires loading plotgardener and example signal data. ```R library(plotgardener) ## Load example signal data library(plotgardenerData) data("IMR90_ChIP_H3K27ac_signal") ## Quick plot signal data plotSignal( data = IMR90_ChIP_H3K27ac_signal, chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19" ) ``` -------------------------------- ### Create a plotgardener Page Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/index.html Initialize a new plotgardener page with specified dimensions and units. This sets up the canvas for subsequent plot elements. ```R pageCreate(width = 7, height = 4.25, default.units = "inches") ``` -------------------------------- ### Plot Hi-C Square Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/introduction_to_plotgardener.html Quickly plot Hi-C data using the plotHicSquare function. Requires loading plotgardener and example Hi-C data. ```R library(plotgardener) ## Load example Hi-C data library(plotgardenerData) data("IMR90_HiC_10kb") ## Quick plot Hi-C data plotHicSquare( data = IMR90_HiC_10kb, chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19" ) ``` -------------------------------- ### Plot Hi-C Data Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/articles/guides/plotting_multiomic_data.html Plots Hi-C data for a specified genomic region. Requires Hi-C data, chromosome, start, end, and assembly information. ```R plotHicSquare( data = IMR90_HiC_10kb, chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 0.5, width = 2, height = 2, just = c("left", "top"), default.units = "inches" ) ``` -------------------------------- ### Create Plotting Page Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotGenomeLabel.html Initializes a new plotting page with specified dimensions and default units. This sets up the canvas for subsequent plotting functions. ```r pageCreate(width = 5, height = 3, default.units = "inches") ``` -------------------------------- ### Load and Plot Raster Images Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/plotRaster.html Loads PNG images using readPNG and plots them onto a plotgardener page. Demonstrates different justification options. ```R library(png) ## Load images pg_type <- readPNG(system.file("images", "pg-wordmark.png", package = "plotgardener" )) gene_gnome <- readPNG(system.file("images", "pg-gnome-hole-shadow.png", package = "plotgardener" )) rlogo <- readPNG(system.file("images", "Rlogo.png", package = "plotgardener")) ## Create page pageCreate(width = 5, height = 6) ## Plot images plotRaster( image = pg_type, x = 2.5, y = 0.25, width = 4, height = 1.5, just = "top" ) plotRaster( image = gene_gnome, x = 2.5, y = 2.25, width = 3.5, height = 3.5, just = "top" ) plotRaster( image = rlogo, x = 1, y = 1.5, width = 0.5, height = 0.45, just = c("left", "top") ) ## Hide page guies pageGuideHide() ``` -------------------------------- ### Plot Genome Label Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoHighlight.html Plots a label for a specified genomic region. Allows customization of chromosome, start and end positions, assembly, and plot dimensions. ```APIDOC ## plotGenomeLabel ### Description Plots a label for a specified genomic region. ### Parameters - **chrom** (string) - The chromosome to plot. - **chromstart** (numeric) - The starting position on the chromosome. - **chromend** (numeric) - The ending position on the chromosome. - **assembly** (string) - The genome assembly (e.g., "hg19"). - **x** (numeric) - The x-coordinate for the label. - **y** (numeric) - The y-coordinate for the label. - **length** (numeric) - The length of the label. - **default.units** (string) - The default units for length (e.g., "inches"). ### Returns #> genomeLabel[genomeLabel1] ``` -------------------------------- ### Plot Genome Label Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/annoHighlight.html Plots a label for a specific genomic region. Specify the chromosome, start and end coordinates, assembly, and desired position and size. ```r plotGenomeLabel( chrom = "chr21", chromstart = 28000000, chromend = 30300000, assembly = "hg19", x = 0.5, y = 1.3, length = 6.5, default.units = "inches" ) ``` -------------------------------- ### assembly() Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/reference/index.html Make an `assembly` object for alternate TxDb, OrgDb, and BSgenome genomic annotation packages. ```APIDOC ## assembly() ### Description Make an `assembly` object for alternate TxDb, OrgDb, and BSgenome genomic annotation packages. ### Method Function Call ### Endpoint N/A (R function) ### Parameters * **genome**: The name of the genome assembly. * **...**: Additional arguments for specifying annotation packages. ``` -------------------------------- ### Define plotgardener Parameters Source: https://github.com/phanstiellab/plotgardener/blob/devel/docs/index.html Set genomic and dimension parameters for a plot using the `pgParams` function. This specifies the chromosome, start, and end coordinates for the visualization. ```R params_a <- pgParams(chrom = "chr21", chromstart = 28000000, chromend = 30300000) ```