stretch {plyranges}R Documentation

Stretch a genomic interval

Description

Without anchoring, this function will extend the interval in either direction by the integer vector in extend.

Usage

stretch(x, extend)

Arguments

x

a Ranges object, to fix by either the start, end or center of an interval use anchor_start(x), anchor_end(x), anchor_center(x). To fix by strand use anchor_3p(x) or anchor_5p(x).

extend

the amount to alter the width of a Ranges object by. Either an integer vector of length 1 or an integer vector the same length as x.

Value

a Ranges object with modified start or end (or both) coordinates

Examples

rng <- as_iranges(data.frame(start=c(2:-1, 13:15), width=c(0:3, 2:0)))
rng2 <- stretch(anchor_center(rng), 10)
stretch(anchor_start(rng2), 10)
stretch(anchor_end(rng2), 10)
grng <- as_granges(data.frame(seqnames = "chr1",
                         strand = c("+", "-", "-", "+", "+", "-", "+"),
                         start=c(2:-1, 13:15),
                         width=c(0:3, 2:0)))
stretch(anchor_3p(grng), 10)
stretch(anchor_5p(grng), 10)

[Package plyranges version 1.0.3 Index]