Last data update: 2014.03.03

R: GeneRegionTrack class and methods
GeneRegionTrack-classR Documentation

GeneRegionTrack class and methods

Description

A class to hold gene model data for a genomic region.

Usage


GeneRegionTrack(range=NULL, rstarts=NULL, rends=NULL, rwidths=NULL,
               strand, feature, exon, transcript, gene, symbol,
               chromosome, genome, stacking="squish",
               name="GeneRegionTrack", start=NULL, end=NULL,
               importFunction, stream=FALSE, ...)

Arguments

Since GeneRegionTrack objects are essentially just a specific type of AnnotationTrack objects, their constructors are quite similar. However, in the case of the GeneRegionTrack certain assumptions are made about the type of grouping on different levels (see the Details section for more information). The natural representation for gene models in the Bioconductor world are TxDb objects, and we tried to make it as straight forward as possible to create GeneRegionTracks starting from those. Building the object from individual function arguments is of course still possible.

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 TxDb object: all the necessary gene model information including exon locations, transcript groupings and associated gene ids are contained in TxDb objects, and the coercion between the two is almost completely automated. If desired, the data to be fetched from the TxDb object can be restricted using the constructor's chromosome, start and end arguments. See below for details. A direct coercion method as(obj, "GeneRegionTrack") is also available. A nice added benefit of this input option is that the UTR and coding region information that is part of the original TxDb object is retained in the GeneRegionTrack.

A GRanges object: the genomic ranges for the GeneRegion track as well as the optional additional metadata columns feature, transcript, gene, exon and symbol (see description of the individual function parameters below for details). Calling the constructor on a GRanges object without further arguments, e.g. GeneRegionTrack(range=obj) is equivalent to calling the coerce method as(obj, "GeneRegionTrack").

A GRangesList object: this is very similar to the previous case, except that the grouping information that is part of the list structure is preserved in the GeneRegionTrack. I.e., all the elements within one list item receive the same group id. For consistancy, there is also a coercion method from GRangesLists as(obj, "GeneRegionTrack"). Please note that unless the necessary information about gene ids, symbols, etc. is present in the individual GRanges meta data slots, the object will not be particularly useful, because all the identifiers will be set to a common default value.

