Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mention of UCSC, as this has changed/not always applicable #98

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Suggests:
ggplot2
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0
RoxygenNote: 7.2.3
Collate:
'class-AnchoredRanges.R'
'class-Operator.R'
Expand Down
7 changes: 2 additions & 5 deletions R/ranges-genomeinfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ genome_info <- function(genome = NULL, seqnames = NULL, seqlengths = NULL, is_ci
#'
#' @param .data A Ranges object to annotate or retrieve an annotation for.
#' @param genome A character vector of length one indicating the genome build.
#' If this is the only argument supplied, the build information will be
#' retrieved from UCSC database.
#' @param seqnames A character vector containing the name of sequences.
#' @param seqlengths An optional integer vector containg the lengths of sequences.
#' @param is_circular An optional logical vector indicating whether a sequence is ciruclar.
Expand All @@ -28,13 +26,12 @@ genome_info <- function(genome = NULL, seqnames = NULL, seqlengths = NULL, is_ci
#' as a Ranges object use `get_genome_info`.
#'
#' @description To construct annotations by supplying annotation information
#' use `genome_info`. This function allows you to get UCSC build information
#' via [GenomeInfoDb::fetchExtendedChromInfoFromUCSC()]. To add
#' use `genome_info`. To add
#' annotations to an existing Ranges object use `set_genome_info`. To retrieve
#' an annotation as a Ranges object use `get_genome_info`.
#'
#' @importFrom GenomeInfoDb Seqinfo seqnames seqlengths isCircular genome seqinfo
#' @seealso [GenomeInfoDb::Seqinfo()], [GenomeInfoDb::fetchExtendedChromInfoFromUCSC()]
#' @seealso [GenomeInfoDb::Seqinfo()]
#' @examples
#' x <- genome_info(genome = "toy",
#' seqnames = letters[1:4],
Expand Down
41 changes: 24 additions & 17 deletions R/ranges-reduce.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ reduce_single <- function(.data, ..., rfun = reduce) {
if (length(dots) == 0L) {
return(rfun(.data))
}

reduced <- rfun(.data, with.revmap = TRUE)

.data <- group_by_revmap(.data,
.data <- group_by_revmap(.data,
mcols(reduced)[["revmap"]],
make_revmap_rle(mcols(reduced)[["revmap"]]))

Expand Down Expand Up @@ -78,6 +79,7 @@ reduce_by_grp <- function(.data, ..., rfun = IRanges::reduce) {
#' Reduce then aggregate a Ranges object
#'
#' @param .data a Ranges object to reduce
#' @param min.gapwidth Ranges separated by a gap of at least min.gapwidth positions are not merged.
#' @param ... Name-value pairs of summary functions.
#'
#' @return a Ranges object with the
Expand Down Expand Up @@ -106,60 +108,65 @@ reduce_by_grp <- function(.data, ..., rfun = IRanges::reduce) {
#' x %>% reduce_ranges(score = sum(score))
#' x %>% group_by(id) %>% reduce_ranges(score = sum(score))
#' @export
reduce_ranges <- function(.data, ...) { UseMethod("reduce_ranges") }
reduce_ranges <- function(.data, min.gapwidth = 1L, ...) { UseMethod("reduce_ranges") }

#' @method reduce_ranges IntegerRanges
#' @export
reduce_ranges.IntegerRanges <- function(.data, ...) {
reduce_single(.data, ...)
reduce_ranges.IntegerRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_single(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., min.gapwidth = min.gapwidth)
})
}

#' @method reduce_ranges GroupedIntegerRanges
#' @export
reduce_ranges.GroupedIntegerRanges <- function(.data, ...) {
reduce_by_grp(.data, ...)
reduce_ranges.GroupedIntegerRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_by_grp(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., min.gapwidth = min.gapwidth)
})
}


#' @method reduce_ranges GroupedGenomicRanges
#' @export
reduce_ranges.GroupedGenomicRanges <- function(.data, ...) {
reduce_ranges.GroupedGenomicRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_by_grp(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., ignore.strand = TRUE)
reduce(x, ..., min.gapwidth = min.gapwidth, ignore.strand = TRUE)
})
}

#' @method reduce_ranges GenomicRanges
#' @export
reduce_ranges.GenomicRanges <- function(.data, ...) {
reduce_ranges.GenomicRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_single(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., ignore.strand = TRUE)
reduce(x, ..., min.gapwidth = min.gapwidth, ignore.strand = TRUE)
})
}

#' @rdname ranges-reduce
#' @export
reduce_ranges_directed <- function(.data, ...) {
reduce_ranges_directed <- function(.data, min.gapwidth = 1L, ...) {
UseMethod("reduce_ranges_directed")
}

#' @importFrom IRanges reduce
#' @method reduce_ranges_directed GenomicRanges
#' @export
reduce_ranges_directed.GenomicRanges <- function(.data, ...) {
reduce_ranges_directed.GenomicRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_single(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., ignore.strand = FALSE)
reduce(x, ..., min.gapwidth = min.gapwidth, ignore.strand = FALSE)
})
}

#' @method reduce_ranges_directed GroupedGenomicRanges
#' @export
reduce_ranges_directed.GroupedGenomicRanges <- function(.data, ...) {
reduce_ranges_directed.GroupedGenomicRanges <- function(.data, min.gapwidth = 1L, ...) {
reduce_by_grp(.data, ...,
rfun = function(x, ...) {
reduce(x, ..., ignore.strand = FALSE)
reduce(x, ..., min.gapwidth = min.gapwidth, ignore.strand = FALSE)
})
}
}
2 changes: 1 addition & 1 deletion man/overscope_ranges.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plyranges-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions man/ranges-info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/ranges-reduce.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/tidyverse-reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading