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])
rse0 <- SummarizedExperiment(assays=SimpleList(counts=counts),
rowRanges=rowRanges, colData=colData)
rse1 <- shift(rse0, 1)
stopifnot(identical(
rowRanges(rse1),
shift(rowRanges(rse0), 1)
))
se2 <- narrow(rse0, start=10, end=-15)
stopifnot(identical(
rowRanges(se2),
narrow(rowRanges(rse0), start=10, end=-15)
))
se3 <- resize(rse0, width=75)
stopifnot(identical(
rowRanges(se3),
resize(rowRanges(rse0), width=75)
))
se4 <- flank(rse0, width=20)
stopifnot(identical(
rowRanges(se4),
flank(rowRanges(rse0), width=20)
))
se5 <- restrict(rse0, start=200, end=700, keep.all.ranges=TRUE)
stopifnot(identical(
rowRanges(se5),
restrict(rowRanges(rse0), start=200, end=700, keep.all.ranges=TRUE)
))
Run the code above in your browser using DataLab