An IRanges object: almost identical to the GRanges case, except that the chromosome and strand information as well as all additional data has to be provided in the separate chromosome, strand, feature, transcript, symbol, exon or gene arguments, because it can not be directly encoded in an IRanges object. Note that only the former two are mandatory (if not provided explicitely the more or less reasonable default values chromosome=NA and strand=* are used, but not providing information about the gene-to-transcript relationship or the human-readble symbols renders a lot of the class' functionality useles.

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 and a strand column with the chromosome and strand information for each range. If missing, this information will be drawn from the constructor's chromosome or strand arguments. In addition, the feature, exon, transcript, gene and symbol data can be provided as columns in the data.frame. The above comments about potential default values also apply here.

A character scalar: in this case the value of the range argument is considered to be a file path to an annotation file on disk. A range of file types are supported by the Gviz package as identified by the file extension. See the importFunction documentation below for further details.

start, end

An integer scalar with the genomic start or end coordinate for the gene model range. If those are missing, the default value will automatically be the smallest (or largest) value, respectively in rstarts and rends for the currently active chromosome. When building a GeneRegionTrack from a TxDb object, these arguments can be used to subset the desired annotation data by genomic coordinates. Please note this in that case the chromosome parameter must also be set.

rstarts

An integer vector of the start coordinates for the actual gene model items, i.e., for the individual exons. The relationship between exons is handled via the gene and transcript factors. Alternatively, this can be a vector of comma-separated lists of integer coordinates, one vector item for each transcript, and each comma-separated element being the start location of a single exon within that transcript. Those lists will be exploded upon object instantiation and all other annotation arguments will be recycled accordingly to regenerate the exon/transcript/gene relationship structure. This implies the approriate number of items in all annotation and coordinates arguments.

rends

An integer vector of the end coordinates for the actual gene model items. Both rstarts and rends have to be of equal length.

rwidths

An integer vector of widths for the actual gene model items. This can be used instead of either rstarts or rends to specify the range coordinates.

feature

Factor (or other vector that can be coerced into one), giving the feature types for the individual track exons. When plotting the track to the device, if a display parameter with the same name as the value of feature is set, this will be used as the track item's fill color. Additionally, the feature type defines whether an element in the GeneRegionTrack is considered to be coding or non-coding. The details section as well as the section about the thinBoxFeature display parameter further below has more information on this. See also grouping for details.

exon

Character vector of exon identifiers. It's values will be used as the identifier tag when plotting to the device if the display parameter showExonId=TRUE.

strand

Character vector, the strand information for the individual track exons. It may be provided in the form + for the Watson strand, - for the Crick strand or * for either one of the two. Please note that all items within a single gene or transcript model need to be on the same strand, and erroneous entries will result in casting of an error.

transcript

Factor (or other vector that can be coerced into one), giving the transcript memberships for the individual track exons. All items with the same transcript identifier will be visually connected when plotting to the device. See grouping for details. Will be used as labels when showId=TRUE, and geneSymbol=FALSE.

gene

Factor (or other vector that can be coerced into one), giving the gene memberships for the individual track exons.

symbol

A factor with human-readable gene name aliases which will be used as labels when showId=TRUE, and geneSymbol=TRUE.

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. When creating a GeneRegionTrack from a TxDb object, the value of this parameter can be used to subset the data to fetch only transcripts from a single 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.

stacking

The stacking type for overlapping items of the track. One in c(hide, dense, squish, pack,full). Currently, only hide (don't show the track items, squish (make best use of the available space) and dense (no stacking at all) are implemented.

name

Character scalar of the track's name used in the title panel when plotting.

importFunction

A user-defined function to be used to import the data from a file. This only applies when the range argument is a character string with the path to the input data file. The function needs to accept an argument x containing the file path and has to return a proper GRanges object with all the necessary metadata columns set. A set of default import functions is already implemented in the package for a number of different file types, and one of these defaults will be picked automatically based on the extension of the input file name. If the extension can not be mapped to any of the existing import function, an error is raised asking for a user-defined import function via this argument. Currently the following file types can be imported with the default functions: gff, gff1, gff2, gff3, gtf.

stream

A logical flag indicating that the user-provided import function can deal with indexed files and knows how to process the additional selection argument when accessing the data on disk. This causes the constructor to return a ReferenceGeneRegionTrack object which will grab the necessary data on the fly during each plotting operation.

...

Additional items which will all be interpreted as further display parameters. See settings and the "Display Parameters" section below for details.

Details

A track containing all gene models in a particular region. The data are usually fetched dynamially from an online data store, but it is also possible to manully construct objects from local data. Connections to particular online data sources should be implemented as sub-classes, and GeneRegionTrack is just the commone denominator that is being used for plotting later on. There are several levels of data associated to a GeneRegionTrack:

exon level:

identifiers are stored in the exon column of the GRanges object in the range slot. Data may be extracted using the exon method.

transcript level:

identifiers are stored in the transcript column of the GRanges object. Data may be extracted using the transcript method.

gene level:

identifiers are stored in the gene column of the GRanges object, more human-readable versions in the symbol column. Data may be extracted using the gene or the symbol methods.

transcript-type level:

information is stored in the feature column of the GRanges object. If a display parameter of the same name is specified, the software will use its value for the coloring.

GeneRegionTrack objects also know about coding regions and non-coding regions (e.g., UTRs) in a transcript, and will indicate those by using different shapes (wide boxes for all coding regions, thinner boxes for non-coding regions). This is archived by setting the feature values of the object for non-coding elements to one of the options that are provided in the thinBoxFeature display parameters. All other elements are considered to be coding elements.

Value

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

Objects from the class

Objects can be created using the constructor function GeneRegionTrack.

Slots

start:

Object of class "numeric", the start coordinates of the annotation range. The coorrdinates for the individual gene model items are stored in the range slot.

end:

Object of class "numeric", the end coordinates of the annotation range. The corrdinates for the individual gene model items are stored in the range slot.

stacking:

Object of class "character", inherited from class StackedTrack

stacks:

Object of class "numeric", inherited from class StackedTrack

range:

Object of class GRanges, inherited from class RangeTrack

chromosome:

Object of class "character", inherited from class RangeTrack

genome:

Object of class "character", inherited from class RangeTrack

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 "AnnotationTrack", directly.

Class "StackedTrack", by class "AnnotationTrack", distance2.

Class "RangeTrack", by class "AnnotationTrack", distance3.

Class "GdObject", by class "AnnotationTrack", distance4.

Methods

In the following code chunks, obj is considered to be an object of class GeneRegionTrack.

Exported in the name space:

group

signature(gdObject="GeneRegionTrack"): extract the group membership for all track items.

Usage:

group(GdObject)

Examples:

group(obj)

group<-

signature(gdObject="GeneRegionTrack", value="character"): replace the grouping information for track items. The replacement value must be a factor of appropriate length or another vector that can be coerced into such.

Usage:

group<-(GdObject, value)

Examples:

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

identifier

signature(gdObject="GeneRegionTrack"): return track item identifiers. Depending on the setting of the optional argument lowest, these are either the group identifiers or the individual item identifiers.

Usage:

identifier(GdObject, lowest=FALSE)

Additional Arguments:

lowest: return the lowest-level identifier, i.e., the item IDs, or the higher level group IDs which do not have to be unqiue.

Examples:

identifier(obj, lowest=FALSE)

identifier<-

signature(gdObject="GeneRegionTrack", value="character"): Set the track item identifiers. The replacement value has to be a character vector of appropriate length. This always replaces the group-level identifiers, so essentially it is similar to groups<-.

Usage:

identifier<-(GdObject, value)

Examples:

identifier(obj) <- c("foo", "bar")

exon

signature(GdObject="GeneRegionTrack"): Extract the exon identifiers for all exons in the gene models.

Usage:

exon(GdObject)

Examples:

exon(obj)

exon<-

signature(GdObject="GeneRegionTrack", value="character"): replace the exon identifiers for all exons in the gene model. The replacement value must be a character of appropriate length or another vector that can be coerced into such.

Usage:

exon<-(GdObject, value)

Examples:

exon(obj) <- paste("Exon", 1:5)

gene

signature(GdObject="GeneRegionTrack"): Extract the gene identifiers for all gene models.

Usage:

gene(GdObject)

Examples:

gene(obj)

gene<-

signature(GdObject="GeneRegionTrack", value="character"): replace the gene identifiers for all gene models. The replacement value must be a character of appropriate length or another vector that can be coerced into such.

Usage:

gene<-(GdObject, value)

Examples:

gene(obj) <- paste("Gene", LETTERS[1:5])

symbol

signature(GdObject="GeneRegionTrack"): Extract the human-readble gene symbol for all gene models.

Usage:

symbol(GdObject)

Examples:

symbol(obj)

symbol<-

signature(GdObject="GeneRegionTrack", value="character"): replace the human-readable gene symbol for all gene models. The replacement value must be a character of appropriate length or another vector that can be coerced into such.

Usage:

gene<-(GdObject, value)

Examples:

symbol(obj) <- letters[1:5]

transcript

signature(GdObject="GeneRegionTrack"): Extract the transcript identifiers for all transcripts in the gene models.

Usage:

transcript(GdObject)

Examples:

transcript(obj)

transcript<-

signature(GdObject="GeneRegionTrack", value="character"): replace the transcript identifiers for all transcripts in the gene model. The replacement value must be a character of appropriate length or another vector that can be coerced into such.

Usage:

transcript<-(GdObject, value)

Examples:

transcript(obj) <- paste("Exon", 1:5)

Internal methods:

coerce

signature(from="GeneRegionTrack", to="UCSCData"): coerce to a UCSCData object for export to the UCSC genome browser.

Examples:

as(obj, "UCSCData")

collapseTrack

signature(GdObject="GeneRegionTrack"): preprocess the track before plotting. This will collapse overlapping track items based on the available resolution and increase the width and height of all track objects to a minimum value to avoid rendering issues. See collapsing for details.

Usage:

collapseTrack(GdObject, diff=.pxResolution(coord="x"))

Additional Arguments:

diff: the minimum pixel width to display, everything below that will be inflated to a width of diff.

Examples:

Gviz:::collapseTrack(obj)

initialize

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

show

signature(object="GeneRegionTrack"): show a human-readable summary of the object

Inherited methods:

drawGD

signature(GdObject="GeneRegionTrack"): 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 object is preprocessed based on the available space, or in 'plotting' mode, in which case the actual graphical output is created. Since subsetting of the object can be potentially costly, this can be switched off in case subsetting has already been performed before or is not necessary.

Usage:

drawGD(GdObject, minBase, maxBase, prepare=FALSE, subset=TRUE, ...)

Additional Arguments:

minBase, maxBase: the coordinate range to plot.

prepare: run method in preparation or in production mode.

subset: subset the object to the visible region or skip the potentially expensive subsetting operation.

...: all further arguments are ignored.

Examples:

Gviz:::drawGD(obj)

Gviz:::drawGD(obj, minBase=1, maxBase=100)

Gviz:::drawGD(obj, prepare=TRUE, subset=FALSE)

drawGrid

signature(GdObject="GeneRegionTrack"): superpose a grid on top of a track.

Usage:

drawGrid(GdObject, from, to)

Additional Arguments:

from, to: integer scalars, draw grid within a certain coordinates range. This needs to be supplied for the plotting function to know the current genomic coordinates.

Examples:

Gviz:::drawGrid(obj, from=10, to=100)

setStacks

signature(GdObject="GeneRegionTrack"): recompute the stacks based on the available space and on the object's track items and stacking settings.

Usage:

setStacks(GdObject, from, to)

Additional Arguments:

from, to: integer scalars, compute stacking within a certain coordinates range. This needs to be supplied for the plotting function to know the current genomic coordinates.

Examples:

Gviz:::setStacks(obj, from=1, to=100)

stacking

signature(GdObject="GeneRegionTrack"): return the current stacking type.

Usage:

stacking(GdObject)

Examples:

stacking(obj)

stacking<-

signature(GdObject="GeneRegionTrack", value="character"): set the object's stacking type to one in c(hide, dense, squish, pack,full).

Usage:

stacking<-(GdObject, value)

Additional Arguments:

value: replacement value.

Examples:

stacking(obj) <- "squish"

stacks

signature(GdObject="GeneRegionTrack"): return the stack indices for each track item.

Usage:

stacks(GdObject)

Examples:

Gviz:::stacks(obj)

[

signature(x="GeneRegionTrack", i="ANY", j="ANY", drop="ANY"): subset the items in the GeneRegionTrack 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="GeneRegionTrack"): return the currently active chromosome for which the track is defined. For consistancy with other Bioconductor packages, the isActiveSeq alias is also provided.

Usage:

chromosome(GdObject)

Examples:

chromosome(obj)

chromosome<-

signature(GdObject="GeneRegionTrack"): replace the value of the track's active chromosome. This has to be a valid UCSC chromosome identifier or an integer or character scalar that can be reasonably coerced into one, unless options(ucscChromosomeNames=FALSE). For consistancy with other Bioconductor packages, the isActiveSeq<- alias is also provided.

Usage:

chromosome<-(GdObject, value)

Additional Arguments:

value: replacement value.

Examples:

chromosome(obj) <- "chr12"

start, end, width

signature(x="GeneRegionTrack"): 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="GeneRegionTrack"): 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="GeneRegionTrack"): 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="GeneRegionTrack"): return the grouping information for track items. For certain sub-classes, groups may be indicated by different color schemes when plotting. See grouping for details.

