RangeTrack-class: RangeTrack class and methods

Description Objects from the class Slots Extends Methods Display Parameters Author(s) See Also Examples

Description

The virtual parent class for all track items in the Gviz package that contain some form of genomic ranges.

Objects from the class

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

Slots

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

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

Exported in the name space:

[

signature(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.

Additional Arguments:

i, j: subsetting indices, j is ignored.

drop: argument is ignored.

Examples:

obj[1:5]

chromosome

signature(GdObject="RangeTrack"): return the chromosome for which the track is defined.

Usage:

chromosome(GdObject)

Examples:

chromosome(obj)

chromosome<-

signature(GdObject="RangeTrack"): 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.

Usage:

chromosome<-(GdObject, value)

Additional Arguments:

value: replacement value.

Examples:

chromosome(obj) <- "chr12"

start, end, width

signature(x="RangeTrack"): the start or end coordinates of the track items, or their width in genomic coordinates.

Usage:

start(x)

end(x)

width(x)

Examples:

start(obj)

end(obj)

width(obj)

start<-, end<-, width<-

signature(x="RangeTrack"): replace the start or end coordinates of the track items, or their width.

Usage:

start<-(x, value)

end<-(x, value)

width<-(x, value)

Additional Arguments:

value: replacement value.

Examples:

start(obj) <- 1:10

end(obj) <- 20:30

width(obj) <- 1

position

signature(GdObject="RangeTrack"): the arithmetic mean of the track item's coordionates, i.e., (end(obj)-start(obj))/2.

Usage:

position(GdObject)

Examples:

position(obj)

feature

signature(GdObject="RangeTrack"): return the grouping information for track items. For certain sub-classes, groups may be indicated by different color schemes when plotting. See grouping or AnnotationTrack and GeneRegionTrack for details.

Usage:

feature(GdObject)

Examples:

feature(obj)

feature<-

signature(gdObject="RangeTrack", value="character"): 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.

Usage:

feature<-(GdObject, value)

Additional Arguments:

value: replacement value.

Examples:

feature(obj) <- c("a", "a", "b", "c", "a")

genome

signature(x="RangeTrack"): return the track's genome.

Usage:

genome(x)

Examples:

genome(obj)

genome<-

signature(x="RangeTrack"): set the track's genome. Usually this has to be a valid UCSC identifier, however this is not formally enforced here.

Usage:

genome<-(x, value)

Additional Arguments:

value: replacement value.

Examples:

genome(obj) <- "mm9"

length

signature(x="RangeTrack"): return the number of items in the track.

Usage:

length(x)

Examples:

length(obj)

range

signature(x="RangeTrack"): return the genomic coordinates for the track as an object of class IRanges.

Usage:

range(x)

Examples:

range(obj)

ranges

signature(x="RangeTrack"): return the genomic coordinates for the track along with all additional annotation information as an object of class GRanges.

Usage:

ranges(x)

Examples:

ranges(obj)

split

signature(x="RangeTrack"): 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.

Usage:

split(x, f, ...)

Additional Arguments:

f: the splitting factor.

...: all further arguments are ignored.

Examples:

split(obj, c("a", "a", "b", "c", "a"))

strand

signature(x="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.

Usage:

strand(x)

Examples:

strand(obj)

strand<-

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

Usage:

strand<-(x, value)

Additional Arguments:

value: replacement value.

Examples:

strand(obj) <- "+"

values

signature(x="RangeTrack"): return all additional annotation information except for the genomic coordinates for the track items as a data.frame.

Usage:

values(x)

Examples:

values(obj)

min

signature(...="RangeTrack"): return the start position for the leftmost range item.

Examples:

min(obj)

max

signature(...="RangeTrack"): return the end position for the rightmost range item.

Examples:

max(obj)

coerce

signature(from="RangeTrack", to="data.frame"): coerce the GRanges object in the range slot into a regular data.frame.

Examples:

as(obj, "data.frame")

subset

signature(x="RangeTrack"): subset a RangeTrack by coordinates and sort if necessary.

Usage:

subset(x, from, to, sort=FALSE, ...)

Additional Arguments:

from, to: the coordinates range to subset to.

sort: sort the object after subsetting. Usually not necessary.

...: additional arguments are ignored.

Examples:

subset(obj, from=10, to=20, sort=TRUE)

Internal methods:

initialize

signature(.Object="RangeTrack"): initialize the object.

Inherited methods:

displayPars

signature(x="RangeTrack", 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="RangeTrack", 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="RangeTrack", 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="RangeTrack", name="missing"): alias for the displayPars method. See settings for details on display parameters and customization.

Examples:

getPar(obj)

displayPars<-

signature(x="RangeTrack", 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="RangeTrack", value="character"): set the single display parameter name to value. Note that display parameters in the RangeTrack 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="RangeTrack", value="list"): set display parameters by the values of the named list in value. Note that display parameters in the RangeTrack 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))

