Skip to contents

Splits a GRanges object into a GRangesList by a column (typically gene_id). This function is deprecated and generally has no good use case. Originally written to split up a GRanges object into a list to iterate over using furrr::future_map(), but deprecated in favor of using built-in parallelization in motifbreakR.

Usage

split_gr_by_id(gr, key_col = "gene_id")

Arguments

gr

A GRanges object returned by get_upstream_snps.

key_col

The name of the column in gr to split by (default gene_id).

Value

A list of genomic ranges split by split_col.

Examples

if (FALSE) {
gr <- data.frame(seqnames=rep(c("chr1", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)),
           start=1:10,
           width=1,
           gene_id = rep(c("gene1", "gene2", "gene3", "gene4"), c(4, 2, 1, 3))) |>
  plyranges::as_granges()
gr
split_gr_by_id(gr, key_col="gene_id")
}