x
is a Hits
object. as(from, "DataFrame")
: Creates a DataFrame
by
combining the result of as.matrix(from)
with mcols(from)
.
as.data.frame(x)
: Attempts to coerce the result of
as(from, "DataFrame")
to a data.frame
.
as(x, "List")
: Like as.list
, above.
as.data.frame
method coerces a Hits
object to a two column
data.frame
with one row for each hit, where the value in the first
column is the index of an element in the query and the value in the second
column is the index of an element in the subject.
query <- IRanges(c(1, 4, 9), c(5, 7, 10))
subject <- IRanges(c(2, 2, 10), c(2, 3, 12))
hits <- findOverlaps(query, subject)
as.matrix(hits)
as.data.frame(hits)
as.table(hits) # hits per query
as.table(t(hits)) # hits per subject
## Turn a Hits object into an IntegerList object with one list element
## per element in the original query.
as(hits, "IntegerList")
as(hits, "List") # same as as(hits, "IntegerList")
## Turn a Hits object into a PartitioningByEnd object that describes
## the grouping of hits by query.
as(hits, "PartitioningByEnd")
as(hits, "Partitioning") # same as as(hits, "PartitioningByEnd")
## ---------------------------------------------------------------------
## remapHits()
## ---------------------------------------------------------------------
hits2 <- remapHits(hits,
Rnodes.remapping=factor(c("e", "e", "d"), letters[1:5]))
hits2
hits3 <- remapHits(hits,
Rnodes.remapping=c(5, 5, 4), new.nRnode=5)
hits3
stopifnot(identical(hits2, hits3))
Run the code above in your browser using DataLab