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.
# S4 method for class 'StackedTrack'
initialize(.Object, stacking, ...)
# S4 method for class 'StackedTrack'
stacking(GdObject)
# S4 method for class 'StackedTrack,character'
stacking(GdObject) <- value
# S4 method for class 'StackedTrack'
stacks(GdObject)
# S4 method for class 'StackedTrack'
setStacks(GdObject, ...)
# S4 method for class 'StackedTrack'
consolidateTrack(GdObject, ...)
# S4 method for class 'StackedTrack,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]
# S4 method for class 'StackedTrack'
subset(x, from = NULL, to = NULL, sort = FALSE, stacks = FALSE, ...)
# S4 method for class 'StackedTrack'
drawGD(GdObject, ...)The object skeleton passed on by new() during class
instantiation, to be filled in by the initialize method.
The stacking type for overlapping items of the track. One in
c(hide, dense, squish, pack, full). Currently, only squish (make best use
of the available space), dense (no stacking, collapse overlapping ranges),
and hide (do not show any track items at all) are implemented.
Additional arguments.
Object of GdObject-class.
Value to be set.
A valid track object class name, or the object itself, in which case the class is derived directly from it.
Numeric scalar, index to subset.
Numeric scalar, index to subset. Ignored.
logical, indicating if levels that do not occur should be
dropped (if f is a factor).
Numeric scalar, giving the range of genomic coordinates to
limit the tracks in. Note that to cannot be larger than from.
logical. Sort the track's ranges by their genomic coordinates
after subsetting.
logical. Set if stacking should be preserved.
A virtual Class: No objects may be created from it.
initialize(StackedTrack): Initialize the stacking slot (validating
it against the allowed stackingValues) and reset the stacks slot,
before deferring to the RangeTrack initializer for the remaining slots.
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): For StackedTrack objects, set the
stacking (which could have been passed in as a display parameter) before
deferring to the RangeTrack method for the remaining consolidation
steps.
x = StackedTrack[i = ANY, j = ANY, drop = ANY]: 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.
dpObject of DisplayPars-class, the display settings controlling the
look and feel of a track. See settings for details on setting graphical
parameters for tracks.
nameObject of class character, a human-readable name for the track
that will be used in the track's annotation panel if necessary.
imageMapObject 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.
rangeObject 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.
chromosomeObject 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.
genomeObject 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.
stackingObject 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.
stacksObject 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.
## This is a reference class therefore we show below
## an example from AnnotationTrack
## An empty object
AnnotationTrack()
#> AnnotationTrack 'AnnotationTrack'
#> | genome: NA
#> | active chromosome: chrNA
#> | annotation features: 0
## 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)
#> [1] "squish"
stacking(annTrack) <- "dense"
plotTracks(annTrack)