inst/unitTests/test_slop.R

### =========================================================================
### Tests for bedtools slop command
### -------------------------------------------------------------------------
###
### Based on tests from bedtools (C) 2016 Aaron Quinlan et al.
###

test_slop <- function() {
    setwd(system.file("unitTests", "data", "slop", package="HelloRanges"))

    genome <- import("tiny.genome")
    a <- import("a.bed", genome=genome)
    
    exp <- a + 5L
    r <- bedtools_slop("-i a.bed -b 5 -g tiny.genome")
    checkIdentical(exp, eval(r))

    r <- bedtools_slop("-i a.bed -l 5 -r 5 -g tiny.genome")
    checkIdentical(exp, eval(r))

    exp <- resize(a, 5 + width(a), fix="end", ignore.strand=TRUE)
    r <- bedtools_slop("-i a.bed -l 5 -r 0 -g tiny.genome")
    checkIdentical(exp, eval(r))

    exp <- resize(a, 5 + width(a), fix="start", ignore.strand=TRUE)
    r <- bedtools_slop("-i a.bed -l 0 -r 5 -g tiny.genome")
    checkIdentical(exp, eval(r))

    exp <- resize(a, 5 + width(a), fix="start", ignore.strand=FALSE)
    r <- bedtools_slop("-i a.bed -r 5 -s -g tiny.genome")
    checkIdentical(exp, eval(r))
}

Try the HelloRanges package in your browser

Any scripts or data that you put into this service are public.

HelloRanges documentation built on Nov. 8, 2020, 7:05 p.m.