SummarizedExperiment2MultiBlock: SummarizedExperiment2MultiBlock

View source: R/SummarizedExperiment2MultiBlock.R

SummarizedExperiment2MultiBlockR Documentation

SummarizedExperiment2MultiBlock

Description

Converts a SummarizedExperiment into a MultiBlock. Each assay in the SummarizedExperiment becomes one block (rows = samples, columns = features).

Usage

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

Arguments

se

A SummarizedExperiment 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. When supplied, the column is extracted from colData, removed from the metadata, and stored in the Batch slot of the MultiBlock. Requires at least one of colData_samplenames or a named colData; an error is raised if the column is not found.

Details

Each assay is transposed so that samples are in rows and features in columns. Sample order is aligned to colData(se) row names; samples not present in colData are removed. If an assay has no name, the block is labelled "X". Metadata from colData (excluding the Batch column if specified) is stored only for the first block; subsequent assays are appended as additional blocks with no extra metadata.

Value

A MultiBlock object with one block per assay in se.

See Also

MultiBlock, MultiAssayExperiment2MultiBlock, MultiBlock2MultiAssayExperiment

Examples


if (requireNamespace("SummarizedExperiment", quietly = TRUE)) {
library(SummarizedExperiment)
nrows <- 20; ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rownames(counts) <- paste0("feature", seq_len(nrows))
colnames(counts) <- paste0("sample",  seq_len(ncols))
se <- SummarizedExperiment(assays = list(counts = counts))
mb <- SummarizedExperiment2MultiBlock(se)
}


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