Skip to content

Commit

Permalink
Fixing bug in transform_dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviaAB committed Jan 17, 2024
1 parent 9669d7d commit f884dfb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,13 @@ transform_dataset <- function(mo_data,
verbose = TRUE,
method,
...) {
mo_data <- check_input_multidataset(mo_data, dataset)
## We don't want to subset the dataset
check_is_multidataset(mo_data)
.check_names(
dataset,
names(mo_data),
"'_W_' datasets are not present in mo_data. Possible dataset names are: '_C_'."
)

.check_names(
transformation,
Expand Down Expand Up @@ -569,7 +575,7 @@ transformation_datasets_factory <- function(mo_data_target,
#' @export
get_table_transformations <- function(transformation_result, best_normalize_details = FALSE) {
## for devtools::check
Features <- NULL
Features <- Feature <- NULL

transf_name <- c(
"vsn" = "Variance Stabilising Normalisation (vsn)",
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,15 @@ test_that("transform_dataset works", {
)
expect_error(transform_dataset(multiomics_set, "snps+A", "best-normalize-manual"), "'method' argument should be provided for 'best-normalize-manual' transformation.")

res <- transform_dataset(
multiomics_set,
"rnaseq",
"best-normalize-manual",
method = "center_scale",
return_multidataset = TRUE
)
expect_s4_class(res, "MultiDataSet")
expect_equal(names(res), c("snps+A", "rnaseq", "metabolome", "phenotypes"))

# expect_message(transform_dataset(multiomics_set, dataset = "snps+A", transformation = "best-normalize-auto", method = "center_scale"))
})

0 comments on commit f884dfb

Please sign in to comment.