Search
Question: MultiAssayExperiment wideformat operations
0
gravatar for mario.zanfardino
4 months ago by
Naples (Italy)
mario.zanfardino150 wrote:

I have a MultiAssayExperiment (MAE) with two summarizedExperiment: A and B. B have two assays:  assay_1 and assay_2.

When i transform my MAE in wide format, only rows(features) of first assay (assay_1) of B is pushed in my result.

How can i choose an assay of summarizedExperiment (contained in a MAE) to include in my wide format or subsetting operation?

And, How can i  include all assays of a summarizedExperiment?

Thank you!!

 

 

ADD COMMENTlink modified 4 months ago by Levi Waldron790 • written 4 months ago by mario.zanfardino150
3
gravatar for Levi Waldron
4 months ago by
Levi Waldron790
CUNY Graduate School of Public Health and Health Policy, New York, NY
Levi Waldron790 wrote:

The answer to your first question is a little hidden in the longFormat section of ?MultiAssayExperiment-helpers:

longFormat(object, colDataCols = NULL, i = 1L)
wideFormat(object, colDataCols = NULL, check.names = TRUE, collapse = "_", i = 1L)

longFormat

The longFormat method takes data from the ExperimentList in a MultiAssayExperiment and returns a uniform DataFrame. The resulting DataFrame has columns indicating primary, rowname, colname and value. This method can optionally include colData columns with the colDataCols argument (MultiAssayExperiment method only). The ... argument allows the user to specify the assay value for the SummarizedExperiment assay function's i argument.

So you can specify the SummarizedExperiment assay function's i argument, but it will be the same i across all SummarizedExperiments. For example:

> example("MultiAssayExperiment")
> mae <- myMultiAssayExperiment[, , c(1, 4)]
> assay(mae[[1]], 2) <- log2(assay(mae[[1]], 1))
> assay(mae[[2]], 2) <- log2(assay(mae[[2]], 1))
> head(wideFormat(mae), 1)
DataFrame with 1 row and 11 columns
      primary Affy_ENST00000234812 Affy_ENST00000294241
  <character>            <numeric>            <numeric>
1        Jack                  104                  101
  Affy_ENST00000355076 Affy_ENST00000383323 Affy_ENST00000383706
             <numeric>            <numeric>            <numeric>
1                  102                  105                  103
  GISTIC_GENEa GISTIC_GENEb GISTIC_GENEc GISTIC_GENEd GISTIC_GENEe
     <numeric>    <numeric>    <numeric>    <numeric>    <numeric>
1            1            1            1            0            0
> head(wideFormat(mae, i=2), 1)
DataFrame with 1 row and 11 columns
      primary Affy_ENST00000234812 Affy_ENST00000294241
  <character>            <numeric>            <numeric>
1        Jack     6.70043971814109     6.65821148275179
  Affy_ENST00000355076 Affy_ENST00000383323 Affy_ENST00000383706
             <numeric>            <numeric>            <numeric>
1      6.6724253419715     6.71424551766612     6.68650052718322
  GISTIC_GENEa GISTIC_GENEb GISTIC_GENEc GISTIC_GENEd GISTIC_GENEe
     <numeric>    <numeric>    <numeric>    <numeric>    <numeric>
1            0            0            0         -Inf         -Inf
>

As for your second question, the answer is that if you want both assays extracted by wideFormat, you'll have to split them into different MAE elements, like this hack-ish example:

> se <- mae[[1]]
> assay(se) <- assay(se, 2)
> mae2 <- c(mae, log2affy=se)
> head(wideFormat(mae2), 1)
DataFrame with 1 row and 16 columns
      primary Affy_ENST00000234812 Affy_ENST00000294241
  <character>            <numeric>            <numeric>
1        Jack                  104                  101
  Affy_ENST00000355076 Affy_ENST00000383323 Affy_ENST00000383706
             <numeric>            <numeric>            <numeric>
1                  102                  105                  103
  GISTIC_GENEa GISTIC_GENEb GISTIC_GENEc GISTIC_GENEd GISTIC_GENEe
     <numeric>    <numeric>    <numeric>    <numeric>    <numeric>
1            1            1            1            0            0
  log2affy_ENST00000234812 log2affy_ENST00000294241
                 <numeric>                <numeric>
1         6.70043971814109         6.65821148275179
  log2affy_ENST00000355076 log2affy_ENST00000383323
                 <numeric>                <numeric>
1          6.6724253419715         6.71424551766612
  log2affy_ENST00000383706
                 <numeric>
1         6.68650052718322
>
ADD COMMENTlink modified 4 months ago • written 4 months ago by Levi Waldron790
1

Thank you very much Levi!

ADD REPLYlink written 4 months ago by mario.zanfardino150
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 2.2.0
Traffic: 121 users visited in the last hour