View source: R/evaluation_metrics.R
gene_module_score | R Documentation |
Metric based on gene module eigen gene correlation
gene_module_score(
x,
module_eigs,
module_cor_threshold = 0.3,
module_nan.substitute = 0,
...
)
x |
A |
module_eigs |
Gene module eigen-genes for each sample (samples x modules). |
module_cor_threshold |
Threshold for counting correlations. |
module_nan.substitute |
Substituted value when dividing by zero when there are no correlated clusters for a module. |
... |
Extra arguments are ignored. |
library(COPS)
# Generate module eigen genes with WGCNA
gene_correlation <- cor(t(ad_ge_micro_zscore), method = "spearman")
adj <- abs(gene_correlation)^2
TOM <- unsigned_TOM_matrix(adj)
geneTree <- flashClust::flashClust(as.dist(1 - TOM), method="average")
dynamicMods <- dynamicTreeCut::cutreeDynamic(
dendro = geneTree,
method="tree",
minClusterSize = 20
)
MEs <- gene_module_eigengenes(
ad_ge_micro_zscore[dynamicMods != 0,],
dynamicMods[dynamicMods != 0]
)
# Compute the module score for a given clustering result
clust <- cutree(
hclust(
as.dist(1-cor(ad_ge_micro_zscore, method = "spearman")),
method = "average"
),
k = 3
)
clust <- data.frame(id = names(clust), cluster = clust)
score <- gene_module_score(clust, MEs)
# Within full pipeline
res <- COPS(ad_ge_micro_zscore,
association_data = ad_studies,
parallel = 1, nruns = 2, nfolds = 5,
dimred_methods = c("pca", "umap"),
cluster_methods = c("hierarchical", "kmeans"),
distance_metric = "euclidean",
n_clusters = 2:4,
module_eigs = MEs)
scores <- scoring(res, wsum = Silhouette - Module_score, summarise = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.