slop_bed: Extend upstream or downstream the coordinates of a bed file

View source: R/genomics_files_utils.R

slop_bedR Documentation

Extend upstream or downstream the coordinates of a bed file

Description

If strand_aware then for the negative strands start position is slopped by the negative downstream value and the end position is slopped by adding the upstream value.

Usage

slop_bed(bed, upstream = 10, downstream = 5, strand_aware = T)

Arguments

bed

a tibble imported with read_bed()

upstream

How many nucleotides to add upstream to the start coordinate

downstream

How many nucleotides to add upstream to the end coordinate

strand_aware

Logical, whether or not to slop in a strand aware fashion.

Details

strand can only be specified with + or -,

Value

A tibble

Examples

read_bed(path = test_coord, header = F)

# A tibble: 3 × 6
# chr   start   end name    score strand
# <chr> <dbl> <dbl> <chr>   <dbl> <chr> 
# chr10   100   200 test1     0 +     
# chr14   500   550 test2     0 -     
# chr1    150   190 test3     0 -   

read_bed(path = exons_coord, header = F) |> slop_bed(upstream = 10, downstream = 5, strand_aware = T)

# A tibble: 3 × 6
# chr   start   end name    score strand
# <chr> <dbl> <dbl> <chr>   <dbl> <chr> 
# chr10    90   205 test1     0 +     
# chr14   495   560 test2     0 -     
# chr1    145   200 test3     0 -     


Ni-Ar/niar documentation built on Feb. 3, 2025, 9:25 a.m.