Usage:

feature(GdObject)

Examples:

feature(obj)

feature<-

signature(gdObject="GeneRegionTrack", 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 GeneRegionTrack. See grouping for details.

Usage:

feature<-(GdObject, value)

Additional Arguments:

value: replacement value.

Examples:

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

genome

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

Usage:

genome(x)

Examples:

genome(obj)

genome<-

signature(x="GeneRegionTrack"): 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="GeneRegionTrack"): return the number of items in the track.

Usage:

length(x)

Examples:

length(obj)

range

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

Usage:

range(x)

Examples:

range(obj)

ranges

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

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="GeneRegionTrack"): 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="GeneRegionTrack"): 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="GeneRegionTrack"): return all additional annotation information except for the genomic coordinates for the track items as a data.frame.

Usage:

values(x)

Examples:

values(obj)

coerce

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

Examples:

as(obj, "data.frame")

subset

signature(x="GeneRegionTrack"): subset a GeneRegionTrack 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)

displayPars

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

Examples:

getPar(obj)

displayPars<-

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

names

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

Usage:

names(x)

Examples:

names(obj)

names<-

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

Usage:

names<-(x, value)

Examples:

names(obj) <- "foo"

coords

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

Usage:

coords(ImageMap)

Examples:

coords(obj)

tags

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

Usage:

tags(x)

Examples:

tags(obj)

Display Parameters

The following display parameters are set for objects of class GeneRegionTrack upon instantiation, unless one or more of them have already been set by one of the optional sub-class initializers, which always get precedence over these global defaults. See settings for details on setting graphical parameters for tracks.

min.distance=0: Numeric scalar. The minimum pixel distance before collapsing range items, only if codecollapse==TRUE. See codelinkcollapsing for details. Note that a value larger than 0 may lead to UTR regions being merged to CDS regions, which in most cases is not particularly useful.

col=NULL: Character or integer scalar. The border color for all items. Defaults to using the same color as in fill, also taking into account different track features.

fill="orange": Character or integer scalar. The fill color for untyped items. This is also used to connect grouped items. See grouping for details.

geneSymbols=TRUE: Logical scalar. Use human-readable gene symbols or gene IDs for the transcript annotation.

shape=c("smallArrow", "box"): Character scalar. The shape in which to display the track items. Currently only box, arrow, ellipse, and smallArrow are implemented.

showExonId=FALSE: Logical scalar. Control whether to plot the individual exon identifiers.

collapseTranscripts=FALSE: Logical or character scalar. Can be one in gene, longest, shortest or meta. Merge all transcripts of the same gene into one single gene model. In the case of gene (or TRUE), this will only keep the start location of the first exon and the end location of the last exon from all transcripts of the gene. For shortest and longest, only the longest or shortest transcript model is retained. For meta, a meta-transcript containing the union of all exons is formed (essentially identical to the operation reduce(geneModel)).

thinBoxFeature=c("utr", "ncRNA", "utr3", "utr5", "miRNA", "lincRNA"): Character vector. A listing of feature types that should be drawn with thin boxes. Typically those are non-coding elements.

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 GeneRegionTrack objects.

AnnotationTrack:

cex=1: Numeric scalar. The font expansion factor for item identifiers.

cex.group=0.6: Numeric scalar. The font expansion factor for the group-level annotation.

col="transparent": Character or integer scalar. The border color for all track items.

col.line="darkgray": Character scalar. The color used for connecting lines between grouped items. Defaults to a dark gray, but if set to NULL the same color as for the first item in the group is used.

fontcolor="white": Character or integer scalar. The font color for item identifiers.

fontcolor.group="#808080": Character or integer scalar. The font color for the group-level annotation.

fontface=1: Integer scalar. The font face for item identifiers.

fontface.group=2: Numeric scalar. The font face for the group-level annotation.

fontfamily="sans": Character scalar. The font family for item identifiers.

fontsize=12: Numeric scalar. The font size for item identifiers.

lex=1: Numeric scalar. The line expansion factor for all track items. This is also used to connect grouped items. See grouping for details.

lineheight=1: Numeric scalar. The font line height for item identifiers.

lty="solid": Character or integer scalar. The line type for all track items. This is also used to connect grouped items. See grouping for details.

lwd=1: Integer scalar. The line width for all track items. This is also used to connect grouped items. See grouping for details.

rotation=0: Numeric scalar. The degree of text rotation for item identifiers.

showFeatureId=FALSE: Logical scalar. Control whether to plot the individual track item identifiers.

