GeneRegionTrack-class | R Documentation |
A class to hold gene model data for a genomic region.
## S4 method for signature 'GeneRegionTrack'
initialize(.Object, start, end, ...)
## S4 method for signature 'ReferenceGeneRegionTrack'
initialize(
.Object,
stream,
reference,
mapping = list(),
args = list(),
defaults = list(),
...
)
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,
...
)
## S4 method for signature 'GeneRegionTrack'
gene(GdObject)
## S4 replacement method for signature 'GeneRegionTrack,character'
gene(GdObject) <- value
## S4 method for signature 'GeneRegionTrack'
symbol(GdObject)
## S4 replacement method for signature 'GeneRegionTrack,character'
symbol(GdObject) <- value
## S4 method for signature 'GeneRegionTrack'
transcript(GdObject)
## S4 replacement method for signature 'GeneRegionTrack,character'
transcript(GdObject) <- value
## S4 method for signature 'GeneRegionTrack'
exon(GdObject)
## S4 replacement method for signature 'GeneRegionTrack,character'
exon(GdObject) <- value
## S4 method for signature 'GeneRegionTrack'
group(GdObject)
## S4 replacement method for signature 'GeneRegionTrack,character'
group(GdObject) <- value
## S4 method for signature 'GeneRegionTrack'
identifier(
GdObject,
type = .dpOrDefault(GdObject, "transcriptAnnotation", "symbol")
)
## S4 replacement method for signature 'GeneRegionTrack,character'
identifier(GdObject) <- value
## S4 method for signature 'ReferenceGeneRegionTrack'
subset(x, ...)
## S4 method for signature 'GeneRegionTrack'
drawGD(GdObject, ...)
## S4 method for signature 'GeneRegionTrack'
show(object)
## S4 method for signature 'ReferenceGeneRegionTrack'
show(object)
.Object |
.Object |
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
|
... |
Additional items which will all be interpreted as further
display parameters. See |
stream |
A logical flag indicating that the user-provided import
function can deal with indexed files and knows how to process the additional
|
reference |
reference file |
mapping |
mapping |
args |
args |
defaults |
|
range |
An optional meta argument to handle the different input types. If the
The different input options for
|
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 |
rends |
An integer vector of the end coordinates for the actual gene
model items. Both |
rwidths |
An integer vector of widths for the actual gene model items.
This can be used instead of either |
strand |
Character vector, the strand information for the individual
track exons. It may be provided in the form |
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
|
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
|
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 |
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 |
chromosome |
The chromosome on which the track's genomic ranges are
defined. A valid UCSC chromosome identifier if
|
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 |
stacking |
The stacking type for overlapping items of the track. One in
|
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 |
GdObject |
Object of |
value |
Value to be set. |
type |
type |
x |
A valid track object class name, or the object itself, in which case the class is derived directly from it. |
object |
object |
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
:
identifiers are stored in the exon column of the
GRanges
object in the range
slot. Data may be
extracted using the exon
method.
identifiers are stored in the transcript column of
the GRanges
object. Data may be extracted using the
transcript
method.
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.
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.
The return value of the constructor function is a new object of class
GeneRegionTrack
.
initialize(GeneRegionTrack)
: Initialize.
ReferenceGeneRegionTrack-class
: The file-based version of the GeneRegionTrack-class
.
initialize(ReferenceGeneRegionTrack)
: Initialize.
GeneRegionTrack()
: Constructor function for GeneRegionTrack-class
.
gene(GeneRegionTrack)
: Extract the gene identifiers for all
gene models.
gene(GdObject = GeneRegionTrack) <- value
: 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.
symbol(GeneRegionTrack)
: Extract the human-readble gene symbol
for all gene models.
symbol(GdObject = GeneRegionTrack) <- value
: 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.
transcript(GeneRegionTrack)
: Extract the transcript identifiers for all
transcripts in the gene models.
transcript(GdObject = GeneRegionTrack) <- value
: 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.
exon(GeneRegionTrack)
: Extract the exon identifiers for all exons
in the gene models.
exon(GdObject = GeneRegionTrack) <- value
: 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.
group(GeneRegionTrack)
: extract the group membership for all track items.
group(GdObject = GeneRegionTrack) <- value
: 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.
identifier(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.
export
identifier(GdObject = GeneRegionTrack) <- value
: 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<-
.
subset(ReferenceGeneRegionTrack)
: Subset a GeneRegionTrack by coordinates
and sort if necessary.
drawGD(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.
show(GeneRegionTrack)
: Show method.
show(ReferenceGeneRegionTrack)
: Show method.
Objects can be created using the constructor function
GeneRegionTrack
.
Florian Hahne, Steve Lianoglou
DisplayPars
GdObject
GRanges
HighlightTrack
ImageMap
IRanges
RangeTrack
DataTrack
collapsing
grouping
panel.grid
plotTracks
settings
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.