R/DisplayPars-class.R
DisplayPars-class.Rd
All tracks within this package are highly customizable. The
DisplayPars
class facilitates this and provides a unified API to the
customization parameters.
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 explicitly 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 environment needs to be re-instantiated.
Objects can be created using the constructor function DisplayPars
.
The default display parameters for a track object class can be queried using
the availableDisplayPars
function.
DisplayPars(...)
getPar(x, name, ...)
# S4 method for DisplayPars,character
getPar(x, name, asIs = FALSE)
# S4 method for DisplayPars,missing
getPar(x, hideInternal = TRUE)
displayPars(x, name, ...)
# S4 method for DisplayPars,missing
displayPars(x, hideInternal = TRUE)
# S4 method for DisplayPars,character
displayPars(x, name)
# S4 method for DisplayPars
as.list(x)
setPar(x, value, ...)
# S4 method for DisplayPars,list
setPar(x, value, interactive = TRUE)
# S4 method for DisplayPars,character
setPar(x, name, value, interactive = TRUE)
displayPars(x, recursive = FALSE) <- value
# S4 method for DisplayPars,list
displayPars(x, recursive = FALSE) <- value
# S4 method for DisplayPars
show(object)
# S4 method for InferredDisplayPars
as.list(x)
# S4 method for InferredDisplayPars
show(object)
availableDisplayPars(class)
All named arguments are stored in the object's environment as individual parameters, regardless of their type.
object to set the displayPar value on
Name of the retrieved parameter.
logical
logical
named value to be set
logical
logical
object
Either character scalar or object. Supported classes are:
GdObject
, GenomeAxisTrack
, RangeTrack
, NumericTrack
, DataTrack
,
IdeogramTrack
, StackedTrack
, AnnotationTrack
, DetailsAnnotationTrack
,
GeneRegionTrack
, BiomartGeneRegionTrack
, AlignmentsTrack
,
SequenceTrack
, SequenceBSgenomeTrack
, SequenceDNAStringSetTrack
,
SequenceRNAStringSetTrack
The return value of the constructor function is a new object of class
DisplayPars
.
availableDisplayPars
returns a list of the default display
parameters.
DisplayPars()
: Constructor function.
getPar()
: Generics for getPar
.
getPar(x = DisplayPars, name = character)
: Alias for the displayPars
method.
getPar(x = DisplayPars, name = missing)
: Alias for the displayPars
method.
displayPars()
: Generics for displayPars
.
displayPars(x = DisplayPars, name = missing)
: Returns all available display parameters.
displayPars(x = DisplayPars, name = character)
: Returns the value of a subset of display parameters, as identified by name
.
as.list(DisplayPars)
: Converts DisplayPars
to list
.
setPar()
: Generics for SetPar
.
SetPar generic function
setPar(x = DisplayPars, value = list)
: Sets 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-assignment to the symbol obj
is necessary.
setPar(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-assignment to the symbol obj
is necessary.
displayPars(x, recursive = FALSE) <- value
: Generics for displayPars<-
.
displayPars(x = DisplayPars) <- value
: Replaces or adds display parameters as provided by the named list
items.
show(DisplayPars)
: Show method.
as.list(InferredDisplayPars)
: Return InferredDisplayPars
as a list
.
show(InferredDisplayPars)
: Show method.
availableDisplayPars()
: Get default display parameters.
pars
an environment or a list containing parameter key value pairs.
## 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.legend (inherited from class 'GdObject'): transparent
#> 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: transparent
#> 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
#> fontcolour (inherited from class 'GdObject'): black
#> 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.border.title: 1
#> 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
#> ticksAt: NULL
#> v (inherited from class 'GdObject'): -1