Skip to contents

A container inheriting from the ReducedExperiment class, that contains one or more data matrices, to which module analysis has been applied to identify a reduced set of features. A ModularExperiment can be created directly in a similar manner to a SummarizedExperiment. Alternatively, the identifyModules function can be used to both define modules and generate a ModularExperiment from the results.

Usage

ModularExperiment(
  reduced = new("matrix"),
  scale = TRUE,
  center = TRUE,
  loadings = NULL,
  assignments = character(),
  dendrogram = NULL,
  threshold = NULL,
  ...
)

Arguments

reduced

A matrix, produced by module analysis, with rows representing samples and columns representing module expression profiles. Typically, this matrix contains "eigengenes" produced by the Weighted Gene Correlation Network Analysis (WGCNA) approach, as is applied by identifyModules.

scale

Either a boolean, representing whether or not the original data has been scaled to unit variance, or a numeric vector indicating the standard deviations of the original features (as produced by scale.)

center

Either a boolean, representing whether or not the original data has been centered to have a mean of 0, or a numeric vector indicating the means of the original features (as produced by scale.)

loadings

A numeric vector representing the loadings used to generate module expression profiles. Typically, these values are obtained from the rotation matrix produced by prcomp, which is used to identify the first principal component of each module. The vector names represent features.

assignments

A vector of features, named according to the module to which the feature belongs.

dendrogram

Either NULL, or the dendrogram used to identify modules from the original data.

threshold

Either NULL, or a matrix produced by pickSoftThreshold indicating the parameters used for network construction.

...

Additional arguments to be passed to ReducedExperiment.

Value

Constructor method returns a ModularExperiment object.

Author

Jack Gisby

Examples

# Create randomised data with the following dimensions
i <- 300 # Number of features
j <- 100 # Number of samples
k <- 10 # Number of modules

# In this case we use random assay data and reduced data (i.e., module
# eigengenes). We also randomly assign each feature to a module. In practice,
# we would identify modules and eigengenes using a method like WGCNA applied
# to the analysis of assay data (e.g., gene expression data) from some study.
rand_assay_data <- ReducedExperiment:::.makeRandomData(i, j, "gene", "sample")
rand_reduced_data <- ReducedExperiment:::.makeRandomData(j, k, "sample", "module")
rand_assignments <- paste0("gene_", seq_len(i))
names(rand_assignments) <- paste0("module_", round(stats::runif(i, 1, k), 0))

me <- ModularExperiment(
    assays = list("normal" = rand_assay_data),
    reduced = rand_reduced_data,
    assignments = rand_assignments
)

me
#> class: ModularExperiment 
#> dim: 300 100 10 
#> metadata(0):
#> assays(1): normal
#> rownames(300): gene_1 gene_2 ... gene_299 gene_300
#> rowData names(0):
#> colnames(100): sample_1 sample_2 ... sample_99 sample_100
#> colData names(0):
#> 10 components