layout_circle {ggbio} | R Documentation |
Create a circle layout.
## S4 method for signature 'GRanges' layout_circle(data, ..., geom = c("point", "line", "link", "ribbon", "rect", "bar", "segment", "hist", "scale", "ideogram", "text"), linked.to, radius = 10, trackWidth = 5, space.skip = 0.015, direction = c("clockwise", "anticlockwise"), link.fun = function(x, y, n = 30) bezier(x, y, evaluation = n), rect.inter.n = 60, rank, scale.n = 60, scale.unit = NULL, scale.type = c("M", "B", "sci"), grid.n = 5, grid.background = "gray70", grid.line = "white", grid = FALSE) ## S4 method for signature 'missing' layout_circle(data, ...)
data |
A |
... |
Extra parameters such as aesthetics mapping in aes(), or
|
geom |
The geometric object to use display the data. |
linked.to |
Character indicates column that specifying end of the linking lines,
that column should be a |
radius |
Numeric value indicates radius. Default is 10. |
trackWidth |
Numeric value indicates the track width. |
space.skip |
Numeric value indicates the ratio of skipped region between chunks(chromosomes
in |
direction |
Space layout orders. |
link.fun |
Function used for interpolate the linking lines. Default is Hmisc::bezier. |
rect.inter.n |
n passed to interpolate function in rectangle transformation(from a rectangle) to a section in circular view. |
rank |
For default equal trackWidth, use rank to specify the circle orders. |
scale.n |
Approximate number of ticks you want to show on the whole
space. used when scale.unit is |
scale.unit |
Unit used for computing scale. Default is |
scale.type |
Scale type used for |
grid |
logical value indicate showing grid background for track or not. |
grid.n |
integer value indicate horizontal grid line number. |
grid.background |
grid background color. |
grid.line |
grid line color. |
A 'Layer'.
Tengfei Yin
N <- 100
library(GenomicRanges)
## ======================================================================
## simmulated GRanges
## ======================================================================
gr <- GRanges(seqnames =
sample(c("chr1", "chr2", "chr3"),
size = N, replace = TRUE),
IRanges(
start = sample(1:300, size = N, replace = TRUE),
width = sample(70:75, size = N,replace = TRUE)),
strand = sample(c("+", "-", "*"), size = N,
replace = TRUE),
value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),
sample = sample(c("Normal", "Tumor"),
size = N, replace = TRUE),
pair = sample(letters, size = N,
replace = TRUE))
seqlengths(gr) <- c(400, 500, 700)
values(gr)$to.gr <- gr[sample(1:length(gr), size = length(gr))]
## doesn't pass gr to the ggplot
ggplot() + layout_circle(gr, geom = "ideo", fill = "gray70", radius = 7, trackWidth = 3) +
layout_circle(gr, geom = "bar", radius = 10, trackWidth = 4, aes(fill = score, y = score)) +
layout_circle(gr, geom = "point", color = "red", radius = 14,
trackWidth = 3, grid = TRUE, aes(y = score)) +
layout_circle(gr, geom = "link", linked.to = "to.gr", radius = 6,
trackWidth = 1)
## more formal API
ggplot(gr) + layout_circle(geom = "ideo", fill = "gray70", radius = 7, trackWidth = 3) +
layout_circle(geom = "bar", radius = 10, trackWidth = 4, aes(fill = score, y = score)) +
layout_circle(geom = "point", color = "red", radius = 14,
trackWidth = 3, grid = TRUE, aes(y = score)) +
layout_circle(geom = "link", linked.to = "to.gr", radius = 6, trackWidth = 1)