showId=FALSE: Logical scalar. Control whether to annotate individual groups.

showOverplotting=FALSE: Logical scalar. Use a color gradient to show the amount of overplotting for collapsed items. This implies that collapse==TRUE

size=1: Numeric scalar. The relative size of the track. Can be overridden in the plotTracks function.

mergeGroups=FALSE: Logical scalar. Merge fully overlapping groups if collapse==TRUE.

StackedTrack:

reverseStacking=FALSE: Logical flag. Reverse the y-ordering of stacked items. I.e., features that are plotted on the bottom-most stacks will be moved to the top-most stack and vice versa.

stackHeight=0.75: Numeric between 0 and 1. Controls the vertical size and spacing between stacked elements. The number defines the proportion of the total available space for the stack that is used to draw the glyphs. E.g., a value of 0.5 means that half of the available vertical drawing space (for each stacking line) is used for the glyphs, and thus one quarter of the available space each is used for spacing above and below the glyph. Defaults to 0.75.

GdObject:

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

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

col.border.title="transparent": Integer or character scalar. The border color for the title panels.

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

cex.axis=NULL: Numeric scalar. The expansion factor for the axis annotation. Defaults to NULL, in which case it is computed 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.axis="white": Integer or character scalar. The font and line color for the y axis, if any.

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.symbol=NULL: Integer or character scalar. Default colors for plot symbols. Usually the same as the global col parameter.

col.title="white": Integer or character scalar. The font color for the title panels.

collapse=TRUE: Boolean controlling wether to collapse the content of the track to accomodate the minimum current device resolution. See collapsing for details.

fontface.title=2: Integer or character scalar. The font face for the title panels.

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

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.

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.grid=1: Numeric scalar. Default line width for grid lines, both when type=="g" in DataTracks and when display parameter grid==TRUE.

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.

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.

v=-1: Integer scalar. Parameter controlling the number of vertical grid lines, see panel.grid for details.

Author(s)

Florian Hahne, Steve Lianoglou

See Also

AnnotationTrack

DisplayPars

GdObject

GRanges

ImageMap

IRanges

RangeTrack

StackedTrack

collapsing

DataTrack

grouping

panel.grid

plotTracks

settings

Examples


## The empty object
GeneRegionTrack()

## Load some sample data
data(cyp2b10)

## Construct the object
grTrack <- GeneRegionTrack(start=26682683, end=26711643,
rstart=cyp2b10$start, rends=cyp2b10$end, chromosome=7, genome="mm9",
transcript=cyp2b10$transcript, gene=cyp2b10$gene, symbol=cyp2b10$symbol,
feature=cyp2b10$feature, exon=cyp2b10$exon,
name="Cyp2b10", strand=cyp2b10$strand)

## Directly from the data.frame
grTrack <- GeneRegionTrack(cyp2b10)

## From a TxDb object
if(require(GenomicFeatures)){
samplefile <- system.file("extdata", "hg19_knownGene_sample.sqlite", package="GenomicFeatures")
txdb <- loadDb(samplefile)
GeneRegionTrack(txdb)
GeneRegionTrack(txdb, chromosome="chr6", start=35000000, end=40000000)
}





## Plotting
plotTracks(grTrack)

## Track names
names(grTrack)
names(grTrack) <- "foo"
plotTracks(grTrack)

## Subsetting and splitting
subTrack <- subset(grTrack, from=26700000, to=26705000)
length(subTrack)
subTrack <- grTrack[transcript(grTrack)=="ENSMUST00000144140"]
split(grTrack, transcript(grTrack))

## Accessors
start(grTrack)
end(grTrack)
width(grTrack)
position(grTrack)
width(subTrack) <- width(subTrack)+100

strand(grTrack)
strand(subTrack) <- "-"

chromosome(grTrack)
chromosome(subTrack) <- "chrX"

genome(grTrack)
genome(subTrack) <- "hg19"

range(grTrack)
ranges(grTrack)

## Annotation
identifier(grTrack)
identifier(grTrack, "lowest")
identifier(subTrack) <- "bar"

feature(grTrack)
feature(subTrack) <- "foo"

exon(grTrack)
exon(subTrack) <- letters[1:2]

gene(grTrack)
gene(subTrack) <- "bar"

symbol(grTrack)
symbol(subTrack) <- "foo"

transcript(grTrack)
transcript(subTrack) <- c("foo", "bar")
chromosome(subTrack) <- "chr7"
plotTracks(subTrack)

values(grTrack)

## Grouping
group(grTrack)
group(subTrack) <- "Group 1"
transcript(subTrack)
plotTracks(subTrack)

## Collapsing transcripts
plotTracks(grTrack, collapseTranscripts=TRUE, showId=TRUE,
extend.left=10000, shape="arrow")

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

## coercion
as(grTrack, "data.frame")
as(grTrack, "UCSCData")

## HTML image map
coords(grTrack)
tags(grTrack)
grTrack <- plotTracks(grTrack)$foo
coords(grTrack)
tags(grTrack)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Gviz)
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit


Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Gviz/GeneRegionTrack-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GeneRegionTrack-class
> ### Title: GeneRegionTrack class and methods
> ### Aliases: GeneRegionTrack-class GeneRegionTrack
> ###   coerce,GeneRegionTrack,UCSCData-method
> ###   collapseTrack,GeneRegionTrack-method exon exon,GeneRegionTrack-method
> ###   exon<- exon<-,GeneRegionTrack,character-method
> ###   gene,GeneRegionTrack-method gene
> ###   gene<-,GeneRegionTrack,character-method gene<-
> ###   group,GeneRegionTrack-method group<-,GeneRegionTrack,character-method
> ###   identifier,GeneRegionTrack-method
> ###   identifier<-,GeneRegionTrack,character-method
> ###   initialize,GeneRegionTrack-method
> ###   initialize,ReferenceGeneRegionTrack-method
> ###   show,GeneRegionTrack-method show,ReferenceGeneRegionTrack-method
> ###   symbol,GeneRegionTrack-method
> ###   symbol<-,GeneRegionTrack,character-method symbol symbol<-
> ###   transcript,GeneRegionTrack-method
> ###   transcript<-,GeneRegionTrack,character-method transcript transcript<-
> ###   coerce,GRanges,GeneRegionTrack-method
> ###   coerce,GRangesList,GeneRegionTrack-method
> ###   coerce,TxDb,GeneRegionTrack-method
> ###   subset,ReferenceGeneRegionTrack-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> 
> ## The empty object
> GeneRegionTrack()
GeneRegionTrack 'GeneRegionTrack'
| genome: NA
| active chromosome: chrNA
| annotation features: 0
> 
> ## Load some sample data
> data(cyp2b10)
> 
> ## Construct the object
> grTrack <- GeneRegionTrack(start=26682683, end=26711643,
+ rstart=cyp2b10$start, rends=cyp2b10$end, chromosome=7, genome="mm9",
+ transcript=cyp2b10$transcript, gene=cyp2b10$gene, symbol=cyp2b10$symbol,
+ feature=cyp2b10$feature, exon=cyp2b10$exon,
+ name="Cyp2b10", strand=cyp2b10$strand)
> 
> ## Directly from the data.frame
> grTrack <- GeneRegionTrack(cyp2b10)
> 
> ## From a TxDb object
> if(require(GenomicFeatures)){
+ samplefile <- system.file("extdata", "hg19_knownGene_sample.sqlite", package="GenomicFeatures")
+ txdb <- loadDb(samplefile)
+ GeneRegionTrack(txdb)
+ GeneRegionTrack(txdb, chromosome="chr6", start=35000000, end=40000000)
+ }
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

