tests/testthat/test-cluster_sites.R

context("clustering sites using bumphunter")

# use example data from methyvimData package
library(methyvimData)
data(grsExample)
methytmle <- .methytmle(grsExample)
clustered <- methyvim:::cluster_sites(methytmle)


# check cluster IDs
test_that("each site is assigned a cluster ID", {
  expect_equal(length(clustered@clusters), nrow(clustered))
})

test_that("non-unique cluster IDs: fewer clusters than individual sites", {
  expect_lt(length(unique(clustered@clusters)), nrow(clustered))
})


# clustering does not change the class properties
test_that("clustered object is of S4 class system", {
  expect_equivalent(typeof(clustered), "S4")
})

test_that("clustered object is of class methyvim", {
  expect_equivalent(class(clustered), "methytmle")
})

test_that("classes of clustered object and of unclustered object match", {
  expect_equivalent(class(clustered), class(methytmle))
})

test_that("class types of clustered object and of unclustered object match", {
  expect_equivalent(typeof(clustered), typeof(methytmle))
})

Try the methyvim package in your browser

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

methyvim documentation built on Nov. 8, 2020, 11:11 p.m.