waldronlab / MultiAssayExperiment

Bioconductor package for management of multi-assay data
https://waldronlab.io/MultiAssayExperiment/
69 stars 32 forks source link

"reduce" method for MultiAssayExperiment #162

Closed lwaldron closed 6 years ago

lwaldron commented 8 years ago

Relates to "reduce" discussion earlier with @mtmorgan

lwaldron commented 7 years ago

Here's an example of where the "align columns of each experiment with each other and with pData" would come in handy. I just want to use the RNA-seq and clinical data for prostate cancer, and it is ugly. The line I object to the user having to do here is sampleMap(maeo.rnaseq) <- sampleMap(maeo.rnaseq)[match(rownames(pData(maeo.rnaseq)), sampleMap(maeo.rnaseq)$primary), ]

> download.file("http://s3.amazonaws.com/multiassayexperiments/pradMAEO.rds", destfile="pradMAEO.rds")
> maeo <- readRDS("pradMAEO.rds")
> maeo.rnaseq <- maeo[, , "RNASeq2GeneNorm"]
> maeo.rnaseq <- maeo.rnaseq[, complete.cases(maeo.rnaseq), ]
> sampleMap(maeo.rnaseq) <- sampleMap(maeo.rnaseq)[match(rownames(pData(maeo.rnaseq)), sampleMap(maeo.rnaseq)$primary), ]
> all.equal(rownames(pData(maeo.rnaseq)), sampleMap(maeo.rnaseq)$primary)
[1] TRUE
> eset.rnaseq <- experiments(maeo.rnaseq)[[1]]
> pData(eset.rnaseq) <- data.frame(pData(maeo.rnaseq))
> eset.rnaseq
ExpressionSet (storageMode: lockedEnvironment)
assayData: 20501 features, 550 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: TCGA-2A-A8VL TCGA-2A-A8VO ... TCGA-ZG-A9NI (497 total)
  varLabels: Composite.Element.REF years_to_birth ... ethnicity (21 total)
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  
> 
LiNk-NY commented 7 years ago

@lwaldron I'm working on getting a clean check. I will run this example with the latest revision of reduce

LiNk-NY commented 7 years ago

@lwaldron These objects were built before the updates to the constructor function. The updates would take care of any ordering and tidying of the inputs. See: https://github.com/vjcitn/MultiAssayExperiment/blob/master/R/MultiAssayExperiment.R#L26 If anything has to change, it would be there. We could also export the harmonize function and use that to tie loose-ends and/or update an old MultiAssayExperiment.

LiNk-NY commented 7 years ago

reduce should do less and be endomorphic.

LiNk-NY commented 6 years ago

Handled in RaggedExperiment