Last data update: 2014.03.03

R: DisplayPars class and method
DisplayPars-classR Documentation

DisplayPars class and method

Description

All tracks within this package are highly customizable. The DisplayPars class facilitates this and provides a unified API to the customization parameters.

Usage

DisplayPars(...)

availableDisplayPars(class)

Arguments

...

All named arguments are stored in the object's environment as individual parameters, regardless of their type.

class

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

Details

The individual parameters in a DisplayParameters class are stored as pointers in an environment. This has the upshot of not having to copy the whole track object when changing parameters, and parameters can be updated without the need to explicietly reassign the track to a symbol (i.e., updating of parameters happens in place). The downside is that upon copying of track objects, the parameter emvironment needs to be reinstantiated.

The default display parameters for a track object class can be queried using the availableDisplayPars function.

Value

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

availableDisplayPars returns a list of the default display parameters.

Objects from the Class

Objects can be created using the constructor function DisplayPars.

Slots

pars:

Object of class "environment", the container for all customization parameters.

Methods

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

Exported in the name space:

displayPars

signature(x="DisplayPars", name="character"): return the value of a subset of display parameters, as identified by name.

Usage:

displayPars(x, name)

Examples:

displayPars(obj, c("foo", "bar"))

displayPars(obj, "foobar")

displayPars

signature(x="DisplayPars", name="missing"): return all available display parameters.

Usage:

displayPars(x)

Examples:

displayPars(obj)

getPar

signature(x="DisplayPars", name="character"): alias for the displayPars method.

Usage:

getPar(x, name)

Examples:

getPar(obj, "col")

getPar

signature(x="DisplayPars", name="missing"): alias for the displayPars method.

Usage:

getPar(x)

Examples:

getPar(obj)

displayPars<-

signature(x="DisplayPars", value="list"): replace or add display parameters as provided by the named list items.

Usage:

displayPars<-(x, value)

Examples:

displayPars(obj) <- list(foo="a", bar=2)

setPar

signature(x="DisplayPars", value="character"): set the single display parameter name to value. Note that display parameters in the DisplayPars class are pass-by-reference, so no re-assignmnet to the symbol obj is necessary.

Usage:

setPar(x, name, value)

Additional Arguments:

name: the name of the display parameter to set.

Examples:

setPar(obj, "col", "red")

setPar

signature(x="DisplayPars", value="list"): set display parameters by the values of the named list in value. Note that display parameters in the DisplayPars class are pass-by-reference, so no re-assignmnet to the symbol obj is necessary.

Examples:

setPar(obj, list(col="red", lwd=2))

Internal methods:

initialize

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

show

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

Author(s)

Florian Hahne

Examples


## Construct object
dp <- DisplayPars(col="red", lwd=2, transformation=log2)
dp

## Query parameters
displayPars(dp)
displayPars(dp, "col")
getPar(dp, c("col", "transformation"))

## Modify parameters
displayPars(dp) <- list(lty=1, fontsize=3)
setPar(dp, "pch", 20)
dp

## Default parameters
availableDisplayPars("GenomeAxisTrack")

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/DisplayPars-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DisplayPars-class
> ### Title: DisplayPars class and method
> ### Aliases: DisplayPars-class DisplayPars displayPars displayPars<-
> ###   displayPars,DisplayPars,character-method
> ###   displayPars,DisplayPars,missing-method
> ###   displayPars<-,DisplayPars,list-method getPar
> ###   getPar,DisplayPars,character-method getPar,DisplayPars,missing-method
> ###   initialize,DisplayPars-method setPar
> ###   setPar,DisplayPars,character-method setPar,DisplayPars,list-method
> ###   availableDisplayPars as.list,InferredDisplayPars-method
> ###   as.list,DisplayPars-method show,DisplayPars-method
> ###   coerce,DisplayPars,list-method coerce,InferredDisplayPars,list-method
> ###   head,InferredDisplayPars-method tail,InferredDisplayPars-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> 
> ## Construct object
> dp <- DisplayPars(col="red", lwd=2, transformation=log2)
> dp
Display parameters:
col = red 
lwd = 2 
transformation = function (x)  .Primitive("log2")
> 
> ## Query parameters
> displayPars(dp)
$col
[1] "red"

$lwd
[1] 2

$transformation
function (x)  .Primitive("log2")

> displayPars(dp, "col")
[1] "red"
> getPar(dp, c("col", "transformation"))
$col
[1] "red"

$transformation
function (x)  .Primitive("log2")

> 
> ## Modify parameters
> displayPars(dp) <- list(lty=1, fontsize=3)
> setPar(dp, "pch", 20)
Note that the behaviour of the 'setPar' method has changed. You need to reassign the result to an object for the side effects to happen. Pass-by-reference semantic is no longer supported.
Display parameters:
col = red 
fontsize = 3 
lty = 1 
lwd = 2 
pch = 20 
transformation = function (x)  .Primitive("log2")
> dp
Display parameters:
col = red 
fontsize = 3 
lty = 1 
lwd = 2 
transformation = function (x)  .Primitive("log2")
> 
> ## Default parameters
> availableDisplayPars("GenomeAxisTrack")

The following display parameters are available for 'GenomeAxisTrack' objects:
(see ? GenomeAxisTrack for details on their usage)

add35: FALSE 
add53: FALSE 
alpha (inherited from class 'GdObject'): 1 
alpha.title (inherited from class 'GdObject'): NULL
background.panel (inherited from class 'GdObject'): transparent 
background.title: transparent 
cex: 0.8 
cex.axis (inherited from class 'GdObject'): NULL
cex.id: 0.7 
cex.title (inherited from class 'GdObject'): NULL
col: darkgray 
col.axis (inherited from class 'GdObject'): white 
col.border.title (inherited from class 'GdObject'): white 
col.frame (inherited from class 'GdObject'): lightgray 
col.grid (inherited from class 'GdObject'): #808080 
col.id: white 
col.line (inherited from class 'GdObject'): NULL
col.range: cornsilk4 
col.symbol (inherited from class 'GdObject'): NULL
col.title (inherited from class 'GdObject'): white 
collapse (inherited from class 'GdObject'): TRUE 
distFromAxis: 1 
exponent: NULL
fill (inherited from class 'GdObject'): lightgray 
fill.range: cornsilk3 
fontcolor: #808080 
fontface (inherited from class 'GdObject'): 1 
fontface.title (inherited from class 'GdObject'): 2 
fontfamily (inherited from class 'GdObject'): sans 
fontfamily.title (inherited from class 'GdObject'): sans 
fontsize: 10 
frame (inherited from class 'GdObject'): FALSE 
grid (inherited from class 'GdObject'): FALSE 
h (inherited from class 'GdObject'): -1 
labelPos: alternating 
lineheight (inherited from class 'GdObject'): 1 
littleTicks: FALSE 
lty (inherited from class 'GdObject'): solid 
lty.grid (inherited from class 'GdObject'): solid 
lwd: 2 
lwd.grid (inherited from class 'GdObject'): 1 
lwd.title (inherited from class 'GdObject'): 1 
min.distance (inherited from class 'GdObject'): 1 
min.height (inherited from class 'GdObject'): 3 
min.width (inherited from class 'GdObject'): 1 
reverseStrand (inherited from class 'GdObject'): FALSE 
rotation (inherited from class 'GdObject'): 0 
rotation.title (inherited from class 'GdObject'): 90 
scale: NULL
showAxis (inherited from class 'GdObject'): TRUE 
showId: FALSE 
showTitle: FALSE 
size: NULL
v (inherited from class 'GdObject'): -1 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>