shift_left {plyranges} | R 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.

### Value

a Ranges object with start and end coordinates shifted.

### See Also

`IRanges::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)

[Package plyranges version 1.4.4 Index]