R/sort-methods.R

setMethod("sort", signature(x="AssocTestResultRanges"),
    function(x, decreasing=FALSE,
             sortBy=c("p.value", "p.value.adj", "p.value.resampled",
                      "p.value.resampled.adj", "genome"))
    {
        sortBy <- match.arg(sortBy)

        if (sortBy == "genome")
            rnk <- order(as(x), "GRanges", decreasing=decreasing)
        else
        {
            if (is.null(mcols(x)[[sortBy]]))
                stop("column '", sortBy, "' missing", call.=FALSE)

            rnk <- order(mcols(x)[[sortBy]], decreasing=decreasing)
        }

        x[rnk]
    })

Try the podkat package in your browser

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

podkat documentation built on Nov. 8, 2020, 6:55 p.m.