tests/connected_tests/helper-makeEset.R

library(SummarizedExperiment)

make_test_eset <- function() {
  require(hgu133plus2.db)
  set.seed(1)
  nprobeids <- 1000
  nsamples <- 6
  expr <- matrix(rnorm(nprobeids*nsamples), nr = nprobeids)
  pd <- data.frame(a = 1:nsamples, b = 10*(1:nsamples))
  rownames(pd) <- paste0("SAMP_", 1:nsamples)
  rownames(expr) <- head(keys(hgu133plus2.db, keytype="PROBEID"), nprobeids)
  colnames(expr) <- rownames(pd)

  ExpressionSet(assayData = expr, 
                phenoData = AnnotatedDataFrame(pd),
                annotation = "hgu133plus2")
}

make_test_SE <- function() {
	nranges <- 200
	nsamples <- 6
	counts1 <- matrix(runif(nranges*nsamples, 1, 1e4), nranges)
	counts2 <- matrix(runif(nranges*nsamples, 1, 1e2), nranges)

	rowRanges<- sort(GRanges(rep(c("chr1","chr2"), c(50,150)),
		IRanges::IRanges(floor(runif(200,1e5,1e6)), width = 100),
		strand = sample(c("+","-"), 200, TRUE),
    probeid = paste0("sid_", 1:200)))
	colData = DataFrame(Treatment = rep(c("ChIP","Input"), 3),
	                    row.names=LETTERS[1:6])
	SummarizedExperiment(assays = SimpleList(counts1 = counts1,
	                                         counts2 = counts2),
	                     rowRanges = rowRanges,
	                     colData = colData)
}

Try the epivizrData package in your browser

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

epivizrData documentation built on Nov. 8, 2020, 7:36 p.m.