Get names of dimensionally-reduced components
Source:R/methods-FactorisedExperiment.R
, R/methods-ModularExperiment.R
, R/methods-ReducedExperiment.R
component_names.Rd
Retrieves the feature names post-dimensionality reduction In the case of module analysis, these are the names of the gene modules; in the case of factor analysis, these are the names of the factors.
Usage
# S4 method for class 'FactorisedExperiment'
componentNames(object) <- value
# S4 method for class 'ModularExperiment'
componentNames(object) <- value
# S4 method for class 'ModularExperiment'
moduleNames(object)
# S4 method for class 'ModularExperiment'
moduleNames(object) <- value
# S4 method for class 'ReducedExperiment'
componentNames(object)
# S4 method for class 'ReducedExperiment'
componentNames(object) <- value
Arguments
- object
A ReducedExperiment object.
- value
New value to replace existing names.
Details
componentNames
is valid for all ReducedExperiment
objects, whereas moduleNames
is only valid for
ModularExperiments.
Examples
# Create randomised data with the following dimensions
i <- 300 # Number of features
j <- 100 # Number of samples
k <- 10 # Number of factors
rand_assay_data <- ReducedExperiment:::.makeRandomData(i, j, "gene", "sample")
rand_reduced_data <- ReducedExperiment:::.makeRandomData(j, k, "sample", "component")
re <- ReducedExperiment(
assays = list("normal" = rand_assay_data),
reduced = rand_reduced_data
)
stopifnot(all.equal(componentNames(re), colnames(rand_reduced_data)))
print(paste0("Component name at [2]: ", componentNames(re)[2]))
#> [1] "Component name at [2]: component_2"
componentNames(re)[2] <- "custom_component_name"
print(paste0("Component name at [2]: ", componentNames(re)[2]))
#> [1] "Component name at [2]: custom_component_name"