diff --git a/DESCRIPTION b/DESCRIPTION index 1c77ab1..ae97d39 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,11 +11,11 @@ Authors@R: c( person("Vincent J", "Carey", , , c("aut", "ctb")), person("Levi", "Waldron", , "lwaldron.research@gmail.com", "aut"), person("MultiAssay", "SIG", , "biocmultiassay@googlegroups.com", "ctb")) -Description: MultiAssayExperiment harmonizes data management of multiple - experimental assays performed on an overlapping set of specimens. It - provides a familiar Bioconductor user experience by extending concepts - from SummarizedExperiment, supporting an open-ended mix of standard - data classes for individual assays, and allowing subsetting by genomic +Description: Harmonize data management of multiple experimental assays + performed on an overlapping set of specimens. It provides a familiar + Bioconductor user experience by extending concepts from + SummarizedExperiment, supporting an open-ended mix of standard data + classes for individual assays, and allowing subsetting by genomic ranges or rownames. Facilities are provided for reshaping data into wide and long formats for adaptability to graphing and downstream analysis. diff --git a/R/MultiAssayExperiment-helpers.R b/R/MultiAssayExperiment-helpers.R index 2f50964..f3176aa 100644 --- a/R/MultiAssayExperiment-helpers.R +++ b/R/MultiAssayExperiment-helpers.R @@ -348,19 +348,27 @@ setMethod("mergeReplicates", "ANY", object <- Biobase::exprs(object) if (is(object, "SummarizedExperiment") || is(object, "RaggedExperiment")) object <- assay(object, i = i) - if (is(object, "matrix")) - object <- as.data.frame(object) ## use stats::reshape instead of reshape2::melt if (nullROWS) rownames(object) <- rowNAMES - object <- stats::reshape(object, idvar = "rowname", - ids = rownames(object), times = names(object), - timevar = "colname", varying = list(names(object)), - direction = "long", v.names = "value") - ## Reshape leaves rownames even if new.row.names = NULL - rownames(object) <- NULL - object[, c("rowname", "colname", "value")] + # if (requireNamespace("reshape2", quietly = TRUE)) { + if (FALSE) { + object <- reshape2::melt( + object, varnames = c("rowname", "colname"), value.name = "value" + ) + } else { + if (is.matrix(object)) + object <- as.data.frame(object) + object <- stats::reshape(object, idvar = "rowname", + ids = rownames(object), times = names(object), + timevar = "colname", varying = list(names(object)), + direction = "long", v.names = "value") + ## Reshape leaves rownames even if new.row.names = NULL + rownames(object) <- NULL + object[, c("rowname", "colname", "value")] + } + object } .longFormatElist <- function(object, i) { diff --git a/tests/testthat/test-MultiAssayExperiment-helpers.R b/tests/testthat/test-MultiAssayExperiment-helpers.R index 0749190..3506461 100644 --- a/tests/testthat/test-MultiAssayExperiment-helpers.R +++ b/tests/testthat/test-MultiAssayExperiment-helpers.R @@ -238,3 +238,11 @@ test_that("renaming helpers work", { newaffynames ) }) + + +test_that(".longFormatANY works", { + denv <- new.env(parent = emptyenv()) + data("miniACC", package="MultiAssayExperiment", envir = denv) + miniACC <- denv[["miniACC"]] + +})