GeneRegionTrack 'GeneRegionTrack'
| genome: hg19
| active chromosome: chr6
| annotation features: 71
> 
> 
> 
> ## Don't show: 
> ## For some annoying reason the postscript device does not know about
> ## the sans font
> #if(!interactive())
> #{
> font <- ps.options()$family
> displayPars(grTrack) <- list(fontfamily=font, fontfamily.title=font)
> #}
> ## End(Don't show)
> 
> ## Plotting
> plotTracks(grTrack)
> 
> ## Track names
> names(grTrack)
[1] "GeneRegionTrack"
> names(grTrack) <- "foo"
> plotTracks(grTrack)
> 
> ## Subsetting and splitting
> subTrack <- subset(grTrack, from=26700000, to=26705000)
> length(subTrack)
[1] 0
> subTrack <- grTrack[transcript(grTrack)=="ENSMUST00000144140"]
> split(grTrack, transcript(grTrack))
$ENSMUST00000005477
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 12

$ENSMUST00000072438
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 11

$ENSMUST00000144140
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 2

> 
> ## Accessors
> start(grTrack)
 [1] 25897620 25897676 25897685 25897685 25911238 25911238 25911554 25911554
 [9] 25913865 25913865 25914748 25914748 25915392 25915392 25916766 25916934
[17] 25916934 25917288 25917288 25917288 25925373 25926068 25926068 25926250
[25] 25926250
> end(grTrack)
 [1] 25897684 25897684 25897855 25897855 25911400 25911400 25911703 25911703
 [9] 25914025 25914025 25914924 25914924 25915533 25915533 25917121 25917121
[17] 25917121 25917429 25917429 25917430 25925399 25926249 25926249 25926559
[25] 25926624
> width(grTrack)
 [1]  65   9 171 171 163 163 150 150 161 161 177 177 142 142 356 188 188 142 142
[20] 143  27 182 182 310 375
> position(grTrack)
 [1] 25897652 25897680 25897770 25897770 25911319 25911319 25911628 25911628
 [9] 25913945 25913945 25914836 25914836 25915462 25915462 25916944 25917028
[17] 25917028 25917358 25917358 25917359 25925386 25926158 25926158 25926404
[25] 25926437
> width(subTrack) <- width(subTrack)+100
> 
> strand(grTrack)
 [1] "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+"
[20] "+" "+" "+" "+" "+" "+"
> strand(subTrack) <- "-"
> 
> chromosome(grTrack)
[1] "chr7"
> chromosome(subTrack) <- "chrX"
> 
> genome(grTrack)
[1] NA
> genome(subTrack) <- "hg19"
> 
> range(grTrack)
IRanges object with 25 ranges and 0 metadata columns:
           start       end     width
       <integer> <integer> <integer>
   [1]  25897620  25897684        65
   [2]  25897676  25897684         9
   [3]  25897685  25897855       171
   [4]  25897685  25897855       171
   [5]  25911238  25911400       163
   ...       ...       ...       ...
  [21]  25925373  25925399        27
  [22]  25926068  25926249       182
  [23]  25926068  25926249       182
  [24]  25926250  25926559       310
  [25]  25926250  25926624       375
> ranges(grTrack)
GRanges object with 25 ranges and 7 metadata columns:
       seqnames               ranges strand |        feature          id
          <Rle>            <IRanges>  <Rle> |       <factor> <character>
   [1]     chr7 [25897620, 25897684]      + |           utr5     unknown
   [2]     chr7 [25897676, 25897684]      + |           utr5     unknown
   [3]     chr7 [25897685, 25897855]      + | protein_coding     unknown
   [4]     chr7 [25897685, 25897855]      + | protein_coding     unknown
   [5]     chr7 [25911238, 25911400]      + | protein_coding     unknown
   ...      ...                  ...    ... .            ...         ...
  [21]     chr7 [25925373, 25925399]      + | protein_coding     unknown
  [22]     chr7 [25926068, 25926249]      + | protein_coding     unknown
  [23]     chr7 [25926068, 25926249]      + | protein_coding     unknown
  [24]     chr7 [25926250, 25926559]      + |           utr3     unknown
  [25]     chr7 [25926250, 25926624]      + |           utr3     unknown
                     exon         transcript               gene   symbol
                 <factor>           <factor>           <factor> <factor>
   [1] ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   [2] ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
   [3] ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   [4] ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
   [5] ENSMUSE00000973560 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   ...                ...                ...                ...      ...
  [21] ENSMUSE00000496705 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [22] ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
  [23] ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [24] ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [25] ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
         density
       <numeric>
   [1]         1
   [2]         1
   [3]         1
   [4]         1
   [5]         1
   ...       ...
  [21]         1
  [22]         1
  [23]         1
  [24]         1
  [25]         1
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> 
> ## Annotation
> identifier(grTrack)
 [1] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
 [8] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[15] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[22] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
> identifier(grTrack, "lowest")
 [1] "ENSMUSE00000742021" "ENSMUSE00000489385" "ENSMUSE00000742021"
 [4] "ENSMUSE00000489385" "ENSMUSE00000973560" "ENSMUSE00000973560"
 [7] "ENSMUSE00001043622" "ENSMUSE00001043622" "ENSMUSE00001013991"
[10] "ENSMUSE00001013991" "ENSMUSE00000996531" "ENSMUSE00000996531"
[13] "ENSMUSE00000999790" "ENSMUSE00000999790" "ENSMUSE00000736922"
[16] "ENSMUSE00000963884" "ENSMUSE00000963884" "ENSMUSE00001063063"
[19] "ENSMUSE00001063063" "ENSMUSE00000748299" "ENSMUSE00000496705"
[22] "ENSMUSE00000498616" "ENSMUSE00000750625" "ENSMUSE00000750625"
[25] "ENSMUSE00000498616"
> identifier(subTrack) <- "bar"
> 
> feature(grTrack)
 [1] "utr5"           "utr5"           "protein_coding" "protein_coding"
 [5] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
 [9] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[13] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[17] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[21] "protein_coding" "protein_coding" "protein_coding" "utr3"          
