Skip to contents

Generates a heatmap of sample clustering results and summarizes sample group assignments.

Usage

plot_sample_clusters(expomicset, exposure_cols = NULL)

Arguments

expomicset

A MultiAssayExperiment object containing sample clustering results in metadata(expomicset)$sample_clustering.

exposure_cols

A character vector specifying columns from colData to include in the summary. Default is NULL, which includes all available columns.

Value

A ComplexHeatmap plot displaying sample clustering results.

Details

This function:

  • Extracts sample cluster assignments from metadata(expomicset)$sample_clustering.

  • Merges cluster labels with colData(expomicset).

  • Plots the heatmap stored in metadata(expomicset)$sample_clustering$heatmap.

Examples

# create example data
mae <- make_example_data(
    n_samples = 30,
    return_mae = TRUE
)
#> Ensuring all omics datasets are matrices with column names.
#> Creating SummarizedExperiment objects.
#> Creating MultiAssayExperiment object.
#> MultiAssayExperiment created successfully.

# determine sample clusters
mae <- run_cluster_samples(
    expomicset = mae,
    exposure_cols = c("exposure_pm25", "exposure_no2", "age", "bmi"),
    clustering_approach = "diana"
)
#> Starting clustering analysis...
#> Optimal number of clusters for samples: 12

# plot sample clusters
sample_cluster_p <- mae |>
    plot_sample_clusters(
        exposure_cols = c("exposure_pm25", "exposure_no2", "age", "bmi")
    )