split_ranges: Cast a Ranges to a RangesList

Description Usage Arguments Details Value Examples

Description

Cast a Ranges to a RangesList

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
split_ranges(x, ...)

## S4 method for signature 'Ranges'
split_ranges(x, ...)

## S4 method for signature 'GroupedGenomicRanges'
split_ranges(x, ...)

## S4 method for signature 'GroupedIntegerRanges'
split_ranges(x, ...)

Arguments

x

a Ranges object

...

grouping variables to split by (passed to plyranges::group_by())

Details

If x is already grouped, then passing ... are ignored. If x is not grouped and variable names are provided to ... these are forwarded to [plyranges::group_by()], if no variables are provided then x is returned.

Value

a RangesList object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
suppressPackageStartupMessages(library("GenomicRanges"))
suppressPackageStartupMessages(library("plyranges"))
lvls <- paste0("chr",c(1:23))
gr <- GRanges(
  seqnames = factor(sample(lvls, 1000, replace = TRUE), levels = lvls),
  ranges = IRanges(start = rpois(1000, 10000), width = rpois(1000, 100)),
  grp = sample(letters[1:4], 1000, replace = TRUE),
  gc = runif(1000)
)
split_ranges(gr, seqnames)

gr_by_grp <- group_by(gr, grp)
split_ranges(gr_by_grp)   

sa-lee/superintronic documentation built on Feb. 18, 2020, 10:36 a.m.