Skip to contents

Coerces GenomicRanges to chr:start-end strings with as.character. If any regions have the same start and end, as.character returns chr:start strings which are invalid for the htslib API. These are corrected to chr:start-start.

Usage

get_granges_string(gr, feature_col = NULL)

Arguments

gr

A GRanges object

feature_col

The mcols column to use as the names of the output string vector

Value

A character vector

Examples

if (requireNamespace("GenomicRanges", quietly = TRUE)) {
  get_granges_string(GenomicRanges::GRanges(c("chr1:1-10", "chr2:15-20")))
}
#> [1] "chr1:1-10"  "chr2:15-20"