ranges-shift: Shift all coordinates in a genomic interval left or right,...

shift_leftR Documentation

Shift all coordinates in a genomic interval left or right, upstream or downstream

Description

Shift all coordinates in a genomic interval left or right, upstream or downstream

Usage

shift_left(x, shift = 0L)

shift_right(x, shift = 0L)

shift_upstream(x, shift = 0L)

shift_downstream(x, shift = 0L)

Arguments

x

a Ranges object .

shift

the amount to move the genomic interval in the Ranges object by. Either a non-negative integer vector of length 1 or an integer vector the same length as x.

Details

Shifting left or right will ignore any strand information in the Ranges object, while shifting upstream/downstream will shift coordinates on the positive strand left/right and the negative strand right/left. By default, unstranded features are treated as positive. When using shift_upstream() or shift_downstream() when the shift argument is indexed by the strandedness of the input ranges.

Value

a Ranges object with start and end coordinates shifted.

See Also

IRanges::shift(), GenomicRanges::shift()

Examples

ir <- as_iranges(data.frame(start = 10:15, width = 5))
shift_left(ir, 5L)
shift_right(ir, 5L)
gr <- as_granges(data.frame(start = 10:15,
                            width = 5,
                            seqnames = "seq1",
                            strand = c("+", "+", "-", "-", "+", "*")))
shift_upstream(gr, 5L)
shift_downstream(gr, 5L)

sa-lee/plyranges documentation built on April 15, 2024, 12:25 p.m.