https://github.com/ctlab/phantasus
Tip revision: 5d2cf021ab7c15563b9e666e5d9bb18dfa2c9779 authored by Alexey Sergushichev on 21 November 2019, 09:49:38 UTC
version bump
version bump
Tip revision: 5d2cf02
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))
#})