HitsList
class stores a set of Hits objects.
It's typically used to represent the result of findOverlaps
on two RangesList
objects.x
is a HitsList
object. as.matrix(x)
: calls as.matrix
on each
Hits
, combines them row-wise and offsets the
indices so that they are aligned with the result of calling
unlist
on the query and subject.
as.table(x)
: counts the number of hits for each
query element in x
and outputs the counts as a table
,
which is aligned with the result of calling unlist
on the query.
t(x)
: Interchange the query and subject in each space
of x
, returns a transposed HitsList
.queryHits(x)
: Equivalent to
unname(as.matrix(x)[,1])
.
subjectHits(x)
: Equivalent to
unname(as.matrix(x)[,2])
.
space(x)
: gets the character vector naming the space
in the query RangesList
for each hit, or NULL
if the
query did not have any names.
ranges(x, query, subject)
: returns a RangesList
holding the intersection of the ranges in the
RangesList
objects query
and subject
, which
should be the same subject and query used in the call to
findOverlaps
that generated x
. Eventually, we might
store the query and subject inside x
, in which case the
arguments would be redundant.
HitsList
as for Hits
:
The as.matrix
method coerces a HitsList
in a
similar way to Hits
, except a column is prepended
that indicates which space (or element in the query RangesList
)
to which the row corresponds. The as.table
method flattens or unlists the list, counts the
number of hits for each query range and outputs the counts as a
table
, which has the same shape as from a single Hits
object.
To transpose a HitsList
x
, so that the subject
and query in each space are interchanged, call t(x)
. This
allows, for example, counting the number of hits for each subject
element using as.table
.
When the HitsList object is the result of a call to
findOverlaps
on two RangesList
objects,
the actual regions of intersection between the overlapping
ranges can be obtained with the ranges
accessor.
findOverlaps
, which generates an instance of this class.