Nothing
test_that("default settings", {
res <- normalise(
nacho_object = GSE74821
)
expect_s3_class(res, "nacho")
})
test_that("missing nacho", {
expect_error(normalise())
})
test_that("missing field", {
GSE74821$nacho <- NULL
expect_error(normalise(GSE74821))
})
test_that("No POS_E", {
GSE74821$nacho <- GSE74821$nacho[GSE74821$nacho$Name != "POS_E(0.5)", ]
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("genes not null", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = c("RPLP0", "ACTB"),
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("predict TRUE", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = TRUE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("norm TRUE", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = TRUE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("method GLM", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GLM",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("n_comp 2", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 2,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("n_comp 10", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("outliers TRUE", {
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("Test outliers", {
res <- normalise(
nacho_object = GSE74821,
remove_outliers = TRUE,
outliers_thresholds = list(
BD = c(0.15, 2.25),
FoV = 95,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("All LoD to zero", {
GSE74821$nacho$LoD <- 0
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = c("RPLP0", "ACTB"),
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("All PC to zero", {
GSE74821$nacho$PC <- 0
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = c("RPLP0", "ACTB"),
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = FALSE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("housekeeping_norm to FALSE and remove_outliers to TRUE", {
GSE74821$nacho$PC <- 0
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = FALSE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = TRUE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("housekeeping_norm to TRUE and remove_outliers to TRUE", {
GSE74821$nacho$PC <- 0
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = TRUE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = TRUE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("housekeeping_norm to TRUE and remove_outliers to TRUE", {
GSE74821$nacho$PC <- 0
res <- normalise(
nacho_object = GSE74821,
housekeeping_genes = NULL,
housekeeping_predict = FALSE,
housekeeping_norm = TRUE,
normalisation_method = "GEO",
n_comp = 10,
remove_outliers = TRUE,
outliers_thresholds = list(
BD = c(0.1, 2.25),
FoV = 75,
LoD = 2,
PCL = 0.95,
Positive_factor = c(1 / 4, 4),
House_factor = c(1 / 11, 11)
)
)
expect_s3_class(res, "nacho")
})
test_that("housekeeping_norm to TRUE and remove_outliers to TRUE", {
attr(GSE74821, "RCC_type") <- "something"
expect_error(normalise(GSE74821))
})
test_that("Missing values in counts", {
index <- sample(which(GSE74821$nacho$CodeClass == "Endogenous"), size = 25)
GSE74821$nacho[index, "Count"] <- NA
GSE74821$nacho[index, "Count_Norm"] <- NA
expect_message(
object = normalise(GSE74821, normalisation_method = "GEO"),
regexp = "Missing values have been replaced with zeros for PCA"
)
})
test_that("plexset", {
expect_s3_class(
object = {
normalise(
plexset_nacho,
housekeeping_predict = TRUE,
housekeeping_norm = TRUE
)
},
class = "nacho"
)
})
test_that("plexset GLM", {
expect_s3_class(
object = {
normalise(
plexset_nacho,
housekeeping_predict = TRUE,
housekeeping_norm = TRUE,
normalisation_method = "GLM"
)
},
class = "nacho"
)
})
test_that("normalise() uses the n_comp it receives", {
res <- suppressMessages(normalise(GSE74821, n_comp = 3))
expect_identical(res[["n_comp"]], 3)
expect_identical(nrow(res[["pc_sum"]]), 3L)
expect_identical(
grep("^PC[0-9]+$", names(res[["nacho"]]), value = TRUE),
sprintf("PC%02d", 1:3)
)
})
test_that("normalise() keeps the requested n_comp when it removes outliers", {
thresholds <- GSE74821[["outliers_thresholds"]]
thresholds[["FoV"]] <- 99.5
res <- suppressMessages(normalise(
GSE74821,
n_comp = 4,
remove_outliers = TRUE,
outliers_thresholds = thresholds
))
expect_identical(res[["n_comp"]], 4)
expect_identical(nrow(res[["pc_sum"]]), 4L)
})
test_that("normalise() flags outliers against new thresholds", {
thresholds <- GSE74821[["outliers_thresholds"]]
thresholds[["BD"]] <- c(0.1, 0.2)
res <- suppressMessages(normalise(GSE74821, outliers_thresholds = thresholds))
expect_identical(
res[["nacho"]][["is_outlier"]],
check_outliers(res)[["nacho"]][["is_outlier"]]
)
expect_true(any(res[["nacho"]][["is_outlier"]]))
})
test_that("a panel without POS_E gives NA for PCL and LoD, not a failure", {
no_pos_e <- GSE74821
no_pos_e[["nacho"]] <- no_pos_e[["nacho"]][
no_pos_e[["nacho"]][["Name"]] != "POS_E(0.5)",
]
res <- suppressMessages(normalise(no_pos_e, normalisation_method = "GEO"))
expect_true(all(is.na(res[["nacho"]][["PCL"]])))
expect_true(all(is.na(res[["nacho"]][["LoD"]])))
expect_false(anyNA(res[["nacho"]][["is_outlier"]]))
})
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.