View source: R/addAlignments.R
addAlignments | R Documentation |
This function takes a ggplot2
object generated using plotMiro
function and adds extra PAF alignments to it
stored in the 'paf.table'. This function can also be used to highlight already present alignment or to add other features such as
alignment gaps reported by the paf2gaps
function.
addAlignments(
ggplot.obj = NULL,
paf.table = NULL,
color.by = NULL,
color.palette = NULL,
fill.by = NULL,
fill.palette = NULL,
outline.alignments = FALSE,
linetype = "solid",
coord.strict = TRUE,
sync.x.coordinates = TRUE
)
ggplot.obj |
A |
paf.table |
A |
color.by |
A name of a column present in submitted 'paf.table'.to be used to define color scheme. |
color.palette |
A discrete color palette defined as named character vector (elements = colors, names = discrete levels). |
fill.by |
A name of a column present in submitted 'paf.table'.to be used to define fill scheme. |
fill.palette |
Same as parameter 'color.palette'. |
outline.alignments |
Set to |
linetype |
One of the following types ['solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash']. |
coord.strict |
If set to |
sync.x.coordinates |
If set to |
A ggplot2
object.
David Porubsky
## Get PAF to process ##
paf.file <- system.file("extdata", "test1.paf", package = "SVbyEye")
## Read in PAF
paf.table <- readPaf(paf.file = paf.file, include.paf.tags = TRUE, restrict.paf.tags = "cg")
## Make a plot
plt <- plotMiro(paf.table = paf.table)
## Report gaps between PAF alignments
paf.gaps <- paf2gaps(paf.table = paf.table)
## Add annotation field for plotting
paf.gaps$SV <- "INS"
paf.gaps$SV[grep(paf.gaps$cg, pattern = "D", ignore.case = TRUE)] <- "DEL"
## Define color palette for plotting
color.palette <- c("DEL" = "firebrick3", "INS" = "dodgerblue3")
## Add gap position to the plot as extra PAF alignmetns
addAlignments(
ggplot.obj = plt, paf.table = paf.gaps,
color.by = "SV", color.palette = color.palette, linetype = "dashed"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.