tests/testthat/test-density.R

test_that("calculate_density returns a vector of size n", {
    em <- Seurat::Embeddings(SeuratObject::pbmc_small)[, 1:2]
    w <- Seurat::GetAssayData(SeuratObject::pbmc_small)["CD8A", ]
    res <- Nebulosa:::calculate_density(w, em, method = "ks")

    testthat::expect_vector(res, size = nrow(em))
})



test_that("calculate-density returns a list with raw estimates", {
    em <- Seurat::Embeddings(SeuratObject::pbmc_small)[, 1:2]
    w <- Seurat::GetAssayData(SeuratObject::pbmc_small)["CD8A", ]
    res <- Nebulosa:::calculate_density(w, em, method = "ks", map = FALSE)

    testthat::expect_type(res, "list")
})

Try the Nebulosa package in your browser

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

Nebulosa documentation built on March 24, 2021, 6 p.m.