bed_shift: Adjust intervals by a fixed size.

Description Usage Arguments Value See Also Examples

View source: R/bed_shift.r

Description

Out-of-bounds intervals are removed by default.

Usage

1
bed_shift(x, genome, size = 0, fraction = 0, trim = FALSE)

Arguments

x

tbl_interval()

genome

tbl_genome()

size

number of bases to shift. postive numbers shift right, negative shift left.

fraction

define size as a fraction of interval

trim

adjust coordinates for out-of-bounds intervals

Value

tbl_interval()

See Also

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

Other single set operations: bed_cluster, bed_complement, bed_flank, bed_merge, bed_partition, 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
x <- trbl_interval(
  ~chrom, ~start, ~end,
 'chr1',  25,     50,
 'chr1',  100,    125
)

genome <- trbl_genome(
  ~chrom, ~size,
  'chr1', 125
)

bed_glyph(bed_shift(x, genome, size = -20))

x <- trbl_interval(
   ~chrom, ~start, ~end, ~strand,
   "chr1", 100,    150,  "+",
   "chr1", 200,    250,  "+",
   "chr2", 300,    350,  "+",
   "chr2", 400,    450,  "-",
   "chr3", 500,    550,  "-",
   "chr3", 600,    650,  "-"
)

genome <- trbl_genome(
   ~chrom, ~size,
   "chr1", 1000,
   "chr2", 2000,
   "chr3", 3000
)

bed_shift(x, genome, 100)

bed_shift(x, genome, fraction = 0.5)

# shift with respect to strand
stranded <- dplyr::group_by(x, strand)
bed_shift(stranded, genome, 100)

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