https://github.com/ctlab/phantasus
Raw File
Tip revision: fe9c3824eb3d9649de2d0c074c8896ae13c45f27 authored by Nitesh Turaga on 27 April 2020, 19:14:57 UTC
bump x.y.z version to even y prior to creation of RELEASE_3_11 branch
Tip revision: fe9c382
testkmeans.R
context("Kmeans")
library(jsonlite)

test_that("kmeans finishes with result", {
  load(file = system.file("testdata/GSE27112-GPL6103.rda", package="phantasus"))
  expect_is(performKmeans(es, k = 10), "json")
})

test_that("kmeans works with datasets with lots of NAs", {
  es <- read.gct(system.file("testdata/centers.gct", package="phantasus"))
  clusters = fromJSON(performKmeans(es, k=2))
  expect_length(clusters, nrow(es))
  expect_equal(clusters[4], "")
})

# Invalid test. Interface changed such way so no indices passed to arguments
#test_that("kmeans returns only vector for a subset", {
#    es <- read.gct(system.file("testdata/centers.gct", package="phantasus"))
#    rows <- c(0, 2, 3, 5)
#    expect_length(fromJSON(performKmeans(es, rows=rows, k = 2)), length(rows))
#})
back to top