Question: MultiAssayExperiment: how can i change name of a experiment in a multiassayexperiment object?
0
gravatar for mario.zanfardino
12 months ago by
Naples (Italy)
mario.zanfardino150 wrote:

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 • 408 views
ADD COMMENTlink modified 12 months ago by Marcel Ramos ♦♦ 410 • written 12 months ago by mario.zanfardino150
Answer: MultiAssayExperiment: how can i change name of a experiment in a multiassayexper
4
gravatar for Marcel Ramos
12 months ago by
Marcel Ramos ♦♦ 410
United States
Marcel Ramos ♦♦ 410 wrote:

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

ADD COMMENTlink written 12 months ago by Marcel Ramos ♦♦ 410
2

That's great, Marcel. Nice feature addition. 

ADD REPLYlink written 12 months ago by Levi Waldron950

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.

ADD REPLYlink written 12 months ago by mario.zanfardino150
2

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/

ADD REPLYlink written 12 months ago by Levi Waldron950

Thank you, now runs!

ADD REPLYlink modified 12 months ago • written 12 months ago by mario.zanfardino150
Answer: MultiAssayExperiment: how can i change name of a experiment in a multiassayexper
1
gravatar for Levi Waldron
12 months ago by
Levi Waldron950
CUNY Graduate School of Public Health and Health Policy, New York, NY
Levi Waldron950 wrote:
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? >
ADD COMMENTlink written 12 months ago by Levi Waldron950

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)
ADD REPLYlink modified 12 months ago • written 12 months ago by mario.zanfardino150

Ok, resolved!

mae2 <- BRCA_TCGA_plus@ExperimentList[[sa]] <- se
ADD REPLYlink modified 12 months ago • written 12 months ago by mario.zanfardino150

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

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

Any idea?

ADD REPLYlink modified 12 months ago • written 12 months ago by mario.zanfardino150
> > 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.
ADD REPLYlink written 12 months ago by Levi Waldron950

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

 

 

ADD REPLYlink written 12 months ago by mario.zanfardino150
1

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).

ADD REPLYlink modified 12 months ago • written 12 months ago by Levi Waldron950
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 284 users visited in the last hour