File: test_plots.R

package info (click to toggle)
r-bioc-edaseq 2.32.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 404 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
context("Test plot functions.")

set.seed(42)

mat <- matrix(data=rpois(1000, lambda=10), ncol=10)
rownames(mat) <- paste("gene", 1:nrow(mat), sep="")
colnames(mat) <- paste("sample", 1:ncol(mat), sep="")

es <- newSeqExpressionSet(mat)

test_that("plotPCA works", {
  ks <- 2:5

  ## matrix
  expect_silent(lapply(ks, function(k) plotPCA(mat, k=k)))
  expect_silent(lapply(ks, function(k) plotPCA(mat, k=k, labels=FALSE)))
  expect_silent(lapply(ks, function(k) plotPCA(mat, k=k)))
  expect_silent(lapply(ks, function(k) plotPCA(mat, k=k, labels=FALSE, pch=20, col=1:2)))

  ## expressionset
  expect_silent(lapply(ks, function(k) plotPCA(es, k=k)))
  expect_silent(lapply(ks, function(k) plotPCA(es, k=k, labels=FALSE)))
  expect_silent(lapply(ks, function(k) plotPCA(es, k=k, labels=FALSE, pch=20, col=1:2)))

})

test_that("plotRLE works", {

  ## matrix
  rle <- plotRLE(mat)
  expect_equal(dim(mat), dim(rle))

  ## expressionset
  rle <- plotRLE(es)
  expect_equal(dim(mat), dim(rle))

})