Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
LiNk-NY committed May 1, 2024
1 parent 1ebad2f commit 9189d8c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Authors@R: c(
person("Vincent J", "Carey", , , c("aut", "ctb")),
person("Levi", "Waldron", , "[email protected]", "aut"),
person("MultiAssay", "SIG", , "[email protected]", "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.
Expand Down
26 changes: 17 additions & 9 deletions R/MultiAssayExperiment-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-MultiAssayExperiment-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]

})

0 comments on commit 9189d8c

Please sign in to comment.