tests/testthat/test_annotation.R

test_that("AnnotationParams", {
    expect_error(setAnnotationParams(1),
                 "'params' must be of class 'AnnotationParams'.")
    expect_error(setAnnotationParams(inputs = 1),
                 "'inputs' must contain a species and a feature type.")
    expect_error(setAnnotationParams(inputs = LETTERS[1:2]),
                 "Couldn't find a unique species match for 'A'.")
    expect_error(setAnnotationParams(inputs = c("Human genes", "foo")),
                 "Couldn't find a unique feature type match for 'foo'.")

    ap <- setAnnotationParams(inputs = c("Human genes",
                                         "UniProtKB/Swiss-Prot ID"))
    expect_null(show(ap))

    expect_is(ap, "AnnotationParams")
    expect_identical(ap@martname, "ENSEMBL_MART_ENSEMBL")
    expect_identical(ap@dataset, "hsapiens_gene_ensembl")
    expect_identical(ap@filter, "uniprotswissprot")
    expect_error(setAnnotationParams()) ## only in non-interactive mode

    ap2 <- getAnnotationParams()
    expect_identical(ap, ap2)
    setAnnotationParams(ap)
    ap2 <- getAnnotationParams()
    expect_identical(ap, ap2)
})

Try the pRoloc package in your browser

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

pRoloc documentation built on Nov. 8, 2020, 6:26 p.m.