SequenceTrack-class | R Documentation |
A track class to represent genomic sequences. The three child classes
SequenceDNAStringSetTrack
, SequenceRNAStringSetTrack
and
SequenceBSgenomeTrack
do most of the work, however in practise they
are of no particular relevance to the user.
## S4 method for signature 'SequenceTrack'
initialize(.Object, chromosome, genome, ...)
SequenceTrack(
sequence,
chromosome,
genome,
name = "SequenceTrack",
importFunction,
stream = FALSE,
...
)
RNASequenceTrack(
sequence,
chromosome,
genome,
name = "SequenceTrack",
importFunction,
stream = FALSE,
...
)
## S4 method for signature 'SequenceDNAStringSetTrack'
initialize(.Object, sequence, ...)
## S4 method for signature 'SequenceRNAStringSetTrack'
initialize(.Object, sequence, ...)
## S4 method for signature 'SequenceBSgenomeTrack'
initialize(.Object, sequence = NULL, ...)
## S4 method for signature 'ReferenceSequenceTrack'
initialize(.Object, stream, reference, ...)
## S4 method for signature 'SequenceTrack'
seqnames(x)
## S4 method for signature 'SequenceBSgenomeTrack'
seqnames(x)
## S4 method for signature 'SequenceTrack'
seqlevels(x)
## S4 method for signature 'SequenceBSgenomeTrack'
seqlevels(x)
## S4 method for signature 'SequenceTrack'
start(x)
## S4 method for signature 'SequenceTrack'
end(x)
## S4 method for signature 'SequenceTrack'
width(x)
## S4 method for signature 'SequenceTrack'
length(x)
## S4 method for signature 'SequenceTrack'
chromosome(GdObject)
## S4 replacement method for signature 'SequenceTrack'
chromosome(GdObject) <- value
## S4 method for signature 'SequenceTrack'
genome(x)
## S4 method for signature 'SequenceTrack'
consolidateTrack(GdObject, chromosome, ...)
## S4 method for signature 'SequenceTrack'
drawGD(GdObject, minBase, maxBase, prepare = FALSE, ...)
## S4 method for signature 'SequenceBSgenomeTrack'
show(object)
## S4 method for signature 'SequenceDNAStringSetTrack'
show(object)
## S4 method for signature 'SequenceRNAStringSetTrack'
show(object)
## S4 method for signature 'ReferenceSequenceTrack'
show(object)
.Object |
.Object |
chromosome |
the currently active chromosome which may have to be set
for a |
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. For a |
... |
Additional items which will all be interpreted as further
display parameters. See |
sequence |
A meta argument to handle the different input types, making the construction
of a The different input options for
|
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
sequence data from a file. This only applies when the Both file types support indexing by genomic coordinates, and it makes sense
to only load the part of the file that is needed for plotting. To this end,
the |
stream |
A logical flag indicating that the user-provided import
function can deal with indexed files and knows how to process the additional
|
reference |
Name of the file (for streatming). |
x |
A valid track object class name, or the object itself, in which case the class is derived directly from it. |
GdObject |
the input track object |
value |
Value to be set. |
minBase |
Start of the sequence. |
maxBase |
End of the sequence. |
prepare |
|
object |
object |
The return value of the constructor function is a new object of class
SequenceDNAStringSetTrack
, SequenceBSgenomeTrack
ore
ReferenceSequenceTrack
, depending on the constructor arguments.
Typically the user will not have to be troubled with this distinction and
can rely on the constructor to make the right choice.
initialize(SequenceTrack)
: Initialize.
SequenceTrack()
: Constructor
RNASequenceTrack()
: Constructor
SequenceDNAStringSetTrack-class
: The DNAStringSet
-based version of the SequenceTrack-class
.
initialize(SequenceDNAStringSetTrack)
: Initialize.
SequenceRNAStringSetTrack-class
: The RNAStringSet
-based version of the SequenceTrack-class
.
initialize(SequenceRNAStringSetTrack)
: Initialize RNAStringSet
-based version of the SequenceTrack-class
.
SequenceBSgenomeTrack-class
: The BSgenome
-based version of the SequenceTrack-class
.
initialize(SequenceBSgenomeTrack)
: Initialize.
ReferenceSequenceTrack-class
: The file-based version of the SequenceTrack-class
.
initialize(ReferenceSequenceTrack)
: Initialize.
seqnames(SequenceTrack)
: return the names (i.e., the chromosome)
of the sequences contained in the object.
seqnames(SequenceBSgenomeTrack)
: return the names (i.e., the chromosome)
of the sequences contained in the object.
seqlevels(SequenceTrack)
: return the names (i.e., the chromosome)
of the sequences contained in the object. Only those with length > 0.
seqlevels(SequenceBSgenomeTrack)
: return the names (i.e., the chromosome)
of the sequences contained in the object. Only those with length > 0.
start(SequenceTrack)
: return the start coordinates of the track
items.
end(SequenceTrack)
: return the end coordinates of the track
items.
width(SequenceTrack)
: return the with of the track items in
genomic coordinates.
length(SequenceTrack)
: return the length of the sequence for
active chromosome.
chromosome(SequenceTrack)
: return the chromosome for which the track
is defined.
chromosome(SequenceTrack) <- value
: replace the value of the track's chromosome.
This has to be a valid UCSC chromosome identifier or an integer or character
scalar that can be reasonably coerced into one.
genome(SequenceTrack)
: Set the track's genome.
Usually this has to be a valid UCSC identifier, however this is not
formally enforced here.
consolidateTrack(SequenceTrack)
: Consolidate/
Determine whether there is chromosome
settings or not, and add this information.
drawGD(SequenceTrack)
: 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(SequenceBSgenomeTrack)
: Show method.
show(SequenceDNAStringSetTrack)
: Show method.
show(SequenceRNAStringSetTrack)
: Show method.
show(ReferenceSequenceTrack)
: Show method.
Objects can be created using the constructor function SequenceTrack
.
Florian Hahne
DisplayPars
GdObject
GRanges
HighlightTrack
ImageMap
IRanges
RangeTrack
DataTrack
collapsing
grouping
panel.grid
plotTracks
settings
## An empty object
SequenceTrack()
## Construct from DNAStringSet
library(Biostrings)
letters <- c("A", "C", "T", "G", "N")
set.seed(999)
seqs <- DNAStringSet(c(chr1 = paste(sample(letters, 100000, TRUE),
collapse = ""
), chr2 = paste(sample(letters, 200000, TRUE), collapse = "")))
sTrack <- SequenceTrack(seqs, genome = "hg19")
sTrack
## Construct from BSGenome object
if (require(BSgenome.Hsapiens.UCSC.hg19)) {
sTrack <- SequenceTrack(Hsapiens)
sTrack
}
## Set active chromosome
chromosome(sTrack)
chromosome(sTrack) <- "chr2"
head(seqnames(sTrack))
## Plotting
## Sequences
plotTracks(sTrack, from = 199970, to = 200000)
## Boxes
plotTracks(sTrack, from = 199800, to = 200000)
## Line
plotTracks(sTrack, from = 1, to = 200000)
## Force boxes
plotTracks(sTrack, from = 199970, to = 200000, noLetters = TRUE)
## Direction indicator
plotTracks(sTrack, from = 199970, to = 200000, add53 = TRUE)
## Sequence complement
plotTracks(sTrack, from = 199970, to = 200000, add53 = TRUE, complement = TRUE)
## Colors
plotTracks(sTrack, from = 199970, to = 200000, add53 = TRUE, fontcolor = c(
A = 1,
C = 1, G = 1, T = 1, N = 1
))
## Track names
names(sTrack)
names(sTrack) <- "foo"
## Accessors
genome(sTrack)
genome(sTrack) <- "mm9"
length(sTrack)
## Sequence extraction
subseq(sTrack, start = 100000, width = 20)
## beyond the stored sequence range
subseq(sTrack, start = length(sTrack), width = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.