The virtual parent class for all track items in the Gviz package that contain some form of genomic ranges (start, end, strand, chromosome and the associated genome.)

# S4 method for class 'RangeTrack'
initialize(.Object, range, chromosome, genome, ...)

# S4 method for class 'RangeTrack'
ranges(x)

# S4 method for class 'RangeTrack'
ranges(x) <- value

# S4 method for class 'RangeTrack'
range(x)

# S4 method for class 'RangeTrack'
seqnames(x)

# S4 method for class 'RangeTrack'
seqlevels(x)

# S4 method for class 'RangeTrack'
seqinfo(x)

# S4 method for class 'RangeTrack'
genome(x)

# S4 method for class 'RangeTrack'
genome(x) <- value

# S4 method for class 'RangeTrack'
chromosome(GdObject)

# S4 method for class 'RangeTrack'
chromosome(GdObject) <- value

# S4 method for class 'RangeTrack'
start(x)

# S4 method for class 'RangeTrack'
start(x) <- value

# S4 method for class 'RangeTrack'
end(x)

# S4 method for class 'RangeTrack'
end(x) <- value

# S4 method for class 'RangeTrack'
width(x)

# S4 method for class 'RangeTrack'
width(x) <- value

# S4 method for class 'RangeTrack'
min(x)

# S4 method for class 'RangeTrack'
max(x)

# S4 method for class 'RangeTrack'
length(x)

# S4 method for class 'RangeTrack'
strand(x)

# S4 method for class 'RangeTrack,ANY'
strand(x) <- value

# S4 method for class 'RangeTrack'
position(GdObject, from = NULL, to = NULL, sort = FALSE, ...)

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

# S4 method for class 'RangeTrack'
subset(
  x,
  from = NULL,
  to = NULL,
  sort = FALSE,
  drop = TRUE,
  use.defaults = TRUE,
  ...
)

# S4 method for class 'RangeTrack,ANY'
split(x, f, drop = FALSE, ...)

# S4 method for class 'RangeTrack'
values(x)

# S4 method for class 'RangeTrack'
feature(GdObject)

# S4 method for class 'RangeTrack,character'
feature(GdObject) <- value

# S4 method for class 'RangeTrack'
consolidateTrack(GdObject, chromosome, ...)

Arguments

.Object

The object skeleton passed on by new() during class instantiation, to be filled in by the initialize method.

range

A GRanges object with the genomic coordinates of the track items, and any additional annotation stored in its metadata columns.

chromosome

the currently active chromosome which may have to be set for a RangeTrack or a SequenceTrack object

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.

...

Additional arguments.

x

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

value

Value to be set.

GdObject

the input track object

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. Sort the track's ranges by their genomic coordinates after subsetting.

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).

use.defaults

logical. Derive the subsetting range from the track's own defaults, honouring the min.width and similar display parameters, rather than using from and to verbatim.

f

factor in the sense that as.factor(f) defines the grouping used to split the track into a list of tracks.

Value

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

Functions

  • initialize(RangeTrack): Initialize the range, chromosome and genome slots before deferring to the GdObject initializer for the remaining slots.

  • ranges(RangeTrack): return the genomic coordinates for the track along with all additional annotation information as an object of class GRanges.

  • ranges(RangeTrack) <- value: replace the genomic coordinates and associated annotation information for the track with a new GRanges object.

  • range(RangeTrack): return the genomic coordinates for the track as an object of class IRanges.

  • seqnames(RangeTrack): return the track's seqnames.

  • seqlevels(RangeTrack): return the track's seqlevels.

  • seqinfo(RangeTrack): return the track's seqinfo.

  • genome(RangeTrack): return the track's genome.

  • genome(RangeTrack) <- value: set the track's genome. Usually this has to be a valid UCSC identifier, however this is not formally enforced here.

  • chromosome(RangeTrack): return the chromosome for which the track is defined.

  • chromosome(RangeTrack) <- 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.

  • start(RangeTrack): the start of the track items in genomic coordinates.

  • start(RangeTrack) <- value: replace the start of the track items in genomic coordinates.

  • end(RangeTrack): the end of the track items in genomic coordinates.

  • end(RangeTrack) <- value: replace the end of the track items in genomic coordinates.

  • width(RangeTrack): the width of the track items in genomic coordinates.

  • width(RangeTrack) <- value: replace the width of the track items in genomic coordinates.

  • min(RangeTrack): return the start position for the leftmost range item.

  • max(RangeTrack): return the end position for the rightmost range item.

  • length(RangeTrack): return the number of items in the track.

  • strand(RangeTrack): return a vector of strand specifiers for all track items, in the form '+' for the Watson strand, '-' for the Crick strand or '*' for either of the two.

  • strand(x = RangeTrack) <- value: replace the strand information for the track items. The replacement value needs to be an appropriate scalar or vector of strand values.

  • position(RangeTrack): the arithmetic mean of the track item's coordionates, i.e., (end(obj)-start(obj))/2.

  • x = RangeTrack[i = ANY, j = ANY, drop = ANY]: subset the items in the RangeTrack 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(RangeTrack): subset a RangeTrack by coordinates and sort if necessary.

  • split(x = RangeTrack, f = ANY): split a RangeTrack object by an appropriate factor vector (or another vector that can be coerced into one). The output of this operation is a list of objects of the same class as the input object, all inheriting from class RangeTrack.

  • values(RangeTrack): return all additional annotation information except for the genomic coordinates for the track items as a data.frame.

  • feature(RangeTrack): return the grouping information for track items. For certain sub-classes, groups may be indicated by different colour schemes when plotting. See grouping or AnnotationTrack and GeneRegionTrack for details. @export

  • feature(GdObject = RangeTrack) <- value: set the grouping information for track items. This has to be a factor vector (or another type of vector that can be coerced into one) of the same length as the number of items in the RangeTrack. See grouping or AnnotationTrack and GeneRegionTrack for details. @export

  • consolidateTrack(RangeTrack): Update the active chromosome (if provided) before deferring to the GdObject method for the remaining consolidation steps.

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.

Author

Florian Hahne

Examples

## 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)