You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* plot_heatmap now has parameters baseline_to and scale_to giving control over the ranges of the scales, and parameters show_baseline and show_tree giving control over what parts of the plot are shown.
4
+
5
+
# varistran 1.0.4
6
+
7
+
* Increase robustness of heatmap to missing values.
8
+
* Baseline plot is not shown in heatmap if all zero.
9
+
10
+
# varistran 1.0.3
11
+
12
+
* No code changes. Updated READEME with references and supporting/contributing section.
13
+
14
+
# 1.0.2
15
+
16
+
* Added n parameter to plot_heatmap, to show only the top n rows by span of expression levels.
17
+
* Remove dependency on ggdenro, which is not available in R 3.4.1.
18
+
* Added packages needed for testing to suggested dependencies: biomaRt, DESeq2, NBPSeq
Copy file name to clipboardExpand all lines: R/heatmap.R
+41-30Lines changed: 41 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@
11
11
#'
12
12
#' 3. Branches in the hierarchical clustering are flipped to minimize sharp changes between neighbours, using the seriation package's OLO (Optimal Leaf Ordering) method.
13
13
#'
14
+
#'
14
15
#' @param y A matrix of expression levels, such as a transformed counts matrix as produced by \code{varistran::vst}.
15
16
#' @param cluster_samples Should samples (columns) be clustered?
16
17
#' @param cluster_features Should features (rows) be clustered?
@@ -20,6 +21,10 @@
20
21
#' @param baseline_label Text description of what the baseline is.
21
22
#' @param scale_label Text description of what the heatmap colors represent (after baseline is subtracted).
22
23
#' @param n Show only this many rows. Rows are selected in order of greatest span of expression level.
24
+
#' @param baseline_to If provided, the scale for the row means or baseline will include this value or these values. Use this if there is some meaningful "zero" for your data.
25
+
#' @param scale_to If provided, the heatmap color scale will include this value. Use this to provide consistency of scales between heatmaps (note values larger than scale_to will cause the scale to be extended).
26
+
#' @param show_baseline Show baseline barplot?
27
+
#' @param show_tree Show dendrogram tree(s)? These dendrograms arguably over-interpret the data without adding much of values, so it may be better to hide them.
23
28
#'
24
29
#' @return A grid grob. print()-ing this value will cause it to be displayed.
25
30
#'
@@ -45,26 +50,29 @@ plot_heatmap <- function(
45
50
baseline=NULL,
46
51
baseline_label="row\nmean",
47
52
scale_label="difference from\nrow mean",
48
-
n=Inf) {
53
+
n=Inf,
54
+
baseline_to=NULL,
55
+
scale_to=NULL,
56
+
show_baseline=TRUE,
57
+
show_tree=TRUE) {
49
58
y<- as.matrix(y)
50
-
59
+
51
60
if (is.null(sample_labels) &&!is.null(colnames(y)))
52
61
sample_labels<- colnames(y)
53
-
62
+
54
63
if (is.null(sample_labels))
55
64
sample_labels<- rep("", ncol(y))
56
-
65
+
57
66
sample_labels[is.na(sample_labels)] <-""
58
-
59
-
67
+
60
68
if (is.null(feature_labels) &&!is.null(rownames(y)))
0 commit comments