Nothing
test_that("aberration returns a named list", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 0.3)
expect_type(aberrations, "list")
expect_true(length(aberrations) > 0)
})
test_that("aberration list is named by chromosome number", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 0.3)
# Names should be chromosome numbers as characters
expect_true(all(grepl("^[0-9]+$", names(aberrations))))
})
test_that("aberration returns data frames with correct columns", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 0.3)
expected_cols <- c("Chromosome", "Start", "End", "Num_Probes",
"Segment_Mean", "Sample", "Aberration", "Aberration_Code")
for (chr in names(aberrations)) {
expect_true(all(expected_cols %in% colnames(aberrations[[chr]])))
}
})
test_that("aberration correctly identifies gains and losses", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 0.3)
all_aberrations <- do.call(rbind, aberrations)
# Aberration column should only contain Gain or Loss
expect_true(all(all_aberrations$Aberration %in% c("Gain", "Loss")))
# Aberration_Code: 1 = Gain, 0 = Loss
expect_true(all(all_aberrations$Aberration_Code %in% c(0, 1)))
})
test_that("aberration correctly filters by effect_size threshold", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 0.3)
all_aberrations <- do.call(rbind, aberrations)
# All Gain Segment_Mean values should be > 0.3
gains <- all_aberrations[all_aberrations$Aberration == "Gain", ]
if (nrow(gains) > 0) {
expect_true(all(gains$Segment_Mean > 0.3))
}
# All Loss Segment_Mean values should be < -0.3
losses <- all_aberrations[all_aberrations$Aberration == "Loss", ]
if (nrow(losses) > 0) {
expect_true(all(losses$Segment_Mean < -0.3))
}
})
test_that("aberration returns empty list when effect_size is very high", {
cnv_file <- system.file("extdata", "cnv_data.txt", package = "RiskyCNV")
aberrations <- aberration(cnv_data_file = cnv_file, effect_size = 99)
expect_equal(length(aberrations), 0)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.