Similar to bedtools slop
, this function increases the size of each feature
in a feature file by a user-defined number of bases. Will restrict the
resizing to the size of the chromosome.
slop_bed( x, genome = NULL, slop = 1L, slop_type = c("bp", "frac"), mode = c("both", "left", "right") )
x | A |
---|---|
genome | Specify the reference genome for the BED file. |
slop | The number of base pairs to slop, or the percentage of the
interval's width (refer to |
slop_type | If |
mode | If |
A slopped GRanges
object.
Manual page of bedtools slop
: https://bedtools.readthedocs.io/en/latest/content/tools/slop.html
# Load data tbl <- read_bed(system.file("extdata", "example_merge.bed", package = "bedtorch"), use_gr = FALSE, genome = "hs37-1kg") # Slop by 10 on both ends result <- slop_bed(tbl, slop = 10L, slop_type = "bp", mode = "both") # Slop by 10 only on the right end result <- slop_bed(tbl, slop = 10L, slop_type = "bp", mode = "right") head(result) #> chrom start end score #> 1: 21 3 16 8 #> 2: 21 10 26 5 #> 3: 21 12 27 4 #> 4: 21 15 32 5 #> 5: 21 22 35 7 #> 6: 21 26 40 7 #> ------- #> genome: hs37-1kg. # Slop by 20% on the left end result <- slop_bed(tbl, slop = 0.2, slop_type = "frac", mode = "left") head(result) #> chrom start end score #> 1: 21 3 6 8 #> 2: 21 9 16 5 #> 3: 21 11 17 4 #> 4: 21 14 22 5 #> 5: 21 22 25 7 #> 6: 21 26 30 7 #> ------- #> genome: hs37-1kg.