layout_circle {ggbio} | R Documentation

## Create a circle layout

### Description

Create a circle layout.

### Usage

    ## S4 method for signature 'GRanges'
    layout_circle(data, ..., geom = c("point", "line", "link", "ribbon",
                     "rect", "bar", "segment", "hist", "scale", "heatmap", "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,
                     ylim = NULL,
                     scale.n = 60, scale.unit = NULL, scale.type = c("M",
                     "B", "sci"), grid.n = 5, grid.background = "gray70",
                     grid.line = "white", grid = FALSE, chr.weight = NULL)

    ## S4 method for signature 'missing'
    layout_circle(data, ...)
    circle(...)

### Arguments

`data` | A `GRanges` object.
`...` | Extra parameters such as aesthetics mapping in aes(), or `color, size`, etc. For circle function, it passed to `layout_circle`.
`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 `GRanges` object.
`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 `GRanges`) to the whole track space.
`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.
`ylim` | Numeric range to control y limits.
`scale.n` | Approximate number of ticks you want to show on the whole space. used when scale.unit is `NULL`.
`scale.unit` | Unit used for computing scale. Default is `NULL`,
`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.
`chr.weight` | numeric vectors which sum to <1, the names of vectors has to be matched with seqnames in seqinfo, and you can only specify part of the seqnames, other lengths of chromosomes will be assined proportionally to their seqlengths, for example, you could specify chr1 to be 0.5, so the chr1 will take half of the space and other chromosomes squeezed to take left of the space.

### Value

A 'Layer'.

### Author(s)

Tengfei Yin

### Examples

    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)

[Package ggbio version 1.34.0 Index]