A container for other track objects from the Gviz package that allows for the addition of a common highlighting area across tracks.

# S4 method for HighlightTrack
initialize(.Object, trackList, ...)

HighlightTrack(
  trackList = list(),
  range = NULL,
  start = NULL,
  end = NULL,
  width = NULL,
  chromosome,
  genome,
  name = "HighlightTrack",
  ...
)

# S4 method for HighlightTrack,list
displayPars(x, recursive = FALSE) <- value

# S4 method for HighlightTrack
length(x)

# S4 method for HighlightTrack
chromosome(GdObject) <- value

# S4 method for HighlightTrack
setStacks(GdObject, ...)

# S4 method for HighlightTrack
consolidateTrack(GdObject, chromosome, ...)

# S4 method for HighlightTrack
subset(x, ...)

# S4 method for HighlightTrack
show(object)

Arguments

.Object

.Object

trackList

A list of Gviz track objects that all have to inherit from class GdObject.

...

All additional parameters are ignored.

range

An optional meta argument to handle the different input types. If the range argument is missing, all the relevant information to create the object has to be provided as individual function arguments (see below).

The different input options for range are:

A GRanges object:

the genomic ranges for the highlighting regions.

An IRanges object:

almost identical to the GRanges case, except that the chromosome information has to be provided in the separate chromosome argument, because it can not be directly encoded in an IRanges object.

A data.frame object:

the data.frame needs to contain at least the two mandatory columns start and end with the range coordinates. It may also contain a chromosome column with the chromosome information for each range. If missing, this information will be drawn from the constructor's chromosome argument.

start, end

An integer scalar with the genomic start or end coordinates for the highlighting range. Can also be supplied as part of the range argument.

width

An integer vector of widths for highlighting ranges. This can be used instead of either start or end to specify the range coordinates.

chromosome

The chromosome on which the track's genomic ranges are defined. A valid UCSC chromosome identifier if options(ucscChromosomeNames=TRUE). Please note that in this case only syntactic checking takes place, i.e., the argument value needs to be an integer, numeric character or a character of the form chrx, where x may be any possible string. The user has to make sure that the respective chromosome is indeed defined for the the track's genome. If not provided here, the constructor will try to build the chromosome information based on the available inputs, and as a last resort will fall back to the value chrNA. Please note that by definition all objects in the Gviz package can only have a single active chromosome at a time (although internally the information for more than one chromosome may be present), and the user has to call the chromosome<- replacement method in order to change to a different active chromosome.

genome

The genome on which the track's ranges are defined. Usually this is a valid UCSC genome identifier, however this is not being formally checked at this point. If not provided here the constructor will try to extract this information from the provided inputs, and eventually will fall back to the default value of NA.

name

Character scalar of the track's name. This is not really used and only exists fro completeness.

x

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

recursive

logical

value

Value to be set.

GdObject

Object of GdObject-class.

object

object

Value

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

Details

A track to conceptionally group other Gviz track objects into a meta track for the sole purpose of overlaying all the contained tracks with the same highlighting region as defined by the objects genomic ranges. During rendering the contained tracks will be treated as if they had been provided to the plotTracks function as individual objects.

Functions

  • initialize(HighlightTrack): Initialize.

  • HighlightTrack(): Constructor function for HighlightTrack-class.

  • displayPars(x = HighlightTrack) <- value: set display parameters using the values of the named list in value. See settings for details on display parameters and customization.

  • length(HighlightTrack): return the number of subtracks.

  • chromosome(HighlightTrack) <- value: replace the value of the track's chromosome. This has to be a valid UCSC chromosome identifier or an integer or character scalar that can be reasonably coerced into one.

  • setStacks(HighlightTrack): Rrecompute the stacks based on the available space and on the object's track items and stacking settings. This really just calls the setStacks methods for the contained tracks and only exists for dispatching reasons.

  • consolidateTrack(HighlightTrack): Consolidate For a HighlightTrack apply the method on each of the subtracks in the trackList slot

  • subset(HighlightTrack): subset all the contained tracks in an HighlightTrack by coordinates and sort if necessary.

  • show(HighlightTrack): Show method.

Objects from the Class

Objects can be created using the constructor function HighlightTrack.

Author

Florian Hahne

Examples

## Object construction:
set.seed(123)
dat <- runif(100, min = -2, max = 22)
gt <- GenomeAxisTrack()
dt <- DataTrack(data = dat, start = sort(sample(200, 100)), width = 1, genome = "hg19")

ht <- HighlightTrack(trackList = list(gt, dt))