MultiAssayExperiment wideformat operations
1
0
Entering edit mode
@mariozanfardino-15232
Last seen 4.3 years ago
Naples (Italy)

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!!

 

 

multiassayexperiment summarizedexperiment wide format • 1.4k views
ADD COMMENT
3
Entering edit mode
Levi Waldron ★ 1.1k
@levi-waldron-3429
Last seen 5 days ago
CUNY Graduate School of Public Health a…

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 COMMENT
1
Entering edit mode

Thank you very much Levi!

ADD REPLY

Login before adding your answer.

Traffic: 694 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