Browse code

7: Test plot functions with `vdiffr` (#136)

Daniel Sabanes Bove authored on 25/10/2021 11:49:16 • GitHub committed on 25/10/2021 11:49:16
Showing1 changed files
... ...
@@ -1,6 +1,8 @@
1 1
 #' @include HermesData-methods.R
2 2
 NULL
3 3
 
4
+# correlate-AnyHermesData ----
5
+
4 6
 #' Correlation between Sample Counts of `AnyHermesData`
5 7
 #'
6 8
 #' @description `r lifecycle::badge("experimental")`
... ...
@@ -50,6 +52,8 @@ setMethod(
50 52
   }
51 53
 )
52 54
 
55
+# HermesDataCor ----
56
+
53 57
 #' @rdname calc_cor
54 58
 #' @aliases HermesDataCor
55 59
 #' @exportClass HermesDataCor
... ...
@@ -60,6 +64,8 @@ setMethod(
60 64
   slots = c(flag_data = "DataFrame")
61 65
 )
62 66
 
67
+# autoplot-HermesDataCor ----
68
+
63 69
 #' @describeIn calc_cor This `autoplot()` method uses the [ComplexHeatmap::Heatmap()] function
64 70
 #'   to plot the correlations between samples saved in a [`HermesDataCor`] object.
65 71
 #'
