-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathlayer_stat_cor_plot.Rd
136 lines (118 loc) · 4.28 KB
/
layer_stat_cor_plot.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layer_stat_cor_plot.R
\name{layer_stat_cor_plot}
\alias{layer_stat_cor_plot}
\title{Visualize the correlation of layer modeling t-statistics with ComplexHeatmap}
\usage{
layer_stat_cor_plot(
cor_stats_layer,
color_max = max(cor_stats_layer),
color_min = min(cor_stats_layer),
color_scale = RColorBrewer::brewer.pal(7, "PRGn"),
query_colors = NULL,
reference_colors = NULL,
annotation = NULL,
...
)
}
\arguments{
\item{cor_stats_layer}{The output of \code{\link[=layer_stat_cor]{layer_stat_cor()}}.}
\item{color_max}{A \code{numeric(1)} specifying the highest correlation value for
the color scale (should be between 0 and 1).}
\item{color_min}{A \code{numeric(1)} specifying the lowest correlation value for
the color scale (should be between 0 and -1).}
\item{color_scale}{A \code{character} vector with three or more values specifying
the color scale for the fill of the heatmap. The first value is used for
\code{color_min}, the middle for zero, and the last for \code{color_max}. If an even
number of colors are supplied, the last color is dropped to center zero.}
\item{query_colors}{named \code{character} vector of colors, Adds colors to query
row annotations.}
\item{reference_colors}{named \code{character} vector of colors, Adds colors to
reference column annotations.}
\item{annotation}{annotation data.frame output of
\code{\link[=annotate_registered_clusters]{annotate_registered_clusters()}}, adds 'X' for good confidence annotations,
'*' for poor confidence.}
\item{...}{Additional parameters passed to
\code{\link[ComplexHeatmap:Heatmap]{ComplexHeatmap::Heatmap()}} such as \code{cluster_rows}
and \code{cluster_columns}.}
}
\value{
(\link[ComplexHeatmap:Heatmap-class]{Heatmap-class}) plot of t-stat
correlations
}
\description{
This function makes a ComplexHeatmap from the correlation matrix
between a reference and query modeling statistics from \code{\link[=layer_stat_cor]{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).
}
\details{
Includes functionality to add color annotations,
(helpful to match to colors in Visium spot plots), and annotations from
\code{\link[=annotate_registered_clusters]{annotate_registered_clusters()}}.
}
\examples{
## 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 Annotation 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)
## change fill color scale
layer_stat_cor_plot(cor_stats_layer,
color_scale = RColorBrewer::brewer.pal(2, "PiYG")
)
## All together
layer_stat_cor_plot(
cor_stats_layer,
color_scale = RColorBrewer::brewer.pal(5, "PiYG"),
query_colors = cluster_colors,
reference_colors = libd_layer_colors,
annotation = annotation_df,
cluster_rows = FALSE,
cluster_columns = FALSE
)
}
\seealso{
Other Layer correlation functions:
\code{\link{annotate_registered_clusters}()},
\code{\link{layer_stat_cor}()}
}
\author{
Louise Huuki-Myers
}
\concept{Layer correlation functions}