tests/testthat/test-roxytest-testexamples-get_groups.R

# Generated by roxytest: do not edit by hand!

# File R/get_groups.R: @testexamples

test_that("Function get_groups() @ L59", {
  
  
  # Load copy number prepare object
  load(system.file("extdata", "toy_copynumber_tally_W.RData",
    package = "sigminer", mustWork = TRUE
  ))
  # Extract copy number signatures
  library(NMF)
  sig <- sig_extract(cn_tally_W$nmf_matrix, 2,
    nrun = 10
  )
  
  # Methods 'consensus' and 'samples' are from NMF::predict()
  g1 <- get_groups(sig, method = "consensus", match_consensus = TRUE)
  g1
  g2 <- get_groups(sig, method = "samples")
  g2
  
  # Use k-means clustering
  g3 <- get_groups(sig, method = "k-means")
  g3
  
  expect_is(g1, "data.frame")
  expect_is(g2, "data.frame")
  expect_is(g3, "data.frame")
})
ShixiangWang/sigminer documentation built on March 16, 2024, 12:30 p.m.