... ...
@@ -94,12 +100,12 @@ setMethod(
94 100
                         ...) {
95 101
     df <- object@flag_data
96 102
     left_annotation <- ComplexHeatmap::rowAnnotation(
97
-      low_depth_flag = factor(df$low_depth_flag),
98
-      col = list(low_depth_flag = flag_colors)
103
+      "Low Depth" = factor(df$low_depth_flag),
104
+      col = list("Low Depth" = flag_colors)
99 105
     )
100 106
     top_annotation <- ComplexHeatmap::HeatmapAnnotation(
101
-      tech_failure_flag = factor(df$tech_failure_flag),
102
-      col = list(tech_failure_flag = flag_colors)
107
+      "Technical Failure" = factor(df$tech_failure_flag),
108
+      col = list("Technical Failure" = flag_colors)
103 109
     )
104 110
     mat <- as(object, "matrix")
105 111
     ComplexHeatmap::Heatmap(
Browse code

31 change names to standardised specs@main (#63)

Co-authored-by: Daniel Sabanes Bove <danielinteractive@users.noreply.github.com>
Co-authored-by: Pawel Rucki <pawel.rucki@roche.com>
Co-authored-by: dinakar29 <26552821+dinakar29@users.noreply.github.com>
Co-authored-by: Daniel Sabanes Bove <daniel.sabanes_bove@roche.com>
Co-authored-by: benoit <benoit.falquet@roche.com>
Co-authored-by: Stefanie Bienert <75780729+bienerts@users.noreply.github.com>
Co-authored-by: colinisstudent <87772156+colinisstudent@users.noreply.github.com>
Co-authored-by: Konrad Pagacz <konrad.pagacz@contractors.roche.com>
Co-authored-by: Insights Engineering Bot <68416928+insights-engineering-bot@users.noreply.github.com>
Co-authored-by: Nikolas Burkoff <nikolas.burkoff@roche.com>
Co-authored-by: b_falquet <64274616+BFalquet@users.noreply.github.com>
Co-authored-by: arkadiuszbeer <86738093+arkadiuszbeer@users.noreply.github.com>

Tim Treis authored on 16/09/2021 13:05:42 • GitHub committed on 16/09/2021 13:05:42
Showing1 changed files
... ...
@@ -8,7 +8,7 @@ NULL
8 8
 #' The `correlate()` method can calculate the correlation matrix between the sample vectors of
9 9
 #' counts from a specified assay. This produces a [`HermesDataCor`] object, which is an extension
10 10
 #' of a [`matrix`] with additional quality flags in the slot `flag_data`
11
-#' (containing the `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original
11
+#' (containing the `tech_failure_flag` and `low_depth_flag` columns describing the original
12 12
 #' input samples).
13 13
 #'
14 14
 #' An `autoplot()` method then afterwards can produce the corresponding heatmap.
... ...
@@ -25,7 +25,7 @@ NULL
25 25
 #' @export
26 26
 #'
27 27
 #' @examples
28
-#' object <- HermesData(summarized_experiment)
28
+#' object <- hermes_data
29 29
 #'
30 30
 #' # Calculate the sample correlation matrix.
31 31
 #' correlate(object)
... ...
@@ -45,7 +45,7 @@ setMethod(
45 45
 
46 46
     .HermesDataCor(
47 47
       sample_cor_matrix,
48
-      flag_data = colData(object)[, c("TechnicalFailureFlag", "LowDepthFlag")]
48
+      flag_data = colData(object)[, c("tech_failure_flag", "low_depth_flag")]
49 49
     )
50 50
   }
51 51
 )
... ...
@@ -94,12 +94,12 @@ setMethod(
94 94
                         ...) {
95 95
     df <- object@flag_data
96 96
     left_annotation <- ComplexHeatmap::rowAnnotation(
97
-      LowDepthFlag = factor(df$LowDepthFlag),
98
-      col = list(LowDepthFlag = flag_colors)
97
+      low_depth_flag = factor(df$low_depth_flag),
98
+      col = list(low_depth_flag = flag_colors)
99 99
     )
100 100
     top_annotation <- ComplexHeatmap::HeatmapAnnotation(
101
-      TechnicalFailureFlag = factor(df$TechnicalFailureFlag),
102
-      col = list(TechnicalFailureFlag = flag_colors)
101
+      tech_failure_flag = factor(df$tech_failure_flag),
102
+      col = list(tech_failure_flag = flag_colors)
103 103
     )
104 104
     mat <- as(object, "matrix")
105 105
     ComplexHeatmap::Heatmap(
Browse code

Merge branch 'main' into 14_autoplot_warning

Daniel Sabanes Bove authored on 10/08/2021 13:37:31
Showing0 changed files
Browse code

resolve warnings with explicit matrix coercion

Daniel Sabanes Bove authored on 10/08/2021 13:37:16
Showing1 changed files
... ...
@@ -105,8 +105,9 @@ setMethod(
105 105
       TechnicalFailureFlag = factor(df$TechnicalFailureFlag),
106 106
       col = list(TechnicalFailureFlag = flag_colors)
107 107
     )
108
+    mat <- as(object, "matrix")
108 109
     ComplexHeatmap::Heatmap(
109
-      matrix = object,
110
+      matrix = mat,
110 111
       col = cor_colors,
111 112
       name = "Correlation",
112 113
       left_annotation = left_annotation,
Browse code

more progress

Daniel Sabanes Bove authored on 09/08/2021 18:01:04
Showing1 changed files
... ...
@@ -22,8 +22,6 @@ NULL
22 22
 #'
23 23
 #' @return A [`HermesDataCor`] object.
24 24
 #'
25
-#' @importFrom stats cor
26
-#'
27 25
 #' @export
28 26
 #'
29 27
 #' @examples
... ...
@@ -71,8 +69,6 @@ setMethod(
71 69
 #'   produced by [circlize::colorRamp2()].
72 70
 #' @param ... other arguments to be passed to [ComplexHeatmap::Heatmap()].
73 71
 #'
74
-#' @importFrom ComplexHeatmap rowAnnotation HeatmapAnnotation Heatmap
75
-#' @importFrom circlize colorRamp2
76 72
 #' @export
77 73
 #'
78 74
 #' @examples
Browse code

141: Polish documentation of hermes. (#176)

Sabanes Bove, Daniel {MDBR~Basel} authored on 01/07/2021 07:33:51 • GitHub Enterprise committed on 01/07/2021 07:33:51
Showing1 changed files
... ...
@@ -5,16 +5,19 @@ NULL
5 5
 #'
6 6
 #' @description `r lifecycle::badge("experimental")`
7 7
 #'
8
-#' This calculates the correlation matrix between the sample vectors of counts from
9
-#' a specified assay, as a [`HermesDataCor`] object which is an extension of a [`matrix`] with
10
-#' additional quality flags in the slot `flag_data`: This contains the
11
-#' `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original input samples.
8
+#' The `correlate()` method can calculate the correlation matrix between the sample vectors of
9
+#' counts from a specified assay. This produces a [`HermesDataCor`] object, which is an extension
10
+#' of a [`matrix`] with additional quality flags in the slot `flag_data`
11
+#' (containing the `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original
12
+#' input samples).
13
+#'
14
+#' An `autoplot()` method then afterwards can produce the corresponding heatmap.
12 15
 #'
13 16
 #' @rdname calc_cor
14 17
 #' @aliases calc_cor
15 18
 #'
16 19
 #' @param object (`AnyHermesData`)\cr object to calculate the correlation.
17
-#' @param assay_name (`string`)\cr the assay name where the counts are located in.
20
+#' @param assay_name (`string`)\cr the name of the assay to use.
18 21
 #' @param method (`string`)\cr the correlation method, see [stats::cor()] for details.
19 22
 #'
20 23
 #' @return A [`HermesDataCor`] object.
... ...
@@ -25,8 +28,12 @@ NULL
25 28
 #'
26 29
 #' @examples
27 30
 #' object <- HermesData(summarized_experiment)
31
+#'
32
+#' # Calculate the sample correlation matrix.
28 33
 #' correlate(object)
29
-#' result <- correlate(object, method = "pearson")
34
+#'
35
+#' # We can specify another correlation coefficient to be calculated.
36
+#' result <- correlate(object, method = "spearman")
30 37
 setMethod(
31 38
   f = "correlate",
32 39
   signature = "AnyHermesData",
... ...
@@ -55,7 +62,7 @@ setMethod(
55 62
   slots = c(flag_data = "DataFrame")
56 63
 )
57 64
 
58
-#' @describeIn calc_cor This plot method uses the [ComplexHeatmap::Heatmap()] function
65
+#' @describeIn calc_cor This `autoplot()` method uses the [ComplexHeatmap::Heatmap()] function
59 66
 #'   to plot the correlations between samples saved in a [`HermesDataCor`] object.
60 67
 #'
61 68
 #' @param flag_colors (named `character`)\cr a vector that specifies the colors for `TRUE` and `FALSE`
... ...
@@ -69,8 +76,19 @@ setMethod(
69 76
 #' @export
70 77
 #'
71 78
 #' @examples
79
+#'
80
+#' # Plot the correlation matrix.
72 81
 #' autoplot(result)
82
+#'
83
+#' # We can customize the heatmap.
73 84
 #' autoplot(result, show_column_names = FALSE, show_row_names = FALSE)
85
+#'
86
+#' # Including changing the axis label text size.
87
+#' autoplot(
88
+#'   result,
89
+#'   row_names_gp = grid::gpar(fontsize = 8),
90
+#'   column_names_gp = grid::gpar(fontsize = 8)
91
+#' )
74 92
 setMethod(
75 93
   f = "autoplot",
76 94
   signature = c(object = "HermesDataCor"),
Browse code

136: Add alternative annotation functionality via BiomaRt (#169)

Sabanes Bove, Daniel {MDBR~Basel} authored on 29/06/2021 20:51:26 • GitHub Enterprise committed on 29/06/2021 20:51:26
Showing1 changed files
... ...
@@ -64,6 +64,8 @@ setMethod(
64 64
 #'   produced by [circlize::colorRamp2()].
65 65
 #' @param ... other arguments to be passed to [ComplexHeatmap::Heatmap()].
66 66
 #'
67
+#' @importFrom ComplexHeatmap rowAnnotation HeatmapAnnotation Heatmap
68
+#' @importFrom circlize colorRamp2
67 69
 #' @export
68 70
 #'
69 71
 #' @examples
Browse code

125: Use lifecycle. (#152)

Sabanes Bove, Daniel {MDBR~Basel} authored on 24/06/2021 09:35:28 • GitHub Enterprise committed on 24/06/2021 09:35:28
Showing1 changed files
... ...
@@ -3,6 +3,8 @@ NULL
3 3
 
4 4
 #' Correlation between Sample Counts of `AnyHermesData`
5 5
 #'
6
+#' @description `r lifecycle::badge("experimental")`
7
+#'
6 8
 #' This calculates the correlation matrix between the sample vectors of counts from
7 9
 #' a specified assay, as a [`HermesDataCor`] object which is an extension of a [`matrix`] with
8 10
 #' additional quality flags in the slot `flag_data`: This contains the
Browse code

align method with generic signature

Daniel Sabanes Bove authored on 16/06/2021 14:07:27
Showing1 changed files
... ...
@@ -30,7 +30,8 @@ setMethod(
30 30
   signature = "AnyHermesData",
31 31
   definition = function(object,
32 32
                         assay_name = "counts",
33
-                        method = "pearson") {
33
+                        method = "pearson",
34
+                        ...) {
34 35
     assert_that(is.string(assay_name))
35 36
     chosen_assay <- assay(object, assay_name)
36 37
     sample_cor_matrix <- stats::cor(chosen_assay, method = method)
Browse code

fix refs to classes

Daniel Sabanes Bove authored on 16/06/2021 14:03:03
Showing1 changed files
... ...
@@ -4,7 +4,7 @@ NULL
4 4
 #' Correlation between Sample Counts of `AnyHermesData`
5 5
 #'
6 6
 #' This calculates the correlation matrix between the sample vectors of counts from
7
-#' a specified assay, as a `[HermesDataCor]` object which is an extension of a `[matrix]` with
7
+#' a specified assay, as a [`HermesDataCor`] object which is an extension of a [`matrix`] with
8 8
 #' additional quality flags in the slot `flag_data`: This contains the
9 9
 #' `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original input samples.
10 10
 #'
... ...
@@ -15,7 +15,7 @@ NULL
15 15
 #' @param assay_name (`string`)\cr the assay name where the counts are located in.
16 16
 #' @param method (`string`)\cr the correlation method, see [stats::cor()] for details.
17 17
 #'
18
-#' @return A `[HermesDataCor]` object.
18
+#' @return A [`HermesDataCor`] object.
19 19
 #'
20 20
 #' @importFrom stats cor
21 21
 #'
... ...
@@ -53,7 +53,7 @@ setMethod(
53 53
 )
54 54
 
55 55
 #' @describeIn calc_cor This plot method uses the [ComplexHeatmap::Heatmap()] function
56
-#'   to plot the correlations between samples saved in a `[HermesDataCor]` object.
56
+#'   to plot the correlations between samples saved in a [`HermesDataCor`] object.
57 57
 #'
58 58
 #' @param flag_colors (named `character`)\cr a vector that specifies the colors for `TRUE` and `FALSE`
59 59
 #'   flag values.
Browse code

fix spellings

Daniel Sabanes Bove authored on 16/06/2021 13:42:03
Showing1 changed files
... ...
@@ -1,10 +1,10 @@
1 1
 #' @include HermesData-methods.R
2 2
 NULL
3 3
 
4
-#' Correlation between Sample Counts of HermesData
4
+#' Correlation between Sample Counts of `AnyHermesData`
5 5
 #'
6 6
 #' This calculates the correlation matrix between the sample vectors of counts from
7
-#' a specified assay, as a [HermesDataCor] object which is an extension of a [matrix] with
7
+#' a specified assay, as a `[HermesDataCor]` object which is an extension of a `[matrix]` with
8 8
 #' additional quality flags in the slot `flag_data`: This contains the
9 9
 #' `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original input samples.
10 10
 #'
... ...
@@ -15,7 +15,7 @@ NULL
15 15
 #' @param assay_name (`string`)\cr the assay name where the counts are located in.
16 16
 #' @param method (`string`)\cr the correlation method, see [stats::cor()] for details.
17 17
 #'
18
-#' @return A [HermesDataCor] object.
18
+#' @return A `[HermesDataCor]` object.
19 19
 #'
20 20
 #' @importFrom stats cor
21 21
 #'
... ...
@@ -53,7 +53,7 @@ setMethod(
53 53
 )
54 54
 
55 55
 #' @describeIn calc_cor This plot method uses the [ComplexHeatmap::Heatmap()] function
56
-#'   to plot the correlations between samples saved in a [HermesDataCor] object.
56
+#'   to plot the correlations between samples saved in a `[HermesDataCor]` object.
57 57
 #'
58 58
 #' @param flag_colors (named `character`)\cr a vector that specifies the colors for `TRUE` and `FALSE`
59 59
 #'   flag values.
Browse code

auto styler

Daniel Sabanes Bove authored on 16/06/2021 13:04:26
Showing1 changed files
... ...
@@ -25,7 +25,6 @@ NULL
25 25
 #' object <- HermesData(summarized_experiment)
26 26
 #' correlate(object)
27 27
 #' result <- correlate(object, method = "pearson")
28
-#'
29 28
 setMethod(
30 29
   f = "correlate",
31 30
   signature = "AnyHermesData",
... ...
@@ -47,7 +46,7 @@ setMethod(
47 46
 #' @aliases HermesDataCor
48 47
 #' @exportClass HermesDataCor
49 48
 #'
50
-.HermesDataCor <- setClass(  #nolint
49
+.HermesDataCor <- setClass( # nolint
51 50
   Class = "HermesDataCor",
52 51
   contains = "matrix",
53 52
   slots = c(flag_data = "DataFrame")
... ...
@@ -67,7 +66,6 @@ setMethod(
67 66
 #' @examples
68 67
 #' autoplot(result)
69 68
 #' autoplot(result, show_column_names = FALSE, show_row_names = FALSE)
70
-#'
71 69
 setMethod(
72 70
   f = "autoplot",
73 71
   signature = c(object = "HermesDataCor"),
Browse code

avoid snake_case lintr error for constructor functions

Daniel Sabanes Bove authored on 16/06/2021 12:57:49
Showing1 changed files
... ...
@@ -47,7 +47,7 @@ setMethod(
47 47
 #' @aliases HermesDataCor
48 48
 #' @exportClass HermesDataCor
49 49
 #'
50
-.HermesDataCor <- setClass(
50
+.HermesDataCor <- setClass(  #nolint
51 51
   Class = "HermesDataCor",
52 52
   contains = "matrix",
53 53
   slots = c(flag_data = "DataFrame")
Browse code

cleanup all files re: trailing whitespace

Daniel Sabanes Bove authored on 16/06/2021 12:50:01
Showing1 changed files
... ...
@@ -2,40 +2,40 @@
2 2
 NULL
3 3
 
4 4
 #' Correlation between Sample Counts of HermesData
5
-#' 
6
-#' This calculates the correlation matrix between the sample vectors of counts from 
5
+#'
6
+#' This calculates the correlation matrix between the sample vectors of counts from
7 7
 #' a specified assay, as a [HermesDataCor] object which is an extension of a [matrix] with
8
-#' additional quality flags in the slot `flag_data`: This contains the 
8
+#' additional quality flags in the slot `flag_data`: This contains the
9 9
 #' `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original input samples.
10
-#' 
10
+#'
11 11
 #' @rdname calc_cor
12 12
 #' @aliases calc_cor
13
-#' 
13
+#'
14 14
 #' @param object (`AnyHermesData`)\cr object to calculate the correlation.
15 15
 #' @param assay_name (`string`)\cr the assay name where the counts are located in.
16 16
 #' @param method (`string`)\cr the correlation method, see [stats::cor()] for details.
17
-#'   
17
+#'
18 18
 #' @return A [HermesDataCor] object.
19
-#' 
19
+#'
20 20
 #' @importFrom stats cor
21
-#' 
21
+#'
22 22
 #' @export
23
-#' 
23
+#'
24 24
 #' @examples
25 25
 #' object <- HermesData(summarized_experiment)
26 26
 #' correlate(object)
27 27
 #' result <- correlate(object, method = "pearson")
28
-#'               
28
+#'
29 29
 setMethod(
30 30
   f = "correlate",
31 31
   signature = "AnyHermesData",
32 32
   definition = function(object,
33
-                        assay_name = "counts", 
33
+                        assay_name = "counts",
34 34
                         method = "pearson") {
35 35
     assert_that(is.string(assay_name))
36 36
     chosen_assay <- assay(object, assay_name)
37 37
     sample_cor_matrix <- stats::cor(chosen_assay, method = method)
38
-    
38
+
39 39
     .HermesDataCor(
40 40
       sample_cor_matrix,
41 41
       flag_data = colData(object)[, c("TechnicalFailureFlag", "LowDepthFlag")]
... ...
@@ -45,8 +45,8 @@ setMethod(
45 45
 
46 46
 #' @rdname calc_cor
47 47
 #' @aliases HermesDataCor
48
-#' @exportClass HermesDataCor 
49
-#' 
48
+#' @exportClass HermesDataCor
49
+#'
50 50
 .HermesDataCor <- setClass(
51 51
   Class = "HermesDataCor",
52 52
   contains = "matrix",
... ...
@@ -55,15 +55,15 @@ setMethod(
55 55
 
56 56
 #' @describeIn calc_cor This plot method uses the [ComplexHeatmap::Heatmap()] function
57 57
 #'   to plot the correlations between samples saved in a [HermesDataCor] object.
58
-#' 
58
+#'
59 59
 #' @param flag_colors (named `character`)\cr a vector that specifies the colors for `TRUE` and `FALSE`
60 60
 #'   flag values.
61
-#' @param cor_colors (`function`)\cr color scale function for the correlation values in the heatmap, 
61
+#' @param cor_colors (`function`)\cr color scale function for the correlation values in the heatmap,
62 62
 #'   produced by [circlize::colorRamp2()].
63 63
 #' @param ... other arguments to be passed to [ComplexHeatmap::Heatmap()].
64
-#'   
64
+#'
65 65
 #' @export
66
-#' 
66
+#'
67 67
 #' @examples
68 68
 #' autoplot(result)
69 69
 #' autoplot(result, show_column_names = FALSE, show_row_names = FALSE)
Browse code

progress

Daniel Sabanes Bove authored on 15/06/2021 13:59:52
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,96 @@
1
+#' @include HermesData-methods.R
2
+NULL
3
+
4
+#' Correlation between Sample Counts of HermesData
5
+#' 
6
+#' This calculates the correlation matrix between the sample vectors of counts from 
7
+#' a specified assay, as a [HermesDataCor] object which is an extension of a [matrix] with
8
+#' additional quality flags in the slot `flag_data`: This contains the 
9
+#' `TechnicalFailureFlag` and `LowDepthFlag` columns describing the original input samples.
10
+#' 
11
+#' @rdname calc_cor
12
+#' @aliases calc_cor
13
+#' 
14
+#' @param object (`AnyHermesData`)\cr object to calculate the correlation.
15
+#' @param assay_name (`string`)\cr the assay name where the counts are located in.
16
+#' @param method (`string`)\cr the correlation method, see [stats::cor()] for details.
17
+#'   
18
+#' @return A [HermesDataCor] object.
19
+#' 
20
+#' @importFrom stats cor
21
+#' 
22
+#' @export
23
+#' 
24
+#' @examples
25
+#' object <- HermesData(summarized_experiment)
26
+#' correlate(object)
27
+#' result <- correlate(object, method = "pearson")
28
+#'               
29
+setMethod(
30
+  f = "correlate",
31
+  signature = "AnyHermesData",
32
+  definition = function(object,
33
+                        assay_name = "counts", 
34
+                        method = "pearson") {
35
+    assert_that(is.string(assay_name))
36
+    chosen_assay <- assay(object, assay_name)
37
+    sample_cor_matrix <- stats::cor(chosen_assay, method = method)
38
+    
39
+    .HermesDataCor(
40
+      sample_cor_matrix,
41
+      flag_data = colData(object)[, c("TechnicalFailureFlag", "LowDepthFlag")]
42
+    )
43
+  }
44
+)
45
+
46
+#' @rdname calc_cor
47
+#' @aliases HermesDataCor
48
+#' @exportClass HermesDataCor 
49
+#' 
50
+.HermesDataCor <- setClass(
51
+  Class = "HermesDataCor",
52
+  contains = "matrix",
53
+  slots = c(flag_data = "DataFrame")
54
+)
55
+
56
+#' @describeIn calc_cor This plot method uses the [ComplexHeatmap::Heatmap()] function
57
+#'   to plot the correlations between samples saved in a [HermesDataCor] object.
58
+#' 
59
+#' @param flag_colors (named `character`)\cr a vector that specifies the colors for `TRUE` and `FALSE`
60
+#'   flag values.
61
+#' @param cor_colors (`function`)\cr color scale function for the correlation values in the heatmap, 
62
+#'   produced by [circlize::colorRamp2()].
63
+#' @param ... other arguments to be passed to [ComplexHeatmap::Heatmap()].
64
+#'   
65
+#' @export
66
+#' 
67
+#' @examples
68
+#' autoplot(result)
69
+#' autoplot(result, show_column_names = FALSE, show_row_names = FALSE)
70
+#'
71
+setMethod(
72
+  f = "autoplot",
73
+  signature = c(object = "HermesDataCor"),
74
+  definition = function(object,
75
+                        flag_colors = c("FALSE" = "green", "TRUE" = "red"),
76
+                        cor_colors = circlize::colorRamp2(c(0, 0.5, 1), c("red", "yellow", "green")),
77
+                        ...) {
78
+    df <- object@flag_data
79
+    left_annotation <- ComplexHeatmap::rowAnnotation(
80
+      LowDepthFlag = factor(df$LowDepthFlag),
81
+      col = list(LowDepthFlag = flag_colors)
82
+    )
83
+    top_annotation <- ComplexHeatmap::HeatmapAnnotation(
84
+      TechnicalFailureFlag = factor(df$TechnicalFailureFlag),
85
+      col = list(TechnicalFailureFlag = flag_colors)
86
+    )
87
+    ComplexHeatmap::Heatmap(
88
+      matrix = object,
89
+      col = cor_colors,
90
+      name = "Correlation",
91
+      left_annotation = left_annotation,
92
+      top_annotation = top_annotation,
93
+      ...
94
+    )
95
+  }
96
+)