View source: R/layer_stat_cor_plot.R
layer_stat_cor_plot | R Documentation |
This function makes a ComplexHeatmap from the correlation matrix
between a reference and query modeling statistics from layer_stat_cor()
.
For example, between the query statistics from a set of cell cluster/types
derived from scRNA-seq or snRNA-seq data (among other types) and the
reference layer statistics from the Human DLPFC Visium data (when using the
default arguments).
layer_stat_cor_plot(
cor_stats_layer,
color_max = max(cor_stats_layer),
color_min = min(cor_stats_layer),
color_scale = c("#762A83", "#F7F7F7", "#1B7837"),
query_colors = NULL,
reference_colors = NULL,
annotation = NULL,
...
)
cor_stats_layer |
The output of |
color_max |
A |
color_min |
A |
color_scale |
A |
query_colors |
named |
reference_colors |
named |
annotation |
annotation data.frame output of
|
... |
Additional parameters passed to
|
Includes functionality to add color annotations,
(helpful to match to colors in Visium spot plots), and annotations from
annotate_registered_clusters()
.
(Heatmap-class) plot of t-stat correlations
Louise Huuki-Myers
Other Layer correlation functions:
annotate_registered_clusters()
,
layer_stat_cor()
## Obtain the necessary data
## reference human pilot modeling results
if (!exists("modeling_results")) {
modeling_results <- fetch_data(type = "modeling_results")
}
## query spatialDLPFC modeling results
query_modeling_results <- fetch_data(
type = "spatialDLPFC_Visium_modeling_results"
)
## Compute the correlations
cor_stats_layer <- layer_stat_cor(
stats = query_modeling_results$enrichment,
modeling_results,
model_type = "enrichment"
)
## Visualize the correlation matrix
## Default plot with no annotations and defaults for ComplexHeatmap()
layer_stat_cor_plot(cor_stats_layer)
## add colors
## add libd_layer_colors to reference Human Pilot layers
layer_stat_cor_plot(cor_stats_layer, reference_colors = libd_layer_colors)
## obtain colors for the query clusters
cluster_colors <- get_colors(clusters = rownames(cor_stats_layer))
layer_stat_cor_plot(cor_stats_layer,
query_colors = cluster_colors,
reference_colors = libd_layer_colors
)
## Apply additional ComplexHeatmap param
layer_stat_cor_plot(cor_stats_layer,
cluster_rows = FALSE,
cluster_columns = FALSE
)
## Add annotation
annotation_df <- annotate_registered_clusters(
cor_stats_layer,
confidence_threshold = .55
)
layer_stat_cor_plot(cor_stats_layer, annotation = annotation_df)
## All together
layer_stat_cor_plot(
cor_stats_layer,
query_colors = cluster_colors,
reference_colors = libd_layer_colors,
annotation = annotation_df,
cluster_rows = FALSE,
cluster_columns = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.