waldronlab / MultiAssayExperiment

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

Iterating Over Datasets Fails if Biobase Loaded #226

Closed DarioS closed 7 years ago

DarioS commented 7 years ago

If Biobase is loaded in the same R session as MultiAssayExperiment then the example below produces an error.

library(MultiAssayExperiment)
library(Biobase) # Remove this command for a working example.
mRNATable <- matrix(1:10, ncol = 2)
colnames(mRNATable) <- LETTERS[1:2]
proteinTable <- matrix(1:10, ncol = 2)
colnames(proteinTable) <- LETTERS[2:1]

anMSE <- MultiAssayExperiment(ExperimentList(list(mRNA = mRNATable,
                                             protein = proteinTable
                                            )),
                             S4Vectors::DataFrame(class = c("Disease", "Disease"), row.names = c('A', 'B'))
                             )

lapply(experiments(anMSE), '[', , c('A', 'B'))

The error message is Error in lapply(as.list(X), FUN = FUN, ...) : argument is missing, with no default. One package is masking another's method, it seems. This makes it hard to convert a Bioconductor package from ExpressionSet to MultiAssayExperiment because both need to be loaded during development and testing.

LiNk-NY commented 7 years ago

Hi Dario, @DarioS It appears to me that this is a bug with dispatch on ... which was fixed by Hervé some time ago. But I can't reproduce your error. It should go away when BiocInstaller::biocValid() == TRUE after updating your packages.

Note. The way to subset by samples is documented as follows:

anMSE[, list(mRNA = c("A", "B"), protein = c("A", "B"))]
## OR 
subsetByColumns(anMSE, list(mRNA = c("A", "B"), protein = c("A", "B")))

Regards, Marcel