File: test_XMatrix-class.R

package info (click to toggle)
r-bioc-tfbstools 1.44.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 948 kB
  • sloc: xml: 1,137; ansic: 590; asm: 54; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,688 bytes parent folder | download | duplicates (4)
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
test_that("test_Accessor", {
    pfm <- PFMatrix(ID = "MA0004.1", name = "Arnt", matrixClass = "Zipper-Type", 
        strand = "+", bg = c(A = 0.25, C = 0.25, G = 0.25, T = 0.25), 
        tags = list(family = "Helix-Loop-Helix", species = "10090", 
            tax_group = "vertebrates", medline = "7592839", type = "SELEX", 
            ACC = "P53762", pazar_tf_id = "TF0000003", TFBSshape_ID = "11", 
            TFencyclopedia_ID = "580"), profileMatrix = matrix(c(4L, 
            19L, 0L, 0L, 0L, 0L, 16L, 0L, 20L, 0L, 0L, 0L, 0L, 
            1L, 0L, 20L, 0L, 20L, 0L, 0L, 0L, 0L, 20L, 0L), byrow = TRUE, 
            nrow = 4, dimnames = list(c("A", "C", "G", "T"))))
    expect_identical("MA0004.1", ID(pfm))
    expect_identical("Arnt", name(pfm))
    expect_identical("Zipper-Type", matrixClass(pfm))
})

test_that("test_XMatrixConstructor", {
    expect_error(PFMatrix(pseudocounts = 0.8))
    expect_error(PWMatrix(schneider = TRUE))
    expect_error(PFMatrix(bg = c(A = 0.25, C = 0.25, G = 0.25, 
        U = 0.25)))
    expect_error(PFMatrix(bg = c(A = -0.5, C = 0.25, G = 0.25, 
        T = 0.25)))
    expect_error(PFMatrix(bg = c(A = -0.5, C = 0.25, T = 0.25, 
        G = 0.25)))
    expect_error(PFMatrix(ID = c("12", "34")))
    expect_error(PFMatrix(name = c("12", "34")))
    expect_error(PFMatrix(strand = c("+", "-")))
    expect_error(PFMatrix(strand = c("a")))
    expect_error(PFMatrix(profileMatrix = matrix(1, ncol = 2, 
        nrow = 2)))
})

test_that("test_XMatrixListConstructor", {
    expect_error(PFMatrixList(PWMatrix(), PWMatrix()))
    expect_error(PWMatrixList(PFMatrix(), PFMatrix()))
    expect_error(ICMatrixList(PWMatrix(), PWMatrix()))
})