[25] "utr3"          
> feature(subTrack) <- "foo"
> 
> exon(grTrack)
 [1] "ENSMUSE00000742021" "ENSMUSE00000489385" "ENSMUSE00000742021"
 [4] "ENSMUSE00000489385" "ENSMUSE00000973560" "ENSMUSE00000973560"
 [7] "ENSMUSE00001043622" "ENSMUSE00001043622" "ENSMUSE00001013991"
[10] "ENSMUSE00001013991" "ENSMUSE00000996531" "ENSMUSE00000996531"
[13] "ENSMUSE00000999790" "ENSMUSE00000999790" "ENSMUSE00000736922"
[16] "ENSMUSE00000963884" "ENSMUSE00000963884" "ENSMUSE00001063063"
[19] "ENSMUSE00001063063" "ENSMUSE00000748299" "ENSMUSE00000496705"
[22] "ENSMUSE00000498616" "ENSMUSE00000750625" "ENSMUSE00000750625"
[25] "ENSMUSE00000498616"
> exon(subTrack) <- letters[1:2]
> 
> gene(grTrack)
 [1] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
 [4] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
 [7] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[10] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[13] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[16] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[19] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[22] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[25] "ENSMUSG00000030483"
> gene(subTrack) <- "bar"
> 
> symbol(grTrack)
 [1] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
 [8] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[15] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[22] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
> symbol(subTrack) <- "foo"
> 
> transcript(grTrack)
 [1] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
 [4] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
 [7] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[10] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
[13] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000144140"
[16] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[19] "ENSMUST00000005477" "ENSMUST00000144140" "ENSMUST00000005477"
[22] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000005477"
[25] "ENSMUST00000072438"
> transcript(subTrack) <- c("foo", "bar")
> chromosome(subTrack) <- "chr7"
> plotTracks(subTrack)
> 
> values(grTrack)
          feature      id               exon         transcript
1            utr5 unknown ENSMUSE00000742021 ENSMUST00000072438
2            utr5 unknown ENSMUSE00000489385 ENSMUST00000005477
3  protein_coding unknown ENSMUSE00000742021 ENSMUST00000072438
4  protein_coding unknown ENSMUSE00000489385 ENSMUST00000005477
5  protein_coding unknown ENSMUSE00000973560 ENSMUST00000072438
6  protein_coding unknown ENSMUSE00000973560 ENSMUST00000005477
7  protein_coding unknown ENSMUSE00001043622 ENSMUST00000072438
8  protein_coding unknown ENSMUSE00001043622 ENSMUST00000005477
9  protein_coding unknown ENSMUSE00001013991 ENSMUST00000072438
10 protein_coding unknown ENSMUSE00001013991 ENSMUST00000005477
11 protein_coding unknown ENSMUSE00000996531 ENSMUST00000072438
12 protein_coding unknown ENSMUSE00000996531 ENSMUST00000005477
13 protein_coding unknown ENSMUSE00000999790 ENSMUST00000072438
14 protein_coding unknown ENSMUSE00000999790 ENSMUST00000005477
15 protein_coding unknown ENSMUSE00000736922 ENSMUST00000144140
16 protein_coding unknown ENSMUSE00000963884 ENSMUST00000072438
17 protein_coding unknown ENSMUSE00000963884 ENSMUST00000005477
18 protein_coding unknown ENSMUSE00001063063 ENSMUST00000072438
19 protein_coding unknown ENSMUSE00001063063 ENSMUST00000005477
20 protein_coding unknown ENSMUSE00000748299 ENSMUST00000144140
21 protein_coding unknown ENSMUSE00000496705 ENSMUST00000005477
22 protein_coding unknown ENSMUSE00000498616 ENSMUST00000072438
23 protein_coding unknown ENSMUSE00000750625 ENSMUST00000005477
24           utr3 unknown ENSMUSE00000750625 ENSMUST00000005477
25           utr3 unknown ENSMUSE00000498616 ENSMUST00000072438
                 gene  symbol density
1  ENSMUSG00000030483 Cyp2b10       1
2  ENSMUSG00000030483 Cyp2b10       1
3  ENSMUSG00000030483 Cyp2b10       1
4  ENSMUSG00000030483 Cyp2b10       1
5  ENSMUSG00000030483 Cyp2b10       1
6  ENSMUSG00000030483 Cyp2b10       1
7  ENSMUSG00000030483 Cyp2b10       1
8  ENSMUSG00000030483 Cyp2b10       1
9  ENSMUSG00000030483 Cyp2b10       1
10 ENSMUSG00000030483 Cyp2b10       1
11 ENSMUSG00000030483 Cyp2b10       1
12 ENSMUSG00000030483 Cyp2b10       1
13 ENSMUSG00000030483 Cyp2b10       1
14 ENSMUSG00000030483 Cyp2b10       1
15 ENSMUSG00000030483 Cyp2b10       1
16 ENSMUSG00000030483 Cyp2b10       1
17 ENSMUSG00000030483 Cyp2b10       1
18 ENSMUSG00000030483 Cyp2b10       1
19 ENSMUSG00000030483 Cyp2b10       1
20 ENSMUSG00000030483 Cyp2b10       1
21 ENSMUSG00000030483 Cyp2b10       1
22 ENSMUSG00000030483 Cyp2b10       1
23 ENSMUSG00000030483 Cyp2b10       1
24 ENSMUSG00000030483 Cyp2b10       1
25 ENSMUSG00000030483 Cyp2b10       1
> 
> ## Grouping
> group(grTrack)
 [1] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
 [4] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
 [7] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[10] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
[13] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000144140"
[16] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[19] "ENSMUST00000005477" "ENSMUST00000144140" "ENSMUST00000005477"
[22] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000005477"
[25] "ENSMUST00000072438"
> group(subTrack) <- "Group 1"
> transcript(subTrack)
[1] "Group 1" "Group 1"
> plotTracks(subTrack)
> 
> ## Collapsing transcripts
> plotTracks(grTrack, collapseTranscripts=TRUE, showId=TRUE,
+ extend.left=10000, shape="arrow")
> 
> ## Stacking
> stacking(grTrack)
[1] "squish"
> stacking(grTrack) <- "dense"
> plotTracks(grTrack)
> 
> ## coercion
> as(grTrack, "data.frame")
   X.seqnames  X.start    X.end X.width X.strand      X.feature    X.id
