tests/testthat/test-plot_hexbin_fc.R

test_that("correct plot_hexbin_fc Seurat", {
   pbmc_small <- make_hexbin(pbmc_small, 10, dimension_reduction = "PCA")
   pbmc_small$test <- as.factor(sample(1:2, dim(pbmc_small)[2], replace=TRUE))
   plot_hexbin_fc(pbmc_small, col="test", feature="CA2", type="scale.data")
    pbmc_small <- make_hexbin(pbmc_small, 10, dimension_reduction = "PCA")
    expect_equal(class(plot_hexbin_fc(pbmc_small, col="test", feature="CA2",
    type="scale.data"))[2], "ggplot")
})

test_that("correct plot_hexbin_fc SingleCellExperiment", {
  pbmc_small <- as.SingleCellExperiment(pbmc_small)
  pbmc_small <- make_hexbin(pbmc_small, 10, dimension_reduction = "PCA")
  pbmc_small$test <- as.factor(sample(1:2, dim(pbmc_small)[2], replace=TRUE))
  expect_equal(class(plot_hexbin_fc(pbmc_small, col="test", feature="CA2",
                                    type="counts"))[2], "ggplot")
})

test_that("error plot_hexbin_fc Seurat", {
  pbmc_small$test <- as.factor(sample(1:2, dim(pbmc_small)[2], replace=TRUE))
  expect_error(plot_hexbin_fc(pbmc_small, col="test", feature="CA2",
                              type="counts"))
})

test_that("error plot_hexbin_fc SingleCellExperiment", {
  pbmc_small <- as.SingleCellExperiment(pbmc_small)
  pbmc_small$test <- as.factor(sample(1:2, dim(pbmc_small)[2], replace=TRUE))
  expect_error(plot_hexbin_fc(pbmc_small, col="test", feature="CA2",
                                    type="counts"))
})

Try the schex package in your browser

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

schex documentation built on Nov. 8, 2020, 5:56 p.m.