Subset and Assign MultiAssayExperiment
1
0
Entering edit mode
Dario Strbenac ★ 1.5k
@dario-strbenac-5916
Last seen 11 hours ago
Australia

Is it possible to subset and assign in the same command? For example, I would like to reduce an assay to 1000 features for illustrative purposes. But, it causes an error.

melanomaData[, , 2] <- melanomaData[1:1000, , 2]
Error in .nextMethod(value = value, x = x) : 
  'value' must be a ExperimentList object (or coercible to a ExperimentList object)

What's the correct way to subset one assay and reassign it to the same variable?

MultiAssayExperiment • 749 views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

I believe you need the [[ accessor for that.

> library(MulitAssayExperiment)
> data(miniACC)
> miniACC
A MultiAssayExperiment object of 5 listed
 experiments with user-defined names and respective classes.
 Containing an ExperimentList class object of length 5:
 [1] RNASeq2GeneNorm: SummarizedExperiment with 198 rows and 79 columns
 [2] gistict: SummarizedExperiment with 198 rows and 90 columns
 [3] RPPAArray: SummarizedExperiment with 33 rows and 46 columns
 [4] Mutations: matrix with 97 rows and 90 columns
 [5] miRNASeqGene: SummarizedExperiment with 471 rows and 80 columns
Functionality:
 experiments() - obtain the ExperimentList instance
 colData() - the primary/phenotype DataFrame
 sampleMap() - the sample coordination DataFrame
 `$`, `[`, `[[` - extract colData columns, subset, or experiment
 *Format() - convert into a long or wide DataFrame
 assays() - convert ExperimentList to a SimpleList of matrices
 exportClass() - save data to flat files

> miniACC[[2]] <-  miniACC[[2]][1:10,]
> miniACC
A MultiAssayExperiment object of 5 listed
 experiments with user-defined names and respective classes.
 Containing an ExperimentList class object of length 5:
 [1] RNASeq2GeneNorm: SummarizedExperiment with 198 rows and 79 columns
 [2] gistict: SummarizedExperiment with 10 rows and 90 columns
 [3] RPPAArray: SummarizedExperiment with 33 rows and 46 columns
 [4] Mutations: matrix with 97 rows and 90 columns
 [5] miRNASeqGene: SummarizedExperiment with 471 rows and 80 columns
Functionality:
 experiments() - obtain the ExperimentList instance
 colData() - the primary/phenotype DataFrame
 sampleMap() - the sample coordination DataFrame
 `$`, `[`, `[[` - extract colData columns, subset, or experiment
 *Format() - convert into a long or wide DataFrame
 assays() - convert ExperimentList to a SimpleList of matrices
 exportClass() - save data to flat files

Any other iteration appears to generate an invalid object, if it works at all.

ADD COMMENT
1
Entering edit mode

Thank you Jim!

I will look into it and see what can be done. I've created an issue here:

https://github.com/waldronlab/MultiAssayExperiment/issues/319

Best,

Marcel

ADD REPLY
0
Entering edit mode

Upon further review, it looks like this is the desired behavior. Single bracket replacements should be either a list or ExperimentList.

Something like this is expected:

miniACC[, , 3] <- ExperimentList(sample3 = experiments(miniACC)[[3]][1:33, 1:40])

I've updated the method to include the use of the names on the right-hand side.

Best,

Marcel

ADD REPLY

Login before adding your answer.

Traffic: 608 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6