StackedTrack-class: StackedTrack class and methods

StackedTrack-classR Documentation

StackedTrack class and methods

Description

The virtual parent class for all track types in the Gviz package which contain potentially overlapping annotation items that have to be stacked when plotted.

Usage

## S4 method for signature 'StackedTrack'
initialize(.Object, stacking, ...)

## S4 method for signature 'StackedTrack'
stacking(GdObject)

## S4 replacement method for signature 'StackedTrack,character'
stacking(GdObject) <- value

## S4 method for signature 'StackedTrack'
stacks(GdObject)

## S4 method for signature 'StackedTrack'
setStacks(GdObject, ...)

## S4 method for signature 'StackedTrack'
consolidateTrack(GdObject, ...)

## S4 method for signature 'StackedTrack,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'StackedTrack'
subset(x, from = NULL, to = NULL, sort = FALSE, stacks = FALSE, ...)

## S4 method for signature 'StackedTrack'
drawGD(GdObject, ...)

Arguments

.Object

.Object

stacking

stacking

...

Additional arguments.

GdObject

Object of GdObject-class.

value

Value to be set.

x

A valid track object class name, or the object itself, in which case the class is derived directly from it.

i

Numeric scalar, index to subset.

j

Numeric scalar, index to subset. Ignored.

drop

logical, indicating if levels that do not occur should be dropped (if f is a factor).

from, to

Numeric scalar, giving the range of genomic coordinates to limit the tracks in. Note that to cannot be larger than from.

sort

logical.

stacks

logical. Set if stacking should be preserved.

Value

A virtual Class: No objects may be created from it.

Functions

  • initialize(StackedTrack): Initialize.

  • stacking(StackedTrack): return the current stacking type.

  • stacking(GdObject = StackedTrack) <- value: set the object's stacking type to one in c(hide, dense, squish, pack,full).

  • stacks(StackedTrack): return the stack indices for each track item.

  • setStacks(StackedTrack): recompute the stacks based on the available space and on the object's track items and stacking settings.

  • consolidateTrack(StackedTrack): Consolidate. a display parameter)

  • x[i: subset the items in the StackedTrack object. This is essentially similar to subsetting of the GRanges object in the range slot. For most applications, the subset method may be more appropriate.

  • subset(StackedTrack): subset a StackedTrack by coordinates and sort if necessary.

  • drawGD(StackedTrack): plot the object to a graphics device. The return value of this method is the input object, potentially updated during the plotting operation. Internally, there are two modes in which the method can be called. Either in 'prepare' mode, in which case no plotting is done but the stacking information is updated based on the available space, or in 'plotting' mode, in which case the actual graphical output is created. Note that the method for this particular subclass is usually called through inheritance and not particularly useful on its own.

Slots

dp

Object of DisplayPars-class, the display settings controlling the look and feel of a track. See settings for details on setting graphical parameters for tracks.

name

Object of class character, a human-readable name for the track that will be used in the track's annotation panel if necessary.

imageMap

Object of ImageMap-class, containing optional information for an HTML image map. This will be created by the drawGD methods when the track is plotted to a device and is usually not set by the user.

range

Object of class GRanges, the genomic ranges of the track items as well as additional annotation information in its elementMetaData slot. Please not that the slot is actually implemented as a class union between GRanges and IRanges to increase efficiency, for instance for DataTrack objects. This usually does not concern the user.

chromosome

Object of class character, the chromosome on which the track is defined. There can only be a single chromosome for one track. For certain subclasses, the space of allowed chromosome names is limited (e.g., only those chromosomes that exist for a particular genome). Throughout the package, chromosome name have to be entered either as a single integer scalar or as a character scalar of the form chrXYZ, where XYZ may be an arbitrary character string.

genome

Object of class character, the genome for which the track is defined. For most sub-classes this has to be valid UCSC genome identifier, however this may not always be formally checked upon object instantiation.

stacking

Object of class character, the stacking type of overlapping items on the final plot. One in c(hide, dense, squish, pack,full). Currently, only hide (do not show the track items at all), squish (make best use of the available space) and dense (no stacking at all) are implemented.

stacks

Object of class numeric, holding the stack indices for each track item. This slot is usually populated by calling the setStacks method upon plotting, since the correct stacking is a function of the available plotting space.

Author(s)

Florian Hahne

See Also

DisplayPars

GdObject

GRanges

HighlightTrack

ImageMap

IRanges

RangeTrack

DataTrack

collapsing

grouping

panel.grid

plotTracks

settings

Examples

## This is a reference class therefore we show below
## an example from AnnotationTrack

## An empty object
AnnotationTrack()

## Construct from individual arguments
st <- c(2000000, 2070000, 2100000, 2160000)
ed <- c(2050000, 2130000, 2150000, 2170000)
str <- c("-", "+", "-", "-")
gr <- c("Group1", "Group2", "Group1", "Group3")

annTrack <- AnnotationTrack(
    start = st, end = ed, strand = str, chromosome = 7,
    genome = "hg19", feature = "test", group = gr,
    id = paste("annTrack item", 1:4),
    name = "generic annotation", stacking = "squish"
)


## Plotting
plotTracks(annTrack)

## Stacking
stacking(annTrack)
stacking(annTrack) <- "dense"
plotTracks(annTrack)

ivanek/Gviz documentation built on Nov. 20, 2023, 8:16 p.m.