AlignmentsTrack-class | R Documentation |
A class to represent short sequences that have been aligned to a reference genome as they are typically generated in next generation sequencing experiments.
## S4 method for signature 'AlignmentsTrack'
initialize(
.Object,
stackRanges = GRanges(),
stacks = numeric(),
sequences = DNAStringSet(),
referenceSequence = NULL,
...
)
## S4 method for signature 'ReferenceAlignmentsTrack'
initialize(
.Object,
stream,
reference,
mapping = list(),
args = list(),
defaults = list(),
stacks = numeric(),
stackRanges = GRanges(),
sequences = Biostrings::DNAStringSet(),
referenceSequence = NULL,
...
)
AlignmentsTrack(
range = NULL,
start = NULL,
end = NULL,
width = NULL,
strand,
chromosome,
genome,
stacking = "squish",
id,
cigar,
mapq,
flag = scanBamFlag(isUnmappedQuery = FALSE),
isize,
groupid,
status,
md,
seqs,
name = "AlignmentsTrack",
isPaired = TRUE,
importFunction,
referenceSequence,
...
)
## S4 method for signature 'AlignmentsTrack'
values(x)
## S4 replacement method for signature 'AlignmentsTrack'
chromosome(GdObject) <- value
## S4 method for signature 'AlignmentsTrack'
stacks(GdObject)
## S4 method for signature 'AlignmentsTrack'
setStacks(GdObject, ...)
## S4 method for signature 'AlignmentsTrack'
subset(x, from = NULL, to = NULL, stacks = FALSE, use.defaults = TRUE, ...)
## S4 method for signature 'ReferenceAlignmentsTrack'
subset(x, from, to, chromosome, ...)
## S4 method for signature 'AlignmentsTrack'
drawAxis(GdObject, ...)
## S4 method for signature 'AlignmentsTrack'
drawGD(GdObject, minBase, maxBase, prepare = FALSE, subset = TRUE, ...)
## S4 method for signature 'AlignmentsTrack'
show(object)
## S4 method for signature 'ReferenceAlignmentsTrack'
show(object)
.Object |
.Object |
stackRanges |
stackRanges |
stacks |
stacks |
sequences |
sequences |
referenceSequence |
An optional |
... |
Additional items which will all be interpreted as further
display parameters. See |
stream |
stream |
reference |
reference |
mapping |
mapping |
args |
args |
defaults |
defaults |
range |
An optional meta argument to handle the different input types.
If the The different input options for
|
start, end, width |
Integer vectors, giving the start and the end coordinates for the individual track items, or their width. Two of the three need to be specified, and have to be of equal length or of length one, in which case this single value will be recycled. Otherwise, the usual R recycling rules for vectors do not apply here. |
strand |
Character vector, the strand information for the reads. It may
be provided in the form |
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 input, and eventually will fall
back to the default value of |
stacking |
The stacking type for overlapping items of the track. One in
|
id |
Character vector of read identifiers. Those identifiers have to be
unique, i.e., each range representing a read needs to have a unique
|
cigar |
A character vector of valid CIGAR strings describing details of the alignment. Typically those include alignment gaps or insertions and deletions, but also hard and soft clipped read regions. If missing, a fully mapped read without gaps or indels is assumed. Needs to be of equal length as the provided genomic coordinates, or of length 1. |
mapq |
A numeric vector of read mapping qualities. Needs to be of equal length as the provided genomic coordinates, or of length 1. |
flag |
A named integer vector of length 2, as is produced by Rsamtools::scanBamFlag(), used to filter out undesirable reads. If missing, all mapped reads will be included. |
isize |
A numeric vector of empirical insert sizes. This only applies if the reads are paired. Needs to be of equal length as the provided genomic coordinates, or of length 1. Currently not used. |
groupid |
A factor (or vector than can be coerced into one) defining
the read pairs. Reads with the same |
status |
A factor describing the mapping status of a read. Has to be
one in |
md |
A character vector describing the mapping details. This is effectively and alternative to the CIGAR encoding and it removes the dependency on a reference sequence to figure out read mismatches. Needs to be of equal length as the provided genomic coordinates, or of length 1. Currently not used. |
seqs |
|
name |
Character scalar of the track's name used in the title panel when plotting. |
isPaired |
A logical scalar to determine whether the reads are paired
or not. While this may be used to render paired-end data as single-end, the
oppsite will typically not have any effect because the appropriate
|
importFunction |
A user-defined function to be used to import the data
from a file. This only applies when the |
x |
x |
GdObject |
Object of |
value |
value |
from, to |
from,to |
use.defaults |
|
minBase, maxBase |
minBase,maxBase |
prepare |
|
subset |
|
object |
object |
The return value of the constructor function is a new object of class
AlignmentsTrack
or ReferenceAlignmentsTrack
.
initialize(AlignmentsTrack)
: Initialize.
ReferenceAlignmentsTrack-class
: The file-based version of the AlignmentsTrack-class
.
initialize(ReferenceAlignmentsTrack)
: Initialize.
AlignmentsTrack()
: Constructor for AlignmentsTrack-class
.
values(AlignmentsTrack)
: Return all additional annotation
information except for the genomic coordinates for the track items as
a data.frame
.
chromosome(AlignmentsTrack) <- 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.
stacks(AlignmentsTrack)
: return the stack indices for each track item.
setStacks(AlignmentsTrack)
: recompute the stacks based on the available
space and on the object's track items and stacking settings.
subset(AlignmentsTrack)
: Subset a AlignmentsTrack
by coordinates
and sort if necessary.
subset(ReferenceAlignmentsTrack)
: Subset a ReferenceAlignmentsTrack
by coordinates
and sort if necessary.
drawAxis(AlignmentsTrack)
: add a y-axis to the title panel of a track.
drawGD(AlignmentsTrack)
: 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(AlignmentsTrack)
: Show method.
show(ReferenceAlignmentsTrack)
: Show method.
Objects can be created using the constructor function
AlignmentsTrack
.
Florian Hahne
DisplayPars
GdObject
GRanges
HighlightTrack
ImageMap
IRanges
RangeTrack
DataTrack
collapsing
grouping
panel.grid
plotTracks
settings
## Creating objects
afrom <- 2960000
ato <- 3160000
alTrack <- AlignmentsTrack(system.file(
package = "Gviz", "extdata",
"gapped.bam"
), isPaired = TRUE)
plotTracks(alTrack, from = afrom, to = ato, chromosome = "chr12")
## Omit the coverage or the pile-ups part
plotTracks(alTrack,
from = afrom, to = ato, chromosome = "chr12",
type = "coverage"
)
plotTracks(alTrack,
from = afrom, to = ato, chromosome = "chr12",
type = "pileup"
)
## Including sequence information with the constructor
if (require(BSgenome.Hsapiens.UCSC.hg19)) {
strack <- SequenceTrack(Hsapiens, chromosome = "chr21")
afrom <- 44945200
ato <- 44947200
alTrack <- AlignmentsTrack(system.file(
package = "Gviz", "extdata",
"snps.bam"
), isPaired = TRUE, referenceSequence = strack)
plotTracks(alTrack, chromosome = "chr21", from = afrom, to = ato)
## Including sequence information in the track list
alTrack <- AlignmentsTrack(system.file(
package = "Gviz", "extdata",
"snps.bam"
), isPaired = TRUE)
plotTracks(c(alTrack, strack),
chromosome = "chr21", from = 44946590,
to = 44946660
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.