1        chr7 25897620 25897684      65        +           utr5 unknown
2        chr7 25897676 25897684       9        +           utr5 unknown
3        chr7 25897685 25897855     171        + protein_coding unknown
4        chr7 25897685 25897855     171        + protein_coding unknown
5        chr7 25911238 25911400     163        + protein_coding unknown
6        chr7 25911238 25911400     163        + protein_coding unknown
7        chr7 25911554 25911703     150        + protein_coding unknown
8        chr7 25911554 25911703     150        + protein_coding unknown
9        chr7 25913865 25914025     161        + protein_coding unknown
10       chr7 25913865 25914025     161        + protein_coding unknown
11       chr7 25914748 25914924     177        + protein_coding unknown
12       chr7 25914748 25914924     177        + protein_coding unknown
13       chr7 25915392 25915533     142        + protein_coding unknown
14       chr7 25915392 25915533     142        + protein_coding unknown
15       chr7 25916766 25917121     356        + protein_coding unknown
16       chr7 25916934 25917121     188        + protein_coding unknown
17       chr7 25916934 25917121     188        + protein_coding unknown
18       chr7 25917288 25917429     142        + protein_coding unknown
19       chr7 25917288 25917429     142        + protein_coding unknown
20       chr7 25917288 25917430     143        + protein_coding unknown
21       chr7 25925373 25925399      27        + protein_coding unknown
22       chr7 25926068 25926249     182        + protein_coding unknown
23       chr7 25926068 25926249     182        + protein_coding unknown
24       chr7 25926250 25926559     310        +           utr3 unknown
25       chr7 25926250 25926624     375        +           utr3 unknown
               X.exon       X.transcript             X.gene X.symbol X.density
1  ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
2  ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
3  ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
4  ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
5  ENSMUSE00000973560 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
6  ENSMUSE00000973560 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
7  ENSMUSE00001043622 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
8  ENSMUSE00001043622 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
9  ENSMUSE00001013991 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
10 ENSMUSE00001013991 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
11 ENSMUSE00000996531 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
12 ENSMUSE00000996531 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
13 ENSMUSE00000999790 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
14 ENSMUSE00000999790 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
15 ENSMUSE00000736922 ENSMUST00000144140 ENSMUSG00000030483  Cyp2b10         1
16 ENSMUSE00000963884 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
17 ENSMUSE00000963884 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
18 ENSMUSE00001063063 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
19 ENSMUSE00001063063 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
20 ENSMUSE00000748299 ENSMUST00000144140 ENSMUSG00000030483  Cyp2b10         1
21 ENSMUSE00000496705 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
22 ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
23 ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
24 ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10         1
25 ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10         1
          feature      id               exon         transcript
1            utr5 unknown ENSMUSE00000742021 ENSMUST00000072438
2            utr5 unknown ENSMUSE00000489385 ENSMUST00000005477
3  protein_coding unknown ENSMUSE00000742021 ENSMUST00000072438
4  protein_coding unknown ENSMUSE00000489385 ENSMUST00000005477
5  protein_coding unknown ENSMUSE00000973560 ENSMUST00000072438
6  protein_coding unknown ENSMUSE00000973560 ENSMUST00000005477
7  protein_coding unknown ENSMUSE00001043622 ENSMUST00000072438
8  protein_coding unknown ENSMUSE00001043622 ENSMUST00000005477
9  protein_coding unknown ENSMUSE00001013991 ENSMUST00000072438
10 protein_coding unknown ENSMUSE00001013991 ENSMUST00000005477
11 protein_coding unknown ENSMUSE00000996531 ENSMUST00000072438
12 protein_coding unknown ENSMUSE00000996531 ENSMUST00000005477
13 protein_coding unknown ENSMUSE00000999790 ENSMUST00000072438
14 protein_coding unknown ENSMUSE00000999790 ENSMUST00000005477
15 protein_coding unknown ENSMUSE00000736922 ENSMUST00000144140
16 protein_coding unknown ENSMUSE00000963884 ENSMUST00000072438
17 protein_coding unknown ENSMUSE00000963884 ENSMUST00000005477
18 protein_coding unknown ENSMUSE00001063063 ENSMUST00000072438
19 protein_coding unknown ENSMUSE00001063063 ENSMUST00000005477
20 protein_coding unknown ENSMUSE00000748299 ENSMUST00000144140
21 protein_coding unknown ENSMUSE00000496705 ENSMUST00000005477
22 protein_coding unknown ENSMUSE00000498616 ENSMUST00000072438
23 protein_coding unknown ENSMUSE00000750625 ENSMUST00000005477
24           utr3 unknown ENSMUSE00000750625 ENSMUST00000005477
25           utr3 unknown ENSMUSE00000498616 ENSMUST00000072438
                 gene  symbol density
1  ENSMUSG00000030483 Cyp2b10       1
2  ENSMUSG00000030483 Cyp2b10       1
3  ENSMUSG00000030483 Cyp2b10       1
4  ENSMUSG00000030483 Cyp2b10       1
5  ENSMUSG00000030483 Cyp2b10       1
6  ENSMUSG00000030483 Cyp2b10       1
7  ENSMUSG00000030483 Cyp2b10       1
8  ENSMUSG00000030483 Cyp2b10       1
9  ENSMUSG00000030483 Cyp2b10       1
10 ENSMUSG00000030483 Cyp2b10       1
11 ENSMUSG00000030483 Cyp2b10       1
12 ENSMUSG00000030483 Cyp2b10       1
13 ENSMUSG00000030483 Cyp2b10       1
14 ENSMUSG00000030483 Cyp2b10       1
15 ENSMUSG00000030483 Cyp2b10       1
16 ENSMUSG00000030483 Cyp2b10       1
17 ENSMUSG00000030483 Cyp2b10       1
18 ENSMUSG00000030483 Cyp2b10       1
19 ENSMUSG00000030483 Cyp2b10       1
20 ENSMUSG00000030483 Cyp2b10       1
21 ENSMUSG00000030483 Cyp2b10       1
22 ENSMUSG00000030483 Cyp2b10       1
23 ENSMUSG00000030483 Cyp2b10       1
24 ENSMUSG00000030483 Cyp2b10       1
25 ENSMUSG00000030483 Cyp2b10       1
> as(grTrack, "UCSCData")
UCSC track 'foo'
UCSCData object with 3 ranges and 6 metadata columns:
                     seqnames               ranges strand |                 id
                        <Rle>            <IRanges>  <Rle> |        <character>
  ENSMUST00000005477     chr7 [25897676, 25926559]      + | ENSMUST00000005477
  ENSMUST00000072438     chr7 [25897620, 25926624]      + | ENSMUST00000072438
  ENSMUST00000144140     chr7 [25916766, 25917430]      + | ENSMUST00000144140
                            name     itemRgb blockCount
                     <character> <character>  <integer>
  ENSMUST00000005477     Cyp2b10     #FFD58A         12
  ENSMUST00000072438     Cyp2b10     #FFD58A         11
  ENSMUST00000144140     Cyp2b10     #FFD58A          2
                                                       blockSizes
                                                      <character>
  ENSMUST00000005477 9,171,163,150,161,177,142,188,142,27,182,310
  ENSMUST00000072438   65,171,163,150,161,177,142,188,142,182,375
  ENSMUST00000144140                                      356,143
                                                                         blockStarts
                                                                         <character>
  ENSMUST00000005477 0,9,13562,13878,16189,17072,17716,19258,19612,27697,28392,28574
  ENSMUST00000072438      0,65,13618,13934,16245,17128,17772,19314,19668,28448,28630
  ENSMUST00000144140                                                           0,522
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> 
> ## HTML image map
> coords(grTrack)
NULL
> tags(grTrack)
NULL
> grTrack <- plotTracks(grTrack)$foo
> coords(grTrack)
                            x1     y1        x2     y2
