Get correlation of features with module eigengenes
Source:R/methods-ModularExperiment.R
getCentrality.Rd
Provides a wrapper around signedKME. Provides a measure
of module centrality/connectivity of each feature. Calculates
correlation (Pearson's r) of each feature with the module
eigengene (i.e., the column of reduced
to which the feature belongs).
Usage
# S4 method for class 'ModularExperiment'
getCentrality(object, assay_name = "normal", feature_id_col = "rownames")
Arguments
- object
A ModularExperiment object.
- assay_name
The name of the assay to be used for calculation of module centrality.
- feature_id_col
The column in
rowData(object)
that will be used as a feature ID. Setting this to "rownames" (default) instead usesrownames(object)
.
Value
Returns a data.frame
with columns for feature
,
r
(signed correlation with the eigengene),
rsq
(squared correlation with the eigengene),
rank_r
(feature rank based on r
) and
rank_rsq
(feature rank based on rsq).
Examples
# Create ModularExperiment with random data (100 features, 50 samples,
# 10 modules)
me <- ReducedExperiment:::.createRandomisedModularExperiment(100, 50, 10)
me
#> class: ModularExperiment
#> dim: 100 50 10
#> metadata(0):
#> assays(1): normal
#> rownames(100): gene_1 gene_2 ... gene_99 gene_100
#> rowData names(0):
#> colnames(50): sample_1 sample_2 ... sample_49 sample_50
#> colData names(0):
#> 10 components
# Calculate centrality of each feature for the corresponding module
head(getCentrality(me))
#> module feature r rsq rank_r rank_rsq
#> 3 module_1 gene_51 0.17435025 0.0303980100 1 1
#> 4 module_1 gene_77 0.14359344 0.0206190769 2 2
#> 1 module_1 gene_36 0.07727667 0.0059716830 3 3
#> 2 module_1 gene_40 -0.04470157 0.0019982302 5 4
#> 5 module_1 gene_88 0.03057389 0.0009347626 4 5
#> 100 module_10 gene_85 0.33963050 0.1153488784 1 1