group

signature(GdObject="RangeTrack"): return grouping information for the individual items in the track. Unless overwritten in one of the sub-classes, this usualy returns NULL.

Usage:

group(GdObject)

Examples:

group(obj)

names

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

Usage:

names(x)

Examples:

names(obj)

names<-

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

Usage:

names<-(x, value)

Examples:

names(obj) <- "foo"

coords

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

Usage:

coords(ImageMap)

Examples:

coords(obj)

tags

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

Usage:

tags(x)

Examples:

tags(obj)

drawAxis

signature(GdObject="RangeTrack"): add a y-axis to the title panel of a track if necessary. Unless overwritten in one of the sub-classes this usualy does not plot anything and returns NULL.

Usage:

drawAxis(x, ...)

Additional Arguments:

...: all further arguments are ignored.

Examples:

Gviz:::drawAxis(obj)

drawGrid

signature(GdObject="RangeTrack"): superpose a grid on top of a track if necessary. Unless overwritten in one of the sub-classes this usualy does not plot anything and returns NULL.

Usage:

drawGrid(GdObject, ...)

Additional Arguments:

...: additional arguments are ignored.

Examples:

Gviz:::drawGrid(obj)

Display Parameters

No formal display parameters are defined for objects of class RangeTrack.

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

GdObject:

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

alpha.title=NULL: Numeric scalar. The transparency for the title panel.

background.legend="transparent": Integer or character scalar. The background color for the legend.

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

cex=1: Numeric scalar. The overall font expansion factor for all text and glyphs, unless a more specific definition exists.

cex.axis=NULL: Numeric scalar. The expansion factor for the axis annotation. Defaults to NULL, in which case it is automatically determined 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.border.title="white": Integer or character scalar. The border color for the title panels.

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 DataTracks 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" (Aliases: fontcolor.title): Integer or character scalar. The border color for the title panels

collapse=TRUE: Boolean controlling whether 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, unless a more specific definition exists.

fontface=1: Integer or character scalar. The font face for all text, unless a more specific definition exists.

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, unless a more specific definition exists.

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

fontsize=12: Numeric scalar. The font size for all text, unless a more specific definition exists.

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, unless a more specific definition exists.

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 DataTracks 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.border.title=1: Integer scalar. The border width for the title panels.

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

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

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.

reverseStrand=FALSE: Logical scalar. Set up the plotting coordinates in 3' -> 5' direction if TRUE. This will effectively mirror the plot on the vertical axis.

rotation=0: The rotation angle for all text unless a more specific definiton exists.

rotation.title=90 (Aliases: rotation.title): The rotation angle for the text in the title panel. Even though this can be adjusted, the automatic resizing of the title panel will currently not work, so use at own risk.

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

AnnotationTrack

DataTrack

DisplayPars

GdObject

GeneRegionTrack

GRanges

ImageMap

IRanges

collapsing

grouping

panel.grid

plotTracks

settings

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## This is a refernce 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)

Gviz documentation built on March 16, 2021, 6:01 p.m.