Aggregates one or more dimensionality reduction results (e.g., PCA/UMAP) computed on a common set of samples.

mesaDimRed(res, sampleTable, params, dataTable = data.frame())

# S4 method for class 'mesaDimRed'
show(object)

Arguments

res

list Dimensionality reduction result objects. Default: none. res must be supplied.

sampleTable

data.frame Sample annotations, with the sample IDs in a sample_name column. Default: none.

params

list Parameters used to compute res. Default: none.

dataTable

data.frame Optional numeric matrix/data used for the dimensionality reduction. Default: data.frame().

object

mesaDimRed

Value

A mesaDimRed object:

  • stores dimensionality reduction results in res,

  • carries sample metadata in sampleTable,

  • and persists parameters/data in params / dataTable.

Details

A valid object has res empty, or:

  • res is a named list with unique names;

  • its elements are all mesaPCA or all mesaUMAP objects, matching params$method if set;

  • every element covers the same sample IDs, in the same order, with no duplicates;

  • each sample ID is a value of sampleTable$sample_name (of sampleTable$group when params$useGroupMeans is TRUE);

  • each sample ID is a column of dataTable, when it has columns.

Slots

res

list Individual dimensionality reduction result objects (e.g., mesaPCA, mesaUMAP).

The sample IDs of the results are the row names of each element of res (prcomp$x for mesaPCA, points for mesaUMAP). With useGroupMeans = TRUE they are sample group names.

sampleTable

data.frame Sample annotations; the sample_name column holds the sample IDs (the row names mirror it, as in a qseaSet).

params

list Parameters used to generate results in res.

dataTable

data.frame Optional matrix/data used to compute the dimensionality reduction (for reproducibility).

Accessors

Read the slots with these functions rather than @:

Examples

set.seed(1)
x <- matrix(rnorm(20), nrow = 5, ncol = 4,
    dimnames = list(paste0("S", 1:5), paste0("W", 1:4)))
st <- data.frame(sample_name = rownames(x),
    group = rep(c("A", "B"), c(3, 2)), row.names = rownames(x))
mp <- mesaPCA(prcomp = stats::prcomp(x), windows = colnames(x))
md <- mesaDimRed(res = list(pca1 = mp), sampleTable = st,
    params = list(method = "PCA"))
md
#> Object containing 1 dimensionality reduction objects for 5 samples
getSampleNames(md)
#> [1] "S1" "S2" "S3" "S4" "S5"