CustomTrack-class {Gviz} | R Documentation

## CustomTrack class and methods

### Description

A fully customizable track object to be populated via a user-defined plotting function.

### Usage

    CustomTrack(plottingFunction=function(GdObject, prepare=FALSE, ...){},
                variables=list(), name="CustomTrack",  ...)

### Arguments

`plottingFunction` | A user-defined function to be executed once the track coordinates have been properly set up. The function needs to accept two mandatory arguments: `GdObject`, the `CustomTrack` object to be plotted, and `prepare`, a logical flag indicating whether the function has been called in preparation mode or in drawing mode. It also needs to return the input `GdObject`, potentially with modifications.
`variables` | A list of additional variables for the user-defined plotting function.
`name` | Character scalar of the track's name.
`...` | Additional items which will all be interpreted as further display parameters. See `settings` and the "Display Parameters" section below for details.

### Details

A track to allow for any sort of plotting, with the currently displayed genomic location set. Essentially this acts as a simple callback into the `Gviz` plotting machinery after all the track panels and coordinates have been set up. It is entirely up to the user what to plot in the track, or even to use the predefined coordinate system. The only prerequesite is that all plotting operations need to utilize Grid graphics.

### Value

The return value of the constructor function is a new object of class `CustomTrack`.

### Objects from the Class

Objects can be created using the constructor function `CustomTrack`.

### Slots

`plottingFunction`:

  Object of class `"function"`, holding the user-defined plotting function.

`variables`:

  Object of class `"list"`, additional variables for the plotting function.

`dp`:

  Object of class `DisplayPars`, inherited from class `GdObject`

`name`:

  Object of class `"character"`, inherited from class `GdObject`

`imageMap`:

  Object of class `ImageMap`, inherited from class `GdObject`

### Extends

Class `"GdObject"`, directly.

### Methods

In the following code chunks, `obj` is considered to be an object of class `CustomTrack`.

Internal methods:

initialize

  `signature(.Object="CustomTrack")`: initialize the object.

Inherited methods:

displayPars

  `signature(x="CustomTrack", name="character")`: list the value of the display parameter `name`. See `settings` for details on display parameters and customization.

  Usage:

  `displayPars(x, name)`

  Examples:

    `displayPars(obj, "col")`

displayPars

  `signature(x="CustomTrack", name="missing")`: list the value of all available display parameters. See `settings` for details on display parameters and customization.

  Examples:

    `displayPars(obj)`

getPar

  `signature(x="CustomTrack", name="character")`: alias for the `displayPars` method. See `settings` for details on display parameters and customization.

  Usage:

  `getPar(x, name)`

  Examples:

    `getPar(obj, "col")`

getPar

  `signature(x="CustomTrack", name="missing")`: alias for the `displayPars` method. See `settings` for details on display parameters and customization.

  Examples:

    `getPar(obj)`

displayPars<-

  `signature(x="CustomTrack", value="list")`: set display parameters using the values of the named list in `value`. See `settings` for details on display parameters and customization.

  Usage:

  `displayPars<-(x, value)`

  Examples:

    `displayPars(obj) <- list(col="red", lwd=2)`

setPar

  `signature(x="CustomTrack", value="character")`: set the single display parameter `name` to `value`. Note that display parameters in the `CustomTrack` class are pass-by-reference, so no re-assignmnet to the symbol `obj` is necessary. See `settings` for details on display parameters and customization.

  Usage:

  `setPar(x, name, value)`

  Additional Arguments:

    `name`: the name of the display parameter to set.

  Examples:

    `setPar(obj, "col", "red")`

setPar

  `signature(x="CustomTrack", value="list")`: set display parameters by the values of the named list in `value`. Note that display parameters in the `CustomTrack` class are pass-by-reference, so no re-assignmnet to the symbol `obj` is necessary. See `settings` for details on display parameters and customization.

  Examples:

    `setPar(obj, list(col="red", lwd=2))`

names

  `signature(x="CustomTrack")`: return the value of the `name` slot.

  Usage:

  `names(x)`

  Examples:

    `names(obj)`

names<-

  `signature(x="CustomTrack", value="character")`: set the value of the `name` slot.

  Usage:

  `names<-(x, value)`

  Examples:

    `names(obj) <- "foo"`

coords

  `signature(ImageMap="CustomTrack")`: return the coordinates from the internal image map.

  Usage:

  `coords(ImageMap)`

  Examples:

    `coords(obj)`

tags

  `signature(x="CustomTrack")`: return the tags from the internal image map.

  Usage:

  `tags(x)`

  Examples:

    `tags(obj)`

### Display Parameters

