R/Hits-setops.R

### =========================================================================
### Set operations
### -------------------------------------------------------------------------
###
### The methods below are endomorphisms with respect to their first argument
### 'x'. They propagate the names and metadata columns.
###

### The default method for Vector objects works fine except when 'x' is a
### SortedByQueryHits object, in which case the result of the union needs
### to be sorted again.
setMethod("union", c("SortedByQueryHits", "Hits"),
    function(x, y)
    {
        ans_class <- class(x)
        x <- as(x, "Hits")
        as(callNextMethod(), ans_class)  # sort, and restore original class
    }
)

Try the S4Vectors package in your browser

Any scripts or data that you put into this service are public.

S4Vectors documentation built on Dec. 11, 2020, 2:02 a.m.