MultiAssayExperiment2MultiBlock: MultiAssayExperiment2MultiBlock

View source: R/MultiAssayExperiment2MultiBlock.R

MultiAssayExperiment2MultiBlockR Documentation

MultiAssayExperiment2MultiBlock

Description

Converts a MultiAssayExperiment into a MultiBlock. Samples are first intersected across all experiments so that only common samples are retained.

Usage

MultiAssayExperiment2MultiBlock(se, colData_samplenames = NULL, Batch = NULL)

Arguments

se

A MultiAssayExperiment object.

colData_samplenames

Character string giving the name of the column in colData(se) that holds the sample names used for matching. When NULL, colData metadata is not stored in the resulting MultiBlock.

Batch

Character string giving the name of the column in colData(se) to use as the Batch variable. Requires colData_samplenames to be set; an error is raised if Batch is supplied but colData_samplenames is NULL or the column is not found in colData.

Details

Columns (samples) are intersected across all experiments via intersectColumns before conversion. Each experiment in the MultiAssayExperiment becomes one block in the MultiBlock (rows = samples, columns = features). Sample names are taken from the colData row names of se. Metadata from colData is stored only for the first block; subsequent blocks share the same sample order but carry no additional metadata. If Batch is specified, the corresponding column is extracted from colData, removed from the metadata, and stored as the Batch slot of the MultiBlock.

Value

A MultiBlock object with one block per experiment in se.

See Also

MultiBlock, MultiBlock2MultiAssayExperiment

Examples


if (requireNamespace("MultiAssayExperiment", quietly = TRUE)) {
library(MultiAssayExperiment)
mae <- MultiAssayExperiment(
  experiments = ExperimentList(
    block1 = matrix(rnorm(50), nrow = 5, dimnames = list(paste0("s", 1:5), paste0("v", 1:10))),
    block2 = matrix(rnorm(30), nrow = 5, dimnames = list(paste0("s", 1:5), paste0("w", 1:6)))
  )
)
mb <- MultiAssayExperiment2MultiBlock(mae)
}


R.ComDim documentation built on May 13, 2026, 9:07 a.m.