S4 class for gTrack

Class gTrack defines a subsettable object that wraps formatting information around genomic data (GRanges, GRangesList, RleLists, UCSC formats, ffTrack) and can be displayed in a "genome browser" style plot.

Arguments described as "formatting" are vectors. They are replicated (if necessary) to match the length of the object.

gTrack(
  data = NULL,
  y.field = NA,
  mdata = NULL,
  edges = NULL,
  vars = NULL,
  colormaps = NULL,
  height = 10,
  ygap = 2,
  ylab = "",
  stack.gap = 0,
  cex.label = 1,
  gr.cex.label = cex.label * 0.8,
  gr.srt.label = 0,
  col = NA,
  border = NA,
  angle = 15,
  name = "",
  gr.colorfield = NA,
  y.quantile = 0.01,
  y.cap = T,
  lwd.border = 1,
  hadj.label = 1,
  vadj.label = 0.5,
  smooth = NA,
  round = NA,
  ywid = NA,
  ypad = 0,
  seqinfo = NA,
  circles = FALSE,
  lines = FALSE,
  bars = FALSE,
  draw.paths = FALSE,
  path.col = "black",
  path.lwd = 1,
  draw.var = FALSE,
  triangle = !is.null(mdata),
  max.ranges = 50000,
  source.file.chrsub = T,
  y0.bar = NA,
  yaxis = !is.na(y.field),
  yaxis.pretty = 5,
  yaxis.cex = 1,
  chr.sub = TRUE,
  edgevars = NA,
  gr.labelfield = NA,
  grl.labelfield = NA,
  grl.colorfield = NA,
  grl.cexfield = NA,
  xaxis.prefix = "",
  xaxis.unit = 1,
  xaxis.suffix = "",
  xaxis.round = 3,
  xaxis.cex.label = 1,
  xaxis.newline = TRUE,
  xaxis.chronly = FALSE,
  xaxis.width = TRUE,
  xaxis.interval = "auto",
  xaxis.label.angle = 0,
  xaxis.ticklen = 1,
  xaxis.cex.tick = 1,
  sep.lty = 2,
  sep.lwd = 1,
  sep.bg.col = "gray95",
  sep.draw = TRUE,
  y0 = NA,
  y1 = NA,
  m.sep.lwd = 1,
  cmap.min = NA,
  cmap.max = NA,
  labels.suppress = FALSE,
  labels.suppress.grl = labels.suppress,
  labels.suppress.gr = labels.suppress,
  bg.col = "white",
  formatting = NA
)

Arguments

data

