waldronlab / MultiAssayExperiment

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

function to add colData to a particular experiment and extract #252

Closed LiNk-NY closed 5 years ago

LiNk-NY commented 6 years ago

This could be a standalone function to move the colData(mae) into a single experiment during extraction ([[).

(from discussions with Levi @lwaldron)

Samples and Patients should be in agreement in the final extracted dataset.

schifferl commented 5 years ago

This can sometimes be desirable when you only want a single assay from a MultiAssayExperiment object. In the context of curatedTCGAData I was able to achieve this with the following (not so elegant) code.

BRCA <- curatedTCGAData::curatedTCGAData(diseaseCode = "BRCA", assays = "RNASeq2GeneNorm", dry.run = FALSE)
colData <- MultiAssayExperiment::colData(BRCA)
sampleMap <- MultiAssayExperiment::sampleMap(BRCA)
colData <- colData[sampleMap$primary, ]
S4Vectors::rownames(colData) <- as.character(sampleMap$colname)
BRCA <- BRCA[[1]]
SummarizedExperiment::assayNames(BRCA) <- as.character("RNASeq2GeneNorm")
SummarizedExperiment::colData(BRCA) <- colData
lgeistlinger commented 5 years ago

Agreed with @schifferl. Would actually say that this is a frequent use case, for instance for users querying curatedTCGAData for a single assay type.

LiNk-NY commented 5 years ago

I've named it getWithColData, you can see it here: 17727a4a1e507a8987b30a8e6bf5f0579dbe043f

lgeistlinger commented 5 years ago

Thanks, Marcel!