Browse code

NA plot manual.

Jaehyun Joo authored on 14/12/2021 03:38:49
Showing 17 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+##' FAAH knockout LC/MS data SummarizedExperiment
2
+##'
3
+##' A \linkS4class{SummarizedExperiment} object containing FAAH knockout LC/MS
4
+##' feature data from the \pkg{faahKO} (\code{faahko3} data) created with the
5
+##' \code{xcms::quantify} method.
6
+##'
7
+##' @references
8
+##'
9
+##' Colin A. Smith (2021). faahKO: Saghatelian et al. (2004) FAAH knockout LC/MS
10
+##' data. R package version 1.32.0. http://dx.doi.org/10.1021/bi0480335
11
+##'
12
+##' @examples
13
+##' faahko_se
14
+"faahko_se"
15
+
16
+##' FAAH knockout LC/MS data poplin
17
+##'
18
+##' A \linkS4class{poplin} object containing FAAH knockout LC/MS feature data
19
+##' from the \pkg{faahKO} (\code{faahko3} data) created by coercing the
20
+##' [faahko_se] object.
21
+##'
22
+##' @examples
23
+##' faahko_poplin
24
+"faahko_poplin"
... ...
@@ -21,7 +21,7 @@
21 21
 ##' @param method A imputation method. Default is 'pqn'.
22 22
 ##' @param poplin_in Name of a data matrix to retrieve.
23 23
 ##' @param poplin_out Name of a data matrix to store.
24
-##' @param ... Argument passed to a specific imputation method.
24
+##' @param ... Arguments passed to a specific imputation method.
25 25
 ##' @return A matrix or \linkS4class{poplin} object of the same dimension as
26 26
 ##'   \code{x} containing the imputed intensities.
27 27
 ##' @name poplin_impute
