nrows <- 20; ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rowRanges <- GRanges(rep(c("chr1", "chr2"), c(5, 15)),
IRanges(sample(1000L, 20), width=100),
strand=Rle(c("+", "-"), c(12, 8)))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
row.names=LETTERS[1:6])
se0 <- SummarizedExperiment(assays=SimpleList(counts=counts),
rowRanges=rowRanges, colData=colData)
se1 <- shift(se0, 100)
hits <- findOverlaps(se0, se1)
hits
stopifnot(identical(hits, findOverlaps(rowRanges(se0), rowRanges(se1))))
stopifnot(identical(hits, findOverlaps(se0, rowRanges(se1))))
stopifnot(identical(hits, findOverlaps(rowRanges(se0), se1)))
Run the code above in your browser using DataCamp Workspace