prepMultiAssay {MultiAssayExperiment} | R Documentation

## Prepare a `MultiAssayExperiment` instance

### Description

The purpose of this helper function is to faciltate the creation of a `MultiAssayExperiment` object by detecting any inconsistencies with all types of names in either the `ExperimentList`, the `colData`, or `sampleMap`.

### Usage

    prepMultiAssay(ExperimentList, colData, sampleMap, ...)

### Arguments

`ExperimentList` | A `list` of all combined experiments
`colData` | A DataFrame of the phenotype data for all participants
`sampleMap` | A DataFrame of sample identifiers, assay samples, and assay names
`...` | Optional arguments for the `MultiAssayExperiment` constructor function such as `metadata` and `drops`.

### Value

A `list` containing all the essential components of a `MultiAssayExperiment` as well as a "drops" metadata element that indicates non-matched names. The names of the resulting list correspond to the arguments of the `MultiAssayExperiment` constructor function.

### Checks

The `prepMultiAssay` function checks that all columns in the sampleMap are `character`.

It checks that all names and lengths match in both the `ExperimentList` and in the unique assay names of the `sampleMap`.

If `ExperimentList` names and assay names only differ by case and are not duplicated, the function will standardize all names to lowercase.

If names cannot be matched between the colname column of the `sampleMap` and the colnames of the `ExperimentList`, those unmatched will be dropped and found in the "drops" element of the resulting `list`.

Names in the "primary" column of the `sampleMap`, will be matched to those in the `colData`. Unmatched "primary" column rows will be dropped from the `sampleMap`. Suggestions for name fixes in either the `ExperimentList` or colnames will be made when necessary.

### Examples

    ## Run example
    example("MultiAssayExperiment")

    ## Check if there are any inconsistencies within the different names
    preparedMAE <- prepMultiAssay(ExpList, colDat, mySampleMap)

    ## Results in a list of components for the MultiAssayExperiment constructor
    ## function
    MultiAssayExperiment(preparedMAE$experiments, preparedMAE$colData,
    preparedMAE$sampleMap)

    ## Alternatively, use the do.call function
    do.call(MultiAssayExperiment, preparedMAE)

[Package MultiAssayExperiment version 1.6.0 Index]