encodeOverlaps
function.
## OverlapEncodings accessors:
"length"(x)
"Loffset"(x)
"Roffset"(x)
"encoding"(x)
"levels"(x)
"flippedQuery"(x)
"Lencoding"(x)
"Rencoding"(x)
"njunc"(x)
"Lnjunc"(x)
"Rnjunc"(x)
## Coercing an OverlapEncodings object:
"as.data.frame"(x, row.names=NULL, optional=FALSE, ...)
## Low-level related utilities:
"Lencoding"(x)
"Rencoding"(x)
"njunc"(x)
"Lnjunc"(x)
"Rnjunc"(x)
"Lencoding"(x)
"Rencoding"(x)
"njunc"(x)
"Lnjunc"(x)
"Rnjunc"(x)
x
can also
be a character vector or factor containing encodings.
NULL
or a character vector.
x
is an OverlapEncodings object
typically obtained by a call to encodeOverlaps(query, subject)
. length(x)
:
Get the number of elements (i.e. encodings) in x
.
This is equal to length(query)
and length(subject)
.
Loffset(x)
, Roffset(x)
:
Get the "left offsets" and "right offsets" of the encodings,
respectively. Both are integer vectors of the same length as x
. Let's denote Qi = query[[i]]
, Si = subject[[i]]
,
and [q1,q2] the range covered by Qi
i.e.
q1 = min(start(Qi))
and q2 = max(end(Qi))
,
then Loffset(x)[i]
is the number L
of ranges at the
head of Si
that are strictly to the left of all
the ranges in Qi
i.e. L
is the greatest value such that
end(Si)[k] < q1 - 1
for all k
in seq_len(L)
.
Similarly, Roffset(x)[i]
is the number R
of ranges at the
tail of Si
that are strictly to the right of all
the ranges in Qi
i.e. R
is the greatest value such that
start(Si)[length(Si) + 1 - k] > q2 + 1
for all k
in seq_len(L)
.
encoding(x)
:
Factor of the same length as x
where the i-th element is
the encoding obtained by comparing each range in Qi
with
all the ranges in tSi = Si[(1+L):(length(Si)-R)]
(tSi
stands for "trimmed Si").
More precisely, here is how this encoding is obtained:
Qi
are compared with tSi[1]
,
then with tSi[2]
, etc...
At each step (one step per range in tSi
), comparing
all the ranges in Qi
with tSi[k]
is done with
rangeComparisonCodeToLetter(compare(Qi, tSi[k]))
.
So at each step, we end up with a vector of M
single letters (where M
is length(Qi)
).
tSi
, all of them of length M
) is turned
into a single string (called "encoding block") by pasting
its individual letters together.
tSi
) are pasted
together into a single long string and separated by colons
(":"
). An additional colon is prepended to the long
string and another one appended to it.
M
is
prepended to the long string. The final string is the encoding.
levels(x)
: Equivalent to levels(encoding(x))
.
flippedQuery(x)
:
Whether or not the top-level element in query used for computing the
encoding was "flipped" before the encoding was computed.
Note that this flipping generally affects the "left offset",
"right offset", in addition to the encoding itself.
Lencoding(x)
, Rencoding(x)
:
Extract the "left encodings" and "right encodings" of paired-end
encodings. Paired-end encodings are obtained by encoding paired-end overlaps
i.e. overlaps between paired-end reads and transcripts (typically).
The difference between a single-end encoding and a paired-end encoding
is that all the blocks in the latter contain a "--"
separator
to mark the separation between the "left encoding" and the "right
encoding". See the "Overlap encodings" vignette located in this package
for examples of paired-end encodings.
njunc(x)
, Lnjunc(x)
, Rnjunc(x)
:
Extract the number of junctions in each encoding by looking at their
first block (aka special block).
If an element xi
in x
is a paired-end encoding,
then Lnjunc(xi)
, Rnjunc(xi)
, and njunc(xi)
,
return njunc(Lencoding(xi))
, njunc(Rencoding(xi))
,
and Lnjunc(xi) + Rnjunc(xi)
, respectively.
x
is an OverlapEncodings object. as.data.frame(x)
:
Return x
as a data frame with columns "Loffset"
,
"Roffset"
and "encoding"
.
query
and a subject
of the same length, both
list-like objects with top-level elements typically containing multiple
ranges (e.g. RangesList objects), the "overlap encoding" of the
i-th element in query
and i-th element in subject
is a
character string describing how the ranges in query[[i]]
are
qualitatively positioned relatively to the ranges in
subject[[i]]
. The encodeOverlaps
function computes those overlap
encodings and returns them in an OverlapEncodings object of the same
length as query
and subject
.
The topic of working with overlap encodings is covered in details
in the "OverlapEncodings" vignette located this package
(GenomicAlignments) and accessible with
vignette("OverlapEncodings")
.
encodeOverlaps
function for computing "overlap
encodings".
compare
function in the IRanges
package for the interpretation of the strings returned by
encoding
.
example(encodeOverlaps) # to generate the 'ovenc' object
length(ovenc)
Loffset(ovenc)
Roffset(ovenc)
encoding(ovenc)
levels(ovenc)
nlevels(ovenc)
flippedQuery(ovenc)
njunc(ovenc)
as.data.frame(ovenc)
njunc(levels(ovenc))
Run the code above in your browser using DataLab