Skip to content

Commit

Permalink
fix(utils): preserve region names when converting from GRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespeapen committed Nov 30, 2024
1 parent e56427b commit 6e185d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ verify_aligner_or_stop <- function(aligner) {
#' @export
get_granges_string <- function(gr, sep = c(":", "-")) {
if (requireNamespace("GenomicRanges", quietly = TRUE)) {
paste0(
region_str <- paste0(
as.character(x = GenomicRanges::seqnames(x = gr)),
sep[[1]],
GenomicRanges::start(x = gr),
sep[[2]],
GenomicRanges::end(x = gr)
)
names(region_str) <- names(gr)
return(region_str)
} else {
stop("The 'GenomicRanges' package must be installed for this functionality")
}
Expand Down

0 comments on commit 6e185d8

Please sign in to comment.