Instance of one of the following objects: (1) GRanges (2) GRangesList (3) ffTrack or (4) character representing Bed, Wig, BigWig, or .rds GRanges file. It can also be a list of the above (if specifying multiplying tracks.

y.field

vector or scalar character referencing meta data field of GRanges or GRangesList to use for "y axis" coordinate when plotting numeric tracks, (note: for a RleList or ffTrack this field is automatically set to "score"), default is NA for non-numeric tracks

mdata

Square matrix representing values at connections between genomic elements (e.g. chr8:1,000-2,000 to chr3:5,000-6,000). The number of rows (and thus columns) must be equal to the length of the data element. The value of the (i,j) element of this matrix represents a value for the intersection of data[i] and data[j]. Note that all connections are assumed to be symmetric, and only the upper triangle will be read. Displays a warning if the matrix is non-symmetric

edges

Data frame of columns $from, $to, and optional fields $col, $lwd, and $lty, specifying edges linking data items. Also can be a list of the above if specifying multiple tracks (and must be compatible in length with data arg)

colormaps

length(.Object) length named list of named vectors whose entry i maps uniques value of a data field to colors. The data.field is specified by the name of the list entry, and the unique values / colors are specified by the named vector.

height

vector or scalar numeric specifying height of track(s) (in relative units)

ygap

vector or scalar numeric specifying gap between tracks

stack.gap

vector or scalar.numeric specifying x gap between stacking non-numeric GRanges or GrangesLists items in track(s)

cex.label

vector or scalar numeric specifying the expansion factor of the range labels (formatting)

gr.cex.label

vector or scalar numeric specifying GRanges label character expansion (default is cex.label) (formatting)

gr.srt.label

vector or scalar numeric between 0 and 180 specifying rotation of GRanges labels (formatting)

col

vector or scalar character specifying static color for track(s), if NA then color is specified by colormaps() property or gr.colorfield or col meta data field of GRanges / GRangesList data object

border

vector or scalar character specifying static border for polygons in track(s), if NA then $border is determine duing gr.colorfield / colormap or meta field $border of GRanges / GRangesList

angle

vector of scalar numeric specifying angle of polygons that represent signed range' items (only relevant if used within chainedTracks object)

name

vector or scalar character specifying name of this track, which will be displayed on label to the left of the track

lwd.border

vector or scalar integer specifying the thickness of the polygon borders (formatting)

hadj.label

vector or scalar numeric specifying the horizontal adjustment of the range labels (formatting)

vadj.label

vector or scalar numeric specifying the vertical adjustment of the range labels (formatting)

ywid

vector or scalar numeric specifying the y-extent of individual ranges (in local plot coordinates)

ypad

vector or scalar numeric between 0 and 1 specifying how much whitespace padding to add within panel (formatting)

circles

vector or scalar logical specifying whether to scatter plot range data (formatting)

lines

vector or scalar logical specifying whether to line plot range data (formatting)

bars

vector or scalar logical specifying whether to bar plot range data (formatting)

draw.paths

vector or scalar logical specifying whether to interpret GRangesLists as "paths" and connect them with a a set of spline curves. (formatting)

path.col

vector or scalar character specifying color of path (only applicable for tracks in which draw.paths = T) (formatting)

draw.var

vector or scalar logical specifying whether to draw.var for GRanges / GRangesList specifying reads (GRanges must contain $cigar +/- $MD field) (formatting)

max.ranges

vector or scalar numeric specifying what is the max number of ranges to plot in a window (formatting)

source.file.chrsub

vector or scalar logical specifying whether or not sub "chr" out of any external files (e.g. UCSC style files) (formatting)

y0.bar

vector or scalar numeric specifying where to draw the lower boundary of a bar in a bar plot (only applicable if bars == T) (formatting)

yaxis

vector or scalar logical specifying whether to print yaxis (formatting)

yaxis.pretty

vector or scalar positive integer specifying how many ticks to optimally draw on yaxis (formatting)

gr.labelfield

vector or scalar character specifying which GRanges meta data field to use for GRanges label (default "label") (formatting)

grl.labelfield

vector or scalar character specifying which GRanges meta data field to use for GRangesList label (default "label") (formatting)

grl.colorfield

vector or scalar character specifying which GRanges meta data field to use for GRangesList labels color (default "label.color") (formatting)

grl.cexfield

vector or scalar character specifying which GRanges meta data field to use for GRangesList labels cex (default "cex.label") (formatting)

xaxis.unit

vector or scalar numeric specifying the unit that will be used in describing x axis coordinates (TODO: move to display) (formatting)

xaxis.suffix

vector or scalar numeric specifying the suffix that will be used in describin x axis coordinates (TODO: move to display) (formatting)

xaxis.round

vector or scalar non-neg integer specifying number of decimals to round xaxis coordinate labels (formatting)

xaxis.newline

vector or scalar logical specifying whether to draw a newline in the xaxis coordinate labels (formatting)

xaxis.width

Logical scalar specifying whether to add window width to xaxis window labels [TRUE]

xaxis.label.angle

vector or scalar numeric between 0 and 360 specifying angle with which to draw xaxis coordinate labels (formatting)

xaxis.ticklen

Scalar numeric specifying lengths for axis ticks (formatting)

xaxis.cex.tick

Scalar numeric specifying expansion factor for axis tick labels (formatting)

sep.lty

Scalar integer specifying line style for window separators [2] (dashed line)

sep.lwd

Scalar numeric specifying line thickness for window separators [1]

sep.bg.col

Color (supplied by name or hex code) for the background of the windows [gray95]

sep.draw

Logical allowing separators to be turned off [FALSE]

cmap.min

minimum saturating data value of color map for triangle plot

cmap.max

maximum saturating data value of color map for triangle plot

labels.suppress

whether to suppress labels (both GRangesList and GRanges)

labels.suppress.gr

whether to suppress GRangesList labels

legend.maxitems

Scalar positive integer specifying what is the maximum number of items to include in legend [Inf]

label.suppress

vector or scalar logical flag specifying whether to suppress all GRanges / GRangesList label drawing (formatting)

label.suppress.gr

vector or scalar logical flag specifying whether to suppress GRanges label drawing (formatting)

label.suppress.grl

vector or scalar logical flag specifying whether to suppress GRangesList label drawing (formatting)

cex.label.gr

size of bottom level label (i.e. GRanges in a GrangesListitem, e.g. exons in a gene)

split

vector or scalar logical flag specifying whether to split when lifting (only relevant if used wihtin chainedTracks object)

xaxis.nticks

vector or scalar positive integer specifying how many xaxis ticks to optimally draw (formatting)

y.grid.col

vector or scalar character specifying color of "gridlines" used to specify numeric track data (formatting)

y.grid.cex

vector or scalar non-neg numeric specifying character expansion for y tick / y grid labels (formatting)

y.grid.lty

vector or scalar positive integer specifying line style of y grid lines for numeric tracks (formatting)

y.grid.lwd

vector or scalar positive integer specifying thickness of y grid lines for numeric tracks (formatting)

y.grid.labx

vector or scalar positive integer specifying fraction of xlim left of plot to place y axis labels (formatting)

path.col.arrow

vector or scalar character specifying color of arrow of path (only applicable for tracks in which draw.paths = T) (formatting)

path.cex.arrow

vector or scalar numeric > 0 specifying expansion factor of arrow of path (only applicable for tracks in which draw.paths = T) (formatting)

path.stack.y.gap

vector or scalar numeric > 0 specifying y stack gap of paths (only applicable for tracks in which draw.paths = T) (formatting)

path.stack.x.gap

vector or scalar numeric > 0 specifying x stack gap for paths (only applicable for tracks in which draw.paths = T) (formatting)

path.cex.v

vector or scalar numeric > 0 specifying vertical bulge of sline in paths (only applicable for tracks in which draw.paths = T) (formatting)

path.cex.h

vector or scalar numeric > 0 specifying horizontal bulge of spline in paths (formatting) (only applicable for tracks in which draw.paths = T) (formatting)

draw.backbone

vector or scalar logical specifying whether to draw "backbone" connecting different items in a GRangesList item (formatting)

...

additional formatting arguments to gTrack

Slots

data

length(.Object) length list containing genomic data (e.g. GRanges, GrangesLists, RleLists, path to ucsc file or ffTrack file on disk)

seqinfo

Seqinfo object

colormap

length(.Object) length named list of named vectors whose entry i specifies the colormap for the meta data field of object entry i (specified by the name) and maps unique value of that data field to colors (specified by the named vector)

edges

list of data.frames of length length(.Object) which has columns $from, $to, and optional fields $col, $lwd, and $lty to specify splined edges joining data items in the corresponding track

formatting

data.frame holding all of the formatting options

mdata

matrix holding interaction data between genomic loci (e.g. hiC)

vars

List of variants associated with track

Author

Marcin Imielinski