@@ -127,7 +127,7 @@ to visualize ecological differences between the clusters.
127127library(dendextend)
128128
129129# Get hclust data from metadata
130- hclust_data <- metadata(altExp(tse, "prevalent"))$clusters $hclust
130+ hclust_data <- metadata(altExp(tse, "prevalent"))$clustering $hclust
131131
132132# Get the dendrogram object
133133dendro <- as.dendrogram(hclust_data)
@@ -430,7 +430,7 @@ tse <- addCluster(
430430 assay.type = "standardize", HclustParam(method = "complete"),
431431 full = TRUE
432432)
433- taxa_hclust <- metadata(tse)[["clusters "]][["hclust"]]
433+ taxa_hclust <- metadata(tse)[["clustering "]][["hclust"]]
434434
435435# Creates a tree
436436taxa_tree <- as.phylo(taxa_hclust)
@@ -493,15 +493,15 @@ Now we can create a heatmap with additional annotations.
493493
494494# Order the data based on clusters
495495tse <- tse[
496- order(rowData(tse)[["clusters "]]),
497- order(colData(tse)[["clusters "]])
496+ order(rowData(tse)[["cluster "]]),
497+ order(colData(tse)[["cluster "]])
498498]
499499
500500# Get data for plotting
501501mat <- assay(tse, "standardize")
502- taxa_clusters <- rowData(tse)[, "clusters ", drop = FALSE] |>
502+ taxa_clusters <- rowData(tse)[, "cluster ", drop = FALSE] |>
503503 as.data.frame()
504- sample_data <- colData(tse)[, c("clusters ", "Gender"), drop = FALSE] |>
504+ sample_data <- colData(tse)[, c("cluster ", "Gender"), drop = FALSE] |>
505505 as.data.frame()
506506colnames(sample_data) <- c("clusters_col", "gender")
507507
0 commit comments