Skip to content

Commit

Permalink
test update for tsne
Browse files Browse the repository at this point in the history
  • Loading branch information
hpliner committed Sep 18, 2019
1 parent 8bb2eeb commit 9f075ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-graph_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ test_that("test graph_test returns Dex-dependent genes",{
neg_ctrl_gene = test_cds[rowData(cds)$gene_short_name == "R02D3.1",]
pr_test_res = graph_test(neg_ctrl_gene)
expect_equal(pr_test_res$status[1], "OK")
expect_equal(pr_test_res$morans_I, -0.003671565, tolerance=1e-4)
expect_equal(pr_test_res$morans_test_statistic, -1.033332, tolerance=1e-1)
expect_equal(pr_test_res$morans_I, -0.00282, tolerance=1e-4)
expect_equal(pr_test_res$morans_test_statistic, -0.784, tolerance=1e-1)
expect_gt(pr_test_res$p_value[1], 0.05)
})

Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-reduce_dimension.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ test_that("reduce_dimension runs", {
cds <- reduce_dimension(cds, reduction_method = "tSNE")
expect_equal(nrow(reducedDims(cds)$tSNE), nrow(colData(cds)))
expect_equal(ncol(reducedDims(cds)$tSNE), 2)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), -4.546885,
tolerance = 1e-4)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), 0.942,
tolerance = 1e-2)

cds <- reduce_dimension(cds, max_components = 3, reduction_method = "tSNE")
expect_equal(nrow(reducedDims(cds)$tSNE), nrow(colData(cds)))
expect_equal(ncol(reducedDims(cds)$tSNE), 3)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), -2.388678,
tolerance = 1e-4)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), -2.22,
tolerance = 1e-1)

cds <- reduce_dimension(cds, reduction_method = "PCA")
expect_equal(nrow(reducedDims(cds)$PCA), nrow(colData(cds)))
Expand All @@ -47,8 +47,8 @@ test_that("reduce_dimension runs", {
cds <- reduce_dimension(cds, reduction_method = "tSNE", preprocess_method = "LSI")
expect_equal(nrow(reducedDims(cds)$tSNE), nrow(colData(cds)))
expect_equal(ncol(reducedDims(cds)$tSNE), 2)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), -0.6852947,
tolerance = 1e-4)
expect_equal(as.numeric(reducedDims(cds)$tSNE[1,1]), 0.357,
tolerance = 1e-2)

expect_error(reduce_dimension(cds, reduction_method = "DDRTree"),
"reduction_method must be one of 'UMAP', 'PCA', 'tSNE', 'LSI', 'Aligned'")
Expand Down

0 comments on commit 9f075ff

Please sign in to comment.