View source: R/plot_riparian.R
plot_riparian | R Documentation |
plot_riparian
Updated and more accurate version of plot_riparian
plot_riparian
The main GENESPACE plotting routine, which generate
braided river or 'riparian' plots.
riparian_engine
underlying routines for plot_riparian, related to
plotting and data parsing.
calc_curvePolygon
from 2d coordinates, make a curve
round_rect
from x-y coordinates, make a rounded rectangle
plot_riparian(
gsParam,
genomeIDs = gsParam$genomeIDs,
refGenome = NULL,
highlightBed = NULL,
blk = NULL,
backgroundColor = add_alpha("grey20", 0.5),
pdfFile = NULL,
useRegions = TRUE,
labelTheseGenomes = gsParam$genomeIDs,
useOrder = TRUE,
gapProp = 0.005,
chrFill = "white",
scalePlotHeight = 1,
scalePlotWidth = 1,
minChrLen2plot = ifelse(useOrder, 100, 1e+05),
braidAlpha = 0.5,
scaleBraidGap = 0,
reorderBySynteny = TRUE,
howSquare = 0,
customRefChrOrder = NULL,
palette = gs_colors,
chrLabFontSize = 5,
chrExpand = 0.5,
chrBorderCol = chrFill,
syntenyWeight = 0.5,
chrBorderLwd = 0.2,
inversionColor = NULL,
invertTheseChrs = NULL,
forceRecalcBlocks = TRUE,
chrLabFun = function(x) gsub("^0", "", gsub("chr|scaf|chromosome|scaffold|^lg|_", "",
tolower(x))),
xlabel = sprintf("Chromosomes scaled by %s", ifelse(useOrder, "gene rank order",
"physical position")),
scaleGapSize = 0.25,
addThemes = NULL,
verbose = FALSE,
refChrOrdFun = function(x) frank(list(as.numeric(gsub("\\D+", "", x)), x),
ties.method = "random")
)
riparian_engine(
blk,
bed,
refGenome = NULL,
genomeIDs = NULL,
theseBlocksFirst = NULL,
labelTheseGenomes = NULL,
useOrder = TRUE,
gapProp = 0.005,
chrFill = "white",
chrLabFontSize = 5,
minChrLen2plot = ifelse(useOrder, 100, 1e+05),
braidAlpha = 0.5,
scaleBraidGap = 0,
reorderBySynteny = TRUE,
howSquare = 0,
chrExpand = 0.5,
chrBorderCol = NA,
chrBorderLwd = 0,
customRefChrOrder = NULL,
palette = gs_colors,
inversionColor = NULL,
invertTheseChrs = NULL,
syntenyWeight = 0.5,
chrLabFun = function(x) gsub("^0", "", gsub("chr|scaf|chromosome|scaffold|^lg|_", "",
tolower(x))),
xlabel = sprintf("Chromosomes scaled by %s", ifelse(useOrder, "gene rank order",
"physical position")),
scaleGapSize = 0.25,
addThemes = NULL,
verbose = FALSE,
refChrOrdFun = function(x) frank(list(as.numeric(gsub("\\D+", "", x)), x),
ties.method = "random")
)
calc_curvePolygon(
start1,
end1 = NULL,
start2,
end2 = NULL,
y1,
y2,
npts = 250,
keepat = round(npts/20)
)
round_rect(
xleft,
ybottom,
xright,
ytop,
plotWidth,
plotHeight,
xrange,
yrange,
npts = 50
)
gsParam |
A list of genespace parameters. This should be created by setup_genespace, but can be built manually. Must have the following elements: blast (file.path to the original orthofinder run), synteny ( file.path to the directory where syntenic results are stored), genomeIDs ( character vector of genomeIDs). |
genomeIDs |
character vector at least partially matching the genomeIDs in gsParam |
refGenome |
single character string specifying which genome is the ref |
highlightBed |
data.frame (or coercible to a data.frame, e.g. data.table) with four required columns: genome, chr, start, end ... these are the bp coordinates of the regions of interest. Can also include a column "color" with the desired color to plot for that particular regions. This can be used to color chromosomes in polyploid references. |
blk |
data.table of block coordinates |
backgroundColor |
character or integer coercible to an R color. Only used if highlightBed is also specified. This is background to show all blocks across references. If the full background is not desired, can be set to NULL or NA. In which case the plot will ONLY contain the regions specified in highlightBed. |
pdfFile |
file.path to the pdf device to store the file |
useRegions |
logical, should regions or smaller blocks be plotted? |
labelTheseGenomes |
character string of genomes that have labeled chrs |
useOrder |
logical, should gene rank order be used in lieu of physical positions? |
gapProp |
numeric (0-1) specifying the proportional size of gaps relative to the length of the largest genome |
chrFill |
character or integer coercible to an R color for the interior fill of the chromosome regions |
scalePlotHeight |
numeric, scaling factor for plot height Larger values make taller plots |
scalePlotWidth |
numeric, scaling factor for plot width. Larger values make wider plots |
minChrLen2plot |
replaces previous minSize2plot. Minimum size in the scale plotted (order if useOrder = TRUE, bp if useOrder = FALSE) |
braidAlpha |
numeric (0-1) specifying the transparency of the braids |
scaleBraidGap |
integer specifying how much of a gap should exist between the center of the chromosome labels (y position) and the begining of the braid polygons. 0 = no gap between braids, 1 = gap equal to the vertical size of the chromosome polygons so that the braids start and the bottom/top of the chromosome polygons. Scales linearly form there. |
reorderBySynteny |
logical, should chromosomes be re-ordered by synteny? |
howSquare |
numeric 0-inf, specifying how square the rounded rectangles should be. 0 = no straight sections. Inf = no rounded sections |
customRefChrOrder |
character vector with the order of chromosomes in the reference genome |
palette |
function coercible to an R color palette |
chrLabFontSize |
size in points for the chromosome labels |
chrExpand |
numeric giving the expansion of the chromosome polygons surrounding the chromosome labels. |
chrBorderCol |
color of the chromosome polygon borders |
syntenyWeight |
currently can be 0,.5,1. 0 is equivalent to reorderBySynteny = FALSE. 1 is the previous behavior (synteny is fully respected). Anything between 0 |
chrBorderLwd |
line width of the chromosome polygon borders |
inversionColor |
= NULL, |
invertTheseChrs |
data.table with two columns, genome and chr containing the lists of genomes and chromosomes that should be inverted in the plot. Not currently implemented. |
forceRecalcBlocks |
logical, should the phased blocks be re-calculated even if there is a phased block file. |
chrLabFun |
function to parse chr IDs to make them more readible |
xlabel |
label for the x axis of the plot |
scaleGapSize |
numeric 0-1, specifying the gap scaling level, where 0 means all gaps are the same size regardless of genome size. 1 means that the genomes sizes are all nearly the same and smaller genomes have larger gaps. |
addThemes |
ggplot2 themes to add to the riparian plot |
verbose |
logical, should updates be printed to the console? |
refChrOrdFun |
function, to re-order reference chromosomes |
bed |
data.table with combined bed file |
theseBlocksFirst |
internal parameter specifying which blocks should be plotted first |
start1 |
numeric, start postion of the first block |
end1 |
numeric, end postion of the first block |
start2 |
numeric, start postion of the second block |
end2 |
numeric, end postion of the second block |
y1 |
numeric, bottom postion of the block |
y2 |
numeric, top postion of the block |
npts |
integer, the number of points to use in the curve. |
keepat |
integer, the grid size of points to keep |
xleft |
numeric, left position of rounded rectangle |
ybottom |
numeric, bottom position of rounded rectangle |
xright |
numeric, right position of rounded rectangle |
ytop |
numeric, top position of rounded rectangle |
plotWidth |
numeric, width of the plot |
plotHeight |
numeric, height of the plot |
xrange |
numeric, x range of data |
yrange |
numeric, y range of the data |
By default, acts directly on the reference-phased syntenic block coordinates generated by integrate_synteny(). Uses these positions to generate linear coordinates for block breakpoints and colors these by the reference genome chromosomes.
## Not run:
# see vignette dedicated to plot_riparian, coming soon.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.