MultiAssayExperiment: how can i change name of a experiment in a multiassayexperiment object?
2
0
Entering edit mode
@mariozanfardino-15232
Last seen 2.5 years ago
Naples (Italy)

I have this MAE:

> mae2
A MultiAssayExperiment object of 5 listed
experiments with user-defined names and respective classes.
Containing an ExperimentList class object of length 5:
[1] BRCA_miRNASeqGene-20160128: SummarizedExperiment with 1046 rows and 849 columns
[2] BRCA_RNASeqGene-20160128: SummarizedExperiment with 20502 rows and 878 columns
[3] exp_1: SummarizedExperiment with 20 rows and 10 columns
[4] exp_2: SummarizedExperiment with 20 rows and 10 columns
[5] sa: SummarizedExperiment with 20 rows and 10 columns

And i want change "sa" in "exp_3".

Thank you!

multiassayexperiment • 1.8k views
4
Entering edit mode
@marcel-ramos-7325
Last seen 2 days ago
United States

Hi all, Apologies for the delay but you can now use names<- to replace the names of experiments in a MultiAssayExperiment.

library(MultiAssayExperiment)
example(MultiAssayExperiment)
names(mae) <- c("AffyTwo", "Methyl450", "RNA", "GISTICv2")
mae

Please ensure that you have version >= 1.7.18.

Best regards, Marcel

2
Entering edit mode

That's great, Marcel. Nice feature addition.

0
Entering edit mode

Thank you very much Marcel! i have 1.6.0 version of MAE. But If i run:

source("https://bioconductor.org/biocLite.R")
BiocInstaller::biocLite("MultiAssayExperiment")

no update is detected.

2
Entering edit mode

You would have to use the development version of Bioconductor to get this update before the next release (which will happen in October): http://bioconductor.org/developers/how-to/useDevel/

0
Entering edit mode

Thank you, now runs!

1
Entering edit mode
@levi-waldron-3429
Last seen 6 weeks ago
CUNY Graduate School of Public Health a…
There's currently no direct way to rename an ExperimentList slot, because the sampleMap would have to be modified simultaneously. One hack would be to use the c() function to concatenate a new ExperimentList element, then subset to remove the old one. I'm not sure if this is a common enough use case to deserve a special replacement function, thoughts? >
0
Entering edit mode

I don't know! in my case i need to assign a value of a variable as name of a MAE experiment (in the MAE creating phase). But it does not seem possible and then i would like rename in a second phase.

mae2 <- c(BRCA_TCGA_plus, sa=se)

sa is a variable:

sa <- "exp_3"

and i want:

mae2 <- c(BRCA_TCGA_plus, exp_3 = se)
0
Entering edit mode

Ok, resolved!

mae2 <- BRCA_TCGA_plus@ExperimentList[[sa]] <- se
0
Entering edit mode

ops! this solution produce this error when i try to generate wideFormat:

> wideFormat(mae2[ , , c("exp_3")]
Error: subscript contains invalid rownames

Any idea?

0
Entering edit mode
> > when i try to generate wideFormat: > > > wideFormat(mae2[ , , c("exp_3")] > > Error: subscript contains invalid rownames > > Any idea? > I don't think you have renamed the experiment, and you don't have one named exp_3. I'm not at a computer but will give a more complete solution as soon as I can.
0
Entering edit mode

No, i don't have renamed experimet. i have added the experiment using my variable sa <- "exp_3". After this i have the followig MAE:

> mae2
A MultiAssayExperiment object of 8 listed
experiments with user-defined names and respective classes.
Containing an ExperimentList class object of length 8:
[1] BRCA_miRNASeqGene-20160128: SummarizedExperiment with 1046 rows and 849 columns
[2] BRCA_RNASeqGene-20160128: SummarizedExperiment with 20502 rows and 878 columns
[3] MRI_exp_1: SummarizedExperiment with 20 rows and 10 columns
[4] MRI_exp_2: SummarizedExperiment with 20 rows and 10 columns
[5] exp_3: SummarizedExperiment with 20 rows and 10 columns

But  when i try to generate wideFormat i have the following error:

Error: subscript contains invalid rownames

1
Entering edit mode

Marcel has provided the real solution to your request below - thanks for the feature request! But if you are using bioc-release and just want a hack in the meantime, here it is. The error you saw was due to trying to subset to an experiment that doesn't exist, it isn't related to wideFormat(). See the reproducible example below.

suppressPackageStartupMessages(library(MultiAssayExperiment))
example("MultiAssayExperiment")
names(mae)
#> [1] "Affy"       "Methyl450k" "RNASeqGene" "GISTIC"
mae <- c(mae, exp_3=mae[[1]])
names(mae)
#> [1] "Affy"       "Methyl450k" "RNASeqGene" "GISTIC"     "exp_3"
mae <- mae[, , -1]
names(mae)
#> [1] "Methyl450k" "RNASeqGene" "GISTIC"     "exp_3"
mae <- mae[, , c(4, 1:3)]
names(mae)
#> [1] "exp_3"      "Methyl450k" "RNASeqGene" "GISTIC"
wideFormat(mae[, , "exp_3"])
#> DataFrame with 4 rows and 6 columns
#>       primary exp_3_ENST00000234812 exp_3_ENST00000294241
#>   <character>             <numeric>             <numeric>
#> 1        Jack                   104                   101
#> 2        Jill                   109                   106
#> 3         Bob                   119                   116
#> 4     Barbara                   114                   111
#>   exp_3_ENST00000355076 exp_3_ENST00000383323 exp_3_ENST00000383706
#>               <numeric>             <numeric>             <numeric>
#> 1                   102                   105                   103
#> 2                   107                   110                   108
#> 3                   117                   120                   118
#> 4                   112                   115                   113

Created on 2018-09-08 by the reprex package (v0.2.0).