kpPlotLinks | R Documentation |
Given 2 GRanges
objects, plot lines or ribbons between region pairs
kpPlotLinks(karyoplot, data, data2=NULL, y=0, arch.height=NULL, data.panel=1, r0=NULL, r1=NULL, ymin=NULL, ymax=NULL, col="#8e87eb", border=NULL, clipping=TRUE, ...)
karyoplot |
(a |
data |
(a |
data2 |
(a |
y |
(numeric) The y value where the origin and end of the links should be plotted (Defaults to 0) |
arch.height |
(numeric) The approximate arch height in links in the same chromosome in "y" scale. If NULL, it defaults to the whole span of the data panel.Also affects the curvature of links between chromosomes (Defaults to NULL) |
data.panel |
(numeric) The identifier of the data panel where the data is to be plotted. The available data panels depend on the plot type selected in the call to |
r0 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
r1 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
ymin |
(numeric) The minimum value to be plotted on the data panel. If NULL, it is set to 0. (deafults to NULL) |
ymax |
(numeric) The maximum value to be plotted on the data.panel. If NULL the maximum density is used. (defaults to NULL) |
col |
(color) The background color of the links. If NULL and border is specified, it defaults to a lighter version of border. |
border |
(color) The border color of the links. If NULL and col is specified, it defaults to a darker version of col. |
clipping |
(boolean) Only used if zooming is active. If TRUE, the data representation will be not drawn out of the drawing area (i.e. in margins, etc) even if the data overflows the drawing area. If FALSE, the data representation may overflow into the margins of the plot. (defaults to TRUE) |
... |
The ellipsis operator can be used to specify any additional graphical parameters. Any additional parameter will be passed to the internal calls to the R base plotting functions. |
This is one of the high-level, or specialized, plotting functions of karyoploteR.
It takes two GRanges
objects (or a single specially crafted one) and
plots links (either lines or ribbons) between region pairs. Links are
plotted bewteen the first region of both objects, between the second one, etc...
and therefore both objects need to have the same length. Specifying a region
as negative strand, will "flip" it, so the the start of a region can be
linked to the end of its pair.
Returns the original karyoplot object, unchanged.
For a link to be plotted BOTH ends must be visible in the karyoplot. In
particular, if a chromosome is not included in the plot (due to not
being specified in chromosomes
, for example) any link with an end
on it will NOT be plotted. The same is true for zoomed in plots, where only
intrachromosomal links will be visible. No warning or message will be
generated.
plotKaryotype
, kpPlotRibbon
, kpSegments
set.seed(222)
starts <- sort(createRandomRegions(nregions = 15))
ends <- sort(createRandomRegions(nregions = 15))
kp <- plotKaryotype()
kpPlotLinks(kp, data=starts, data2=ends)
#Create larger regions, so they look like ribbons
starts <- sort(createRandomRegions(nregions = 15, length.mean = 8e6, length.sd = 5e6))
ends <- sort(createRandomRegions(nregions = 15, length.mean = 8e6, length.sd = 5e6))
kp <- plotKaryotype()
kpPlotLinks(kp, data=starts, data2=ends)
#flip some of them to represent inversions
strand(ends) <- sample(c("+", "-"), length(ends), replace = TRUE)
kp <- plotKaryotype()
kpPlotLinks(kp, data=starts, data2=ends)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.