bed_cluster: Cluster neighboring intervals.

Description Usage Arguments Details Value See Also Examples

View source: R/bed_cluster.r

Description

The ouput .id column can be used in downstream grouping operations. Default max_dist = 0 means that both overlapping and book-ended intervals will be clustered.

Usage

1
bed_cluster(x, max_dist = 0)

Arguments

x

tbl_interval()

max_dist

maximum distance between clustered intervals.

Details

input tbls are grouped by chrom by default, and additional groups can be added using dplyr::group_by(). For example, grouping by strand will constrain analyses to the same strand. To compare opposing strands across two tbls, strands on the y tbl can first be inverted using flip_strands().

Value

tbl_interval() with .id column specifying sets of clustered intervals.

See Also

http://bedtools.readthedocs.org/en/latest/content/tools/cluster.html

Other single set operations: bed_complement, bed_flank, bed_merge, bed_partition, bed_shift, bed_slop

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
x <- trbl_interval(
  ~chrom, ~start, ~end,
  'chr1', 100,    200,
  'chr1', 180,    250,
  'chr1', 250,    500,
  'chr1', 501,    1000,
  'chr2', 1,      100,
  'chr2', 150,    200
)

bed_cluster(x)

# glyph illustrating clustering of overlapping and book-ended intervals
x <- trbl_interval(
  ~chrom, ~start, ~end,
  'chr1', 1,      10,
  'chr1', 5,      20,
  'chr1', 30,     40,
  'chr1', 40,     50,
  'chr1', 80,     90
)

bed_glyph(bed_cluster(x), label = '.id')

rnabioco/valr documentation built on Jan. 6, 2019, 9:06 a.m.