... ...
@@ -64,7 +64,7 @@ setMethod(
64 64
 ##' @param poplin_in Name of a data matrix to retrieve.
65 65
 ##' @param poplin_out Name of a data matrix to store.
66 66
 ##' @param by Imputation by k-nearest features or by k-nearest samples.
67
-##' @param ... Additional argument passed to [VIM::kNN].
67
+##' @param ... Additional arguments passed to [VIM::kNN].
68 68
 ##' @return A matrix or \linkS4class{poplin} object of the same dimension as
69 69
 ##'   \code{x} containing the imputed intensities.
70 70
 ##' @name impute_knn
... ...
@@ -106,7 +106,7 @@ setMethod(
106 106
 ##' @param x A matrix or \linkS4class{poplin} object.
107 107
 ##' @param poplin_in Name of a data matrix to retrieve.
108 108
 ##' @param poplin_out Name of a data matrix to store.
109
-##' @param ... Additional argument passed to [missForest::missForest].
109
+##' @param ... Additional arguments passed to [missForest::missForest].
110 110
 ##' @return A matrix or \linkS4class{poplin} object of the same dimension as
111 111
 ##'   \code{x} containing the imputed intensities.
112 112
 ##' @name impute_randomforest
... ...
@@ -148,7 +148,7 @@ setMethod(
148 148
 ##' @param poplin_in Name of a data matrix to retrieve.
149 149
 ##' @param poplin_out Name of a data matrix to store.
150 150
 ##' @param type A method for performing PCA.
151
-##' @param ... Additional argument passed to [pcaMethods::pca].
151
+##' @param ... Additional arguments passed to [pcaMethods::pca].
152 152
 ##' @return A matrix or \linkS4class{poplin} object of the same dimension as
153 153
 ##'   \code{x} containing the imputed intensities.
154 154
 ##' @name impute_pca
... ...
@@ -359,7 +359,7 @@ setMethod(
359 359
 ##' @param meanSdPlot If \code{TRUE}, the function shows [vsn::meanSdPlot] to
360 360
 ##'   visually verify whether there is a dependence of the standard deviation on
361 361
 ##'   the mean.
362
-##' @param ... Additional argument passed to [vsn::vsnMatrix].
362
+##' @param ... Additional arguments passed to [vsn::vsnMatrix].
363 363
 ##' @return A matrix or \linkS4class{poplin} object of the same dimension as
364 364
 ##'   \code{x} containing the normalized intensities.
365 365
 ##' @name normalize_vsn
... ...
@@ -1,8 +1,32 @@
1
+##' Missing value plot
2
+##'
3
+##' Visualize data for exploring missing value (NA) patterns. All values in a
4
+##' data matrix are recoded (1: missing; 0: non-missing) and visualized by
5
+##' rectangles.
6
+##'
7
+##' @param x A matrix or \linkS4class{poplin} object.
8
+##' @param poplin_in Name of a data matrix to retrieve.
9
+##' @param widths Relative widths of heatmap and dendrogram.
10
+##' @param height Relative height of heatmap and dendrogram.
11
+##' @param grid_gap Gap between cells.
12
+##' @param colors A vector of colors for heatmap.
13
+##' @param hide_colorbar Logical controlling whether the color bar (legend) is
14
+##'   hidden.
15
+##' @param showticklabels A logical vector of length 2 (x-axis, y-axis). If
16
+##'   \code{FALSE}, ticks are removed from the side of the plot.
17
+##' @param row_dend_left Logical controlling whether the row dendrogram is
18
+##'   placed on the left on the plot.
19
+##' @param ... Additional arguments passed to [heatmaply::heatmaply].
20
+##' @return gtable of aligned plot.
21
+##' @name poplin_naplot
22
+NULL
23
+
1 24
 ##' @export
2 25
 poplin_naplot <- function(x, ...) {
3 26
   UseMethod("poplin_naplot")
4 27
 }
5 28
 
29
+##' @rdname poplin_naplot
6 30
 ##' @export
7 31
 ##' @importFrom heatmaply is.na10 heatmaply
8 32
 poplin_naplot.default <- function(x, widths = NULL, heights = NULL,
... ...
@@ -13,14 +37,25 @@ poplin_naplot.default <- function(x, widths = NULL, heights = NULL,
13 37
                  showticklabels = showticklabels,
14 38
                  row_dend_left = row_dend_left,
15 39
                  return_ppxpy = TRUE, plot_method = "ggplot", ...)
16
-  heatmaply:::arrange_plots(plots = p, hide_colorbar = hide_colorbar)
40
+  heatmaply:::arrange_plots(plots = p, widths = widths, heights = heights,
41
+                            hide_colorbar = hide_colorbar,
42
+                            row_dend_left = row_dend_left)
17 43
   ## temporary issue in arrange_plots in hide_colorbar
18 44
   ## .arrange_plots(plots = p, widths = widths, heights = heights,
19 45
   ##                hide_colorbar = hide_colorbar, row_dend_left = row_dend_left)
20 46
 }
21 47
 
48
+##' @rdname poplin_naplot
22 49
 ##' @export
23
-poplin_naplot.poplin <- function(x, poplin_in, ...) {
50
+poplin_naplot.poplin <- function(x, poplin_in, widths = NULL, heights = NULL,
51
+                                 grid_gap = 1, color = viridis::viridis(2),
52
+                                 hide_colorbar = TRUE,
53
+                                 showticklabels = c(TRUE, FALSE),
54
+                                 row_dend_left = FALSE, ...) {
24 55
   m <- .verify_and_extract_input(x, poplin_in)
25
-  poplin_naplot.default(m, ...)
56
+  poplin_naplot.default(m, widths = widths, heigths = heights,
57
+                        grid_gap = grid_gap, color = color,
58
+                        hide_colorbar = hide_colorbar,
59
+                        showticklabels = showticklabels,
60
+                        row_dend_left = row_dend_left, ...)
26 61
 }
... ...
@@ -117,7 +117,7 @@ setMethod(
117 117
 ##' @param normalize if \code{TRUE}, an input matrix is mean-centered and scaled
118 118
 ##'   so that the largest absolute of the centered matrix is equal to unity. See
119 119
 ##'   [Rtsne::normalize_input] for details.
120
-##' @param ... Additional argument passed to [Rtsne::Rtsne].
120
+##' @param ... Additional arguments passed to [Rtsne::Rtsne].
121 121
 ##' @return A poplin.tsne matrix or \linkS4class{poplin} object with the same
122 122
 ##'   number of rows as \code{ncol(x)} containing the dimension reduction
123 123
 ##'   result.
... ...
@@ -161,7 +161,7 @@ setMethod(
161 161
 ##' @param ncomp Output dimensionality.
162 162
 ##' @param center A logical indicating mean-centering prior to PLS-DA.
163 163
 ##' @param scale A logical indicating unit variance scaling prior to PLS-DA.
164
-##' @param ... Additional argument passed to [pls::plsr].
164
+##' @param ... Additional arguments passed to [pls::plsr].
165 165
 ##' @return A poplin.plsda matrix or \linkS4class{poplin} object with the same
166 166
 ##'   number of rows as \code{ncol(x)} containing the dimension reduction
167 167
 ##'   result.
... ...
@@ -5,4 +5,5 @@ library(usethis)
5 5
 
6 6
 data(faahko3)
7 7
 faahko_se <- quantify(faahko3)
8
-use_data(faahko_se, overwrite = TRUE, version = 3)
8
+faahko_poplin <- as(faahko_se, "poplin")
9
+use_data(faahko_se, faahko_poplin, overwrite = TRUE, version = 3)
9 10
new file mode 100644
10 11
Binary files /dev/null and b/data/faahko_poplin.rda differ
11 12
new file mode 100644
... ...
@@ -0,0 +1,21 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/faahko_se.R
3
+\docType{data}
4
+\name{faahko_poplin}
5
+\alias{faahko_poplin}
6
+\title{FAAH knockout LC/MS data poplin}
7
+\format{
8
+An object of class \code{poplin} with 206 rows and 12 columns.
9
+}
10
+\usage{
11
+faahko_poplin
12
+}
13
+\description{
14
+A \linkS4class{poplin} object containing FAAH knockout LC/MS feature data
15
+from the \pkg{faahKO} (\code{faahko3} data) created by coercing the
16
+\link{faahko_se} object.
17
+}
18
+\examples{
19
+faahko_poplin
20
+}
21
+\keyword{datasets}
0 22
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/faahko_se.R
3
+\docType{data}
4
+\name{faahko_se}
5
+\alias{faahko_se}
6
+\title{FAAH knockout LC/MS data SummarizedExperiment}
7
+\format{
8
+An object of class \code{SummarizedExperiment} with 206 rows and 12 columns.
9
+}
10
+\usage{
11
+faahko_se
12
+}
13
+\description{
14
+A \linkS4class{SummarizedExperiment} object containing FAAH knockout LC/MS
15
+feature data from the \pkg{faahKO} (\code{faahko3} data) created with the
16
+\code{xcms::quantify} method.
17
+}
18
+\examples{
19
+faahko_se
20
+}
21
+\references{
22
+Colin A. Smith (2021). faahKO: Saghatelian et al. (2004) FAAH knockout LC/MS
23
+data. R package version 1.32.0. http://dx.doi.org/10.1021/bi0480335
24
+}
25
+\keyword{datasets}
... ...
@@ -14,7 +14,7 @@
14 14
 
15 15
 \item{by}{Imputation by k-nearest features or by k-nearest samples.}
16 16
 
17
-\item{...}{Additional argument passed to \link[VIM:kNN]{VIM::kNN}.}
17
+\item{...}{Additional arguments passed to \link[VIM:kNN]{VIM::kNN}.}
18 18
 
19 19
 \item{poplin_in}{Name of a data matrix to retrieve.}
20 20
 
... ...
@@ -20,7 +20,7 @@
20 20
 
21 21
 \item{type}{A method for performing PCA.}
22 22
 
23
-\item{...}{Additional argument passed to \link[pcaMethods:pca]{pcaMethods::pca}.}
23
+\item{...}{Additional arguments passed to \link[pcaMethods:pca]{pcaMethods::pca}.}
24 24
 
25 25
 \item{poplin_in}{Name of a data matrix to retrieve.}
26 26
 
... ...
@@ -12,7 +12,7 @@
12 12
 \arguments{
13 13
 \item{x}{A matrix or \linkS4class{poplin} object.}
14 14
 
15
-\item{...}{Additional argument passed to \link[missForest:missForest]{missForest::missForest}.}
15
+\item{...}{Additional arguments passed to \link[missForest:missForest]{missForest::missForest}.}
16 16
 
17 17
 \item{poplin_in}{Name of a data matrix to retrieve.}
18 18
 
... ...
@@ -16,7 +16,7 @@
16 16
 visually verify whether there is a dependence of the standard deviation on
17 17
 the mean.}
18 18
 
19
-\item{...}{Additional argument passed to \link[vsn:vsn2]{vsn::vsnMatrix}.}
19
+\item{...}{Additional arguments passed to \link[vsn:vsn2]{vsn::vsnMatrix}.}
20 20
 
21 21
 \item{poplin_in}{Name of a data matrix to retrieve.}
22 22
 
... ...
@@ -20,7 +20,7 @@
20 20
 
21 21
 \item{method}{A imputation method. Default is 'pqn'.}
22 22
 
23
-\item{...}{Argument passed to a specific imputation method.}
23
+\item{...}{Arguments passed to a specific imputation method.}
24 24
 
25 25
 \item{poplin_in}{Name of a data matrix to retrieve.}
26 26
 
27 27
new file mode 100644
... ...
@@ -0,0 +1,65 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/plot-naplot.R
3
+\name{poplin_naplot}
4
+\alias{poplin_naplot}
5
+\alias{poplin_naplot.default}
6
+\alias{poplin_naplot.poplin}
7
+\title{Missing value plot}
8
+\usage{
9
+\method{poplin_naplot}{default}(
10
+  x,
11
+  widths = NULL,
12
+  heights = NULL,
13
+  grid_gap = 1,
14
+  colors = viridis::viridis(2),
15
+  hide_colorbar = TRUE,
16
+  showticklabels = c(TRUE, FALSE),
17
+  row_dend_left = FALSE,
18
+  ...
19
+)
20
+
21
+\method{poplin_naplot}{poplin}(
22
+  x,
23
+  poplin_in,
24
+  widths = NULL,
25
+  heights = NULL,
26
+  grid_gap = 1,
27
+  color = viridis::viridis(2),
28
+  hide_colorbar = TRUE,
29
+  showticklabels = c(TRUE, FALSE),
30
+  row_dend_left = FALSE,
31
+  ...
32
+)
33
+}
34
+\arguments{
35
+\item{x}{A matrix or \linkS4class{poplin} object.}
36
+
37
+\item{widths}{Relative widths of heatmap and dendrogram.}
38
+
39
+\item{grid_gap}{Gap between cells.}
40
+
41
+\item{colors}{A vector of colors for heatmap.}
42
+
43
+\item{hide_colorbar}{Logical controlling whether the color bar (legend) is
44
+hidden.}
45
+
46
+\item{showticklabels}{A logical vector of length 2 (x-axis, y-axis). If
47
+\code{FALSE}, ticks are removed from the side of the plot.}
48
+
49
+\item{row_dend_left}{Logical controlling whether the row dendrogram is
50
+placed on the left on the plot.}
51
+
52
+\item{...}{Additional arguments passed to \link[heatmaply:heatmaply]{heatmaply::heatmaply}.}
53
+
54
+\item{poplin_in}{Name of a data matrix to retrieve.}
55
+
56
+\item{height}{Relative height of heatmap and dendrogram.}
57
+}
58
+\value{
59
+gtable of aligned plot.
60
+}
61
+\description{
62
+Visualize data for exploring missing value (NA) patterns. All values in a
63
+data matrix are recoded (1: missing; 0: non-missing) and visualized by
64
+rectangles.
65
+}
... ...
@@ -29,7 +29,7 @@
29 29
 
30 30
 \item{scale}{A logical indicating unit variance scaling prior to PLS-DA.}
31 31
 
32
-\item{...}{Additional argument passed to \link[pls:mvr]{pls::plsr}.}
32
+\item{...}{Additional arguments passed to \link[pls:mvr]{pls::plsr}.}
33 33
 
34 34
 \item{poplin_in}{Name of a data matrix to retrieve.}
35 35
 
... ...
@@ -18,7 +18,7 @@
18 18
 so that the largest absolute of the centered matrix is equal to unity. See
19 19
 \link[Rtsne:normalize_input]{Rtsne::normalize_input} for details.}
20 20
 
21
-\item{...}{Additional argument passed to \link[Rtsne:Rtsne]{Rtsne::Rtsne}.}
21
+\item{...}{Additional arguments passed to \link[Rtsne:Rtsne]{Rtsne::Rtsne}.}
22 22
 
23 23
 \item{poplin_in}{Name of a data matrix to retrieve.}
24 24