From 6e185d8c5e8ba45ceddfebb873118800fa32cfaa Mon Sep 17 00:00:00 2001 From: James Eapen Date: Sat, 30 Nov 2024 11:36:16 -0500 Subject: [PATCH] fix(utils): preserve region names when converting from GRanges --- R/utils.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index ed359c5..cc186f3 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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") }