tests/testthat/test-syndromic_plot.R

context("syndromic_plot")

library(Gifi)
# library(syndRomics)

pca<-prcomp(mtcars, center = TRUE, scale. = TRUE)
nlpca<-princals(mtcars, ndim=ncol(mtcars))

load_df<-extract_loadings(pca, mtcars)

testthat::test_that("warning", {
  testthat::expect_warning(
    syndromic_plot(pca, mtcars, cutoff = 0.1, ndim=13),
    "The specified ndim is bigger than number of dimensions, using ndim = 11"
  )
})

testthat::test_that("errors", {
  testthat::expect_error(
    extract_syndromic_plot(pca, mtcars, cutoff = 0.1,pc = "PC11"),
    "PC11  has no loadings above cutoff"
  )
})
ucsf-ferguson-lab/syndRomics documentation built on June 26, 2022, 5:36 p.m.