All display parameters are being inherited from the respective parent classes. Note that not all of them may have an effect on the plotting of `CustomTrack` objects.

  `GdObject`:

    `alpha=1`: Numeric scalar. The transparency for all track items.

    `background.panel="transparent"`: Integer or character scalar. The background color of the content panel.

    `background.title="lightgray"`: Integer or character scalar. The background color for the title panels.

    `col.border.title="transparent"`: Integer or character scalar. The border color for the title panels.

    `lwd.border.title=1`: Integer scalar. The border width for the title panels.

    `cex=1`: Numeric scalar. The overall font expansion factor for all text.

    `cex.axis=NULL`: Numeric scalar. The expansion factor for the axis annotation. Defaults to `NULL`, in which case it is computed based on the available space.

    `cex.title=NULL`: Numeric scalar. The expansion factor for the title panel. This effects the fontsize of both the title and the axis, if any. Defaults to `NULL`, which means that the text size is automatically adjusted to the available space.

    `col="#0080FF"`: Integer or character scalar. Default line color setting for all plotting elements, unless there is a more specific control defined elsewhere.

    `col.axis="white"`: Integer or character scalar. The font and line color for the y axis, if any.

    `col.frame="lightgray"`: Integer or character scalar. The line color used for the panel frame, if `frame==TRUE`

    `col.grid="#808080"`: Integer or character scalar. Default line color for grid lines, both when `type=="g"` in `DataTrack`s and when display parameter `grid==TRUE`.

    `col.line=NULL`: Integer or character scalar. Default colors for plot lines. Usually the same as the global `col` parameter.

    `col.symbol=NULL`: Integer or character scalar. Default colors for plot symbols. Usually the same as the global `col` parameter.

    `col.title="white"`: Integer or character scalar. The font color for the title panels.

    `collapse=TRUE`: Boolean controlling wether to collapse the content of the track to accomodate the minimum current device resolution. See `collapsing` for details.

    `fill="lightgray"`: Integer or character scalar. Default fill color setting for all plotting elements, unless there is a more specific control defined elsewhere.

    `fontcolor="black"`: Integer or character scalar. The font color for all text.

    `fontface=1`: Integer or character scalar. The font face for all text.

    `fontface.title=2`: Integer or character scalar. The font face for the title panels.

    `fontfamily="sans"`: Integer or character scalar. The font family for all text.

    `fontfamily.title="sans"`: Integer or character scalar. The font family for the title panels.

    `fontsize=12`: Numeric scalar. The font size for all text.

    `frame=FALSE`: Boolean. Draw a frame around the track when plotting.

    `grid=FALSE`: Boolean, switching on/off the plotting of a grid.

    `h=-1`: Integer scalar. Parameter controlling the number of horizontal grid lines, see `panel.grid` for details.

    `lineheight=1`: Numeric scalar. The font line height for all text.

    `lty="solid"`: Numeric scalar. Default line type setting for all plotting elements, unless there is a more specific control defined elsewhere.

    `lty.grid="solid"`: Integer or character scalar. Default line type for grid lines, both when `type=="g"` in `DataTrack`s and when display parameter `grid==TRUE`.

    `lwd=1`: Numeric scalar. Default line width setting for all plotting elements, unless there is a more specific control defined elsewhere.

    `lwd.grid=1`: Numeric scalar. Default line width for grid lines, both when `type=="g"` in `DataTrack`s and when display parameter `grid==TRUE`.

    `min.distance=1`: Numeric scalar. The minimum pixel distance before collapsing range items, only if `collapse==TRUE`. See `collapsing` for details.

    `min.height=3`: Numeric scalar. The minimum range height in pixels to display. All ranges are expanded to this size in order to avoid rendering issues. See `collapsing` for details.

    `min.width=1`: Numeric scalar. The minimum range width in pixels to display. All ranges are expanded to this size in order to avoid rendering issues. See `collapsing` for details.

    `showAxis=TRUE`: Boolean controlling whether to plot a y axis (only applies to track types where axes are implemented).

    `showTitle=TRUE`: Boolean controlling whether to plot a title panel. Although this can be set individually for each track, in multi-track plots as created by `plotTracks` there will still be an empty placeholder in case any of the other tracks include a title. The same holds true for axes. Note that the the title panel background color could be set to transparent in order to completely hide it.

    `size=1`: Numeric scalar. The relative size of the track. Can be overridden in the `plotTracks` function.

    `v=-1`: Integer scalar. Parameter controlling the number of vertical grid lines, see `panel.grid` for details.

### Author(s)

Florian Hahne

### See Also

`DisplayPars`

`GdObject`

`ImageMap`

`collapsing`

`DataTrack`

`panel.grid`

`plotTracks`

`settings`

### Examples

    ## Object construction:

    ## An empty object
    CustomTrack()

[Package Gviz version 1.34.1 Index]