Skip to content

Commit

Permalink
test: simplify create_deseq_obj check for counts matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Dec 28, 2023
1 parent f75c49f commit 89875ab
Showing 1 changed file with 9 additions and 54 deletions.
63 changes: 9 additions & 54 deletions tests/testthat/test-deseq2.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,66 +28,21 @@ test_that("create_deseq_obj works", {
)
)
)

# run deseq
dds_dex <- DESeq2::DESeq(dds, fitType = "local")
res <- DESeq2::results(dds_dex)
res_dat <- res %>% as.data.frame()
expect_true(all.equal(
res_dat %>% dplyr::filter(baseMean > 30),
expect_equal(
dds@assays@data@listData %>% as.data.frame() %>% dplyr::filter(counts.KO_S3 > 15),
structure(
list(
baseMean = c(
46.2022644566773,
33.9841778188053,
31.0208397331822,
30.6175122400626,
35.6755294108162
),
log2FoldChange = c(
-0.93461130443384,
-3.35053555731274,
-4.88594876484931,
-4.43532926024883,
-1.8328208411504
),
lfcSE = c(
0.267983882511375,
0.52224772094996,
0.860982558001587,
0.753983075954482,
0.36162525207182
),
stat = c(
-3.48756535533128,
-6.41560589526015,
-5.67485220164042,
-5.88253158684504,
-5.0682877665479
),
pvalue = c(
0.000487439776013235,
1.40263874605495e-10,
1.38808448089501e-08,
4.04038197166405e-09,
4.01410224129028e-07
),
padj = c(
0.00389951820810588,
1.79537759495034e-08,
5.92249378515205e-07,
2.58584446186499e-07,
8.56341811475261e-06
)
counts.KO_S3 = c(25L, 16L, 19L),
counts.KO_S4 = c(22L, 10L, 26L),
counts.WT_S1 = c(74L, 0L, 10L),
counts.WT_S2 = c(104L, 0L, 8L)
),
class = "data.frame",
row.names = c(
"ENSG00000185658.13",
"ENSG00000142156.14",
"ENSG00000142173.15",
"ENSG00000159140.20",
"ENSG00000182670.13"
"ENSG00000233922.2",
"ENSG00000157601.14"
)
)
))
)
})

0 comments on commit 89875ab

Please sign in to comment.