ENSMUSE00000973560   239.54551  64.50 241.93921 415.50
ENSMUSE00001043622   244.21469  64.50 246.41630 415.50
ENSMUSE00001013991   278.36174  64.50 280.72588 415.50
ENSMUSE00000996531   291.40884  64.50 294.00939 415.50
ENSMUSE00000999790   300.92450  64.50 303.00790 415.50
ENSMUSE00000963884   323.70890  64.50 326.47199 415.50
ENSMUSE00001063063   328.93956  64.50 331.02296 415.50
ENSMUSE00000498616   458.67175  64.50 461.34619 415.50
ENSMUSE00000498616.1 461.36096 152.25 466.88714 327.75
ENSMUSE00000973560.1 239.54551  64.50 241.93921 415.50
ENSMUSE00001043622.1 244.21469  64.50 246.41630 415.50
ENSMUSE00001013991.1 278.36174  64.50 280.72588 415.50
ENSMUSE00000996531.1 291.40884  64.50 294.00939 415.50
ENSMUSE00000999790.1 300.92450  64.50 303.00790 415.50
ENSMUSE00000963884.1 323.70890  64.50 326.47199 415.50
ENSMUSE00001063063.1 328.93956  64.50 331.02296 415.50
ENSMUSE00000496705   448.09222  64.50 449.08221 415.50
ENSMUSE00000750625   458.67175  64.50 461.34619 415.50
ENSMUSE00000750625.1 461.36096 152.25 465.92671 327.75
ENSMUSE00000736922   321.22656  64.50 326.47199 415.50
ENSMUSE00000748299   328.93956  64.50 331.03774 415.50
ENSMUSE00000742021    38.29809  64.50  41.79997 415.50
ENSMUSE00000489385    38.71181  64.50  41.79997 415.50
> tags(grTrack)
$fill
  ENSMUSE00000973560   ENSMUSE00001043622   ENSMUSE00001013991 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
  ENSMUSE00000996531   ENSMUSE00000999790   ENSMUSE00000963884 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
  ENSMUSE00001063063   ENSMUSE00000498616 ENSMUSE00000498616.1 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
ENSMUSE00000973560.1 ENSMUSE00001043622.1 ENSMUSE00001013991.1 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
ENSMUSE00000996531.1 ENSMUSE00000999790.1 ENSMUSE00000963884.1 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
ENSMUSE00001063063.1   ENSMUSE00000496705   ENSMUSE00000750625 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
ENSMUSE00000750625.1   ENSMUSE00000736922   ENSMUSE00000748299 
           "#FFD58A"            "#FFD58A"            "#FFD58A" 
  ENSMUSE00000742021   ENSMUSE00000489385 
           "#FFD58A"            "#FFD58A" 

$strand
  ENSMUSE00000973560   ENSMUSE00001043622   ENSMUSE00001013991 
                 "+"                  "+"                  "+" 
  ENSMUSE00000996531   ENSMUSE00000999790   ENSMUSE00000963884 
                 "+"                  "+"                  "+" 
  ENSMUSE00001063063   ENSMUSE00000498616 ENSMUSE00000498616.1 
                 "+"                  "+"                  "+" 
ENSMUSE00000973560.1 ENSMUSE00001043622.1 ENSMUSE00001013991.1 
                 "+"                  "+"                  "+" 
ENSMUSE00000996531.1 ENSMUSE00000999790.1 ENSMUSE00000963884.1 
                 "+"                  "+"                  "+" 
ENSMUSE00001063063.1   ENSMUSE00000496705   ENSMUSE00000750625 
                 "+"                  "+"                  "+" 
ENSMUSE00000750625.1   ENSMUSE00000736922   ENSMUSE00000748299 
                 "+"                  "+"                  "+" 
  ENSMUSE00000742021   ENSMUSE00000489385 
                 "+"                  "+" 

$text
  ENSMUSE00000973560   ENSMUSE00001043622   ENSMUSE00001013991 
"ENSMUSE00000973560" "ENSMUSE00001043622" "ENSMUSE00001013991" 
  ENSMUSE00000996531   ENSMUSE00000999790   ENSMUSE00000963884 
"ENSMUSE00000996531" "ENSMUSE00000999790" "ENSMUSE00000963884" 
  ENSMUSE00001063063   ENSMUSE00000498616 ENSMUSE00000498616.1 
"ENSMUSE00001063063" "ENSMUSE00000498616" "ENSMUSE00000498616" 
ENSMUSE00000973560.1 ENSMUSE00001043622.1 ENSMUSE00001013991.1 
"ENSMUSE00000973560" "ENSMUSE00001043622" "ENSMUSE00001013991" 
ENSMUSE00000996531.1 ENSMUSE00000999790.1 ENSMUSE00000963884.1 
"ENSMUSE00000996531" "ENSMUSE00000999790" "ENSMUSE00000963884" 
ENSMUSE00001063063.1   ENSMUSE00000496705   ENSMUSE00000750625 
"ENSMUSE00001063063" "ENSMUSE00000496705" "ENSMUSE00000750625" 
ENSMUSE00000750625.1   ENSMUSE00000736922   ENSMUSE00000748299 
"ENSMUSE00000750625" "ENSMUSE00000736922" "ENSMUSE00000748299" 
  ENSMUSE00000742021   ENSMUSE00000489385 
"ENSMUSE00000742021" "ENSMUSE00000489385" 

$start
  ENSMUSE00000973560   ENSMUSE00001043622   ENSMUSE00001013991 
          "25911238"           "25911554"           "25913865" 
  ENSMUSE00000996531   ENSMUSE00000999790   ENSMUSE00000963884 
          "25914748"           "25915392"           "25916934" 
  ENSMUSE00001063063   ENSMUSE00000498616 ENSMUSE00000498616.1 
          "25917288"           "25926068"           "25926250" 
ENSMUSE00000973560.1 ENSMUSE00001043622.1 ENSMUSE00001013991.1 
          "25911238"           "25911554"           "25913865" 
ENSMUSE00000996531