GenomeAxisTrack-class: GenomeAxisTrack class and methods

GenomeAxisTrack-classR Documentation

GenomeAxisTrack class and methods

Description

A class representing a customizable genomic axis.

Usage

## S4 method for signature 'GenomeAxisTrack'
initialize(.Object, range, ids, ...)

GenomeAxisTrack(range = NULL, name = "Axis", id, ...)

## S4 method for signature 'GenomeAxisTrack'
ranges(x)

## S4 method for signature 'GenomeAxisTrack'
range(x)

## S4 method for signature 'GenomeAxisTrack'
start(x)

## S4 replacement method for signature 'GenomeAxisTrack'
start(x) <- value

## S4 method for signature 'GenomeAxisTrack'
end(x)

## S4 replacement method for signature 'GenomeAxisTrack'
end(x) <- value

## S4 method for signature 'GenomeAxisTrack'
width(x)

## S4 method for signature 'GenomeAxisTrack'
length(x)

## S4 method for signature 'GenomeAxisTrack'
values(x)

## S4 method for signature 'GenomeAxisTrack'
strand(x)

## S4 method for signature 'GenomeAxisTrack'
collapseTrack(
  GdObject,
  min.width = 1,
  min.distance = 0,
  collapse = TRUE,
  diff = .pxResolution(coord = "x"),
  xrange
)

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

## S4 method for signature 'GenomeAxisTrack'
subset(x, from = NULL, to = NULL, sort = FALSE, ...)

## S4 method for signature 'GenomeAxisTrack'
drawGD(GdObject, minBase, maxBase, prepare = FALSE, subset = TRUE, ...)

## S4 method for signature 'GenomeAxisTrack'
show(object)

Arguments

range

Optional object of class GRanges or IRanges containing regions to be highlighted on the axis by coloured boxes.

...

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

name

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

id

A character vector of the same length as range containing identifiers for the ranges. If missing, the constructor will try to extract the ids from names(range).

x

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

Details

A GenomeAxisTrack can be customized using the familiar display parameters. By providing a GRanges or IRanges object to the constructor, ranges on the axis can be further highlighted.

With the scale display parameter, a small scale indicator can be shown instead of the entire genomic axis. The scale can either be provided as a fraction of the plotting region (it will be rounded to the nearest human readable absolute value) or as an absolute value and is always displayed in bp, kb, mb or gb units. Note that most display parameters for the GenomeAxisTrack are ignored when a scale is used instead of the full axis. In particular, only the parameters exponent, alpha, lwd, col, cex, distFromAxis and labelPos are used.

Value

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

Objects can be created using the constructor function GenomeAxisTrack.

Functions

  • initialize(GenomeAxisTrack): Intialize.

  • GenomeAxisTrack(): Constructor

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

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

  • start(GenomeAxisTrack): return the start coordinates of the track items.

  • start(GenomeAxisTrack) <- value: replace the start coordinates of the track items.

  • end(GenomeAxisTrack): return the end coordinates of the track items.

  • end(GenomeAxisTrack) <- value: replace the end coordinates of the track items.

  • width(GenomeAxisTrack): return the with of the track items in genomic coordinates.

  • length(GenomeAxisTrack): return the number of items stored in the ranges slot.

  • values(GenomeAxisTrack): return all additional annotation information except for the genomic coordinates for the track items.

  • strand(GenomeAxisTrack): 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.

  • collapseTrack(GenomeAxisTrack): 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.

  • x[i: subset the items in the GenomeAxisTrack 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(GenomeAxisTrack): plot subset all the contained tracks in an GenomeAxisTrack by coordinates and sort if necessary.

  • drawGD(GenomeAxisTrack): 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.

  • show(GenomeAxisTrack): Show method.

Author(s)

Florian Hahne

See Also

DisplayPars

GdObject

GRanges

HighlightTrack

ImageMap

IRanges

RangeTrack

DataTrack

collapsing

grouping

panel.grid

plotTracks

settings

Examples

## Construct object
axTrack <- GenomeAxisTrack(
    name = "Axis",
    range <- IRanges(start = c(100, 300, 800), end = c(150, 400, 1000))
)



## Plotting
plotTracks(axTrack, from = 0, to = 1100)

## Track names
names(axTrack)
names(axTrack) <- "foo"

## Subsetting and splitting
subTrack <- subset(axTrack, from = 0, to = 500)
length(subTrack)
subTrack[1]
split(axTrack, c(1, 1, 2))

## Accessors
start(axTrack)
end(axTrack)
width(axTrack)

strand(axTrack)

range(axTrack)
ranges(axTrack)

## Annotation
values(axTrack)

## Grouping
group(axTrack)

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

## adding an axis to another track
data(cyp2b10)
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,
    name = "Cyp2b10", strand = cyp2b10$strand
)

plotTracks(list(grTrack, GenomeAxisTrack()))
plotTracks(list(grTrack, GenomeAxisTrack(scale = 0.1)))
plotTracks(list(grTrack, GenomeAxisTrack(scale = 5000)))
plotTracks(list(grTrack, GenomeAxisTrack(scale = 0.5, labelPos = "below")))

ivanek/Gviz documentation built on Nov. 20, 2023, 8:16 p.m.