Browse code

Updated docs

Shians authored on 14/04/2023 07:18:04
Showing 10 changed files

... ...
@@ -1,10 +1,7 @@
1 1
 #' Get methylation data
2 2
 #' @keywords internal
3
-#'
4 3
 #' @param object the object.
5
-#'
6 4
 #' @return the path to the methylation data.
7
-#'
8 5
 #' @examples
9 6
 #' showMethods("methy")
10 7
 #'
... ...
@@ -21,17 +18,8 @@ setGeneric("methy<-", function(object, value) {
21 18
 })
22 19
 
23 20
 #' Get sample annotation
24
-#'
25
-#' @param object the object.
26
-#'
27
-#' @return the sample annotation.
28
-#'
29
-#' @examples
30
-#' showMethods("samples")
31
-#'
32
-#' @export
33
-#'
34 21
 #' @keywords internal
22
+#' @export
35 23
 setGeneric("samples", valueClass = "data.frame", function(object) {
36 24
     standardGeneric("samples")
37 25
 })
... ...
@@ -45,14 +33,6 @@ setGeneric("samples<-", function(object, value) {
45 33
 
46 34
 #' Get exon annotation
47 35
 #' @keywords internal
48
-#'
49
-#' @param object the object.
50
-#'
51
-#' @return the exon annotation.
52
-#'
53
-#' @examples
54
-#' showMethods("exons")
55
-#'
56 36
 #' @export
57 37
 setGeneric("exons", valueClass = "data.frame", function(object) {
58 38
     standardGeneric("exons")
... ...
@@ -65,7 +45,9 @@ setGeneric("exons<-", function(object, value) {
65 45
     standardGeneric("exons<-")
66 46
 })
67 47
 
68
-#' Plot gene
48
+#' Plot gene methylation
49
+#'
50
+#' Plot the methylation of a gene symbol specified within the exon(x) slot.
69 51
 #'
70 52
 #' @param x the NanoMethResult or ModBamResult object.
71 53
 #' @param gene the gene symbol for the gene to plot.
... ...
@@ -82,6 +64,8 @@ setGeneric("plot_gene", function(x, gene, ...) {
82 64
 
83 65
 #' Plot gene methylation heatmap
84 66
 #'
67
+#' Plot the methylation heatmap of a gene symbol specified within the exon(x) slot.
68
+#'
85 69
 #' @param x the NanoMethResult or ModBamResult object.
86 70
 #' @param gene the gene symbol for the gene to plot.
87 71
 #' @param ... additional arguments
... ...
@@ -93,7 +77,9 @@ setGeneric("plot_gene_heatmap", function(x, gene, ...) {
93 77
     standardGeneric("plot_gene_heatmap")
94 78
 })
95 79
 
96
-#' Plot region
80
+#' Plot region methylation
81
+#'
82
+#' Plot the methylation of a genomic region.
97 83
 #'
98 84
 #' @param x the NanoMethResult or ModBamResult object.
99 85
 #' @param chr the chromosome to plot.
... ...
@@ -112,6 +98,8 @@ setGeneric("plot_region", function(x, chr, start, end, ...) {
112 98
 
113 99
 #' Plot region methylation heatmap
114 100
 #'
101
+#' Plot the methylation heatmap of a genomic region.
102
+#'
115 103
 #' @param x the NanoMethResult or ModBamResult object.
116 104
 #' @param chr the chromosome to plot.
117 105
 #' @param start the start of the plotting region.
... ...
@@ -14,8 +14,8 @@ setClass(
14 14
 #' This function creates a ModBamFiles object containing information about the
15 15
 #' samples and file paths.
16 16
 #'
17
-#' @param samples A character vector with the names of the samples.
18
-#' @param paths A character vector with the file paths for the BAM files.
17
+#' @param samples a character vector with the names of the samples.
18
+#' @param paths a character vector with the file paths for the BAM files.
19 19
 #'
20 20
 #' @return A ModBamFiles object with the sample and path information.
21 21
 #'
... ...
@@ -31,6 +31,10 @@ ModBamFiles <- function(samples, paths) {
31 31
     new("ModBamFiles", x)
32 32
 }
33 33
 
34
+#' @docType methods
35
+#' @rdname ModBamFiles
36
+#'
37
+#' @param object a ModBamFiles object.
34 38
 #' @export
35 39
 setMethod("show", signature("ModBamFiles"), function(object) {
36 40
     print(glue::glue(
... ...
@@ -1,5 +1,9 @@
1 1
 #' Load an example NanoMethResult object
2 2
 #'
3
+#' Load an example NanoMethResult object for demonstration of plotting
4
+#' functions. Run `load_example_nanomethresults` without the function call to
5
+#' see how the object is constructed.
6
+#'
3 7
 #' @return a NanoMethResults object
4 8
 #'
5 9
 #' @export
... ...
@@ -1,15 +1,21 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/ModBamResults.R
3
+\docType{methods}
3 4
 \name{ModBamFiles}
4 5
 \alias{ModBamFiles}
6
+\alias{show,ModBamFiles-method}
5 7
 \title{Constructor for a ModBamFiles object}
6 8
 \usage{
7 9
 ModBamFiles(samples, paths)
10
+
11
+\S4method{show}{ModBamFiles}(object)
8 12
 }
9 13
 \arguments{
10
-\item{samples}{A character vector with the names of the samples.}
14
+\item{samples}{a character vector with the names of the samples.}
15
+
16
+\item{paths}{a character vector with the file paths for the BAM files.}
11 17
 
12
-\item{paths}{A character vector with the file paths for the BAM files.}
18
+\item{object}{a ModBamFiles object.}
13 19
 }
14 20
 \value{
15 21
 A ModBamFiles object with the sample and path information.
... ...
@@ -6,17 +6,7 @@
6 6
 \usage{
7 7
 exons(object)
8 8
 }
9
-\arguments{
10
-\item{object}{the object.}
11
-}
12
-\value{
13
-the exon annotation.
14
-}
15 9
 \description{
16 10
 Get exon annotation
17
-}
18
-\examples{
19
-showMethods("exons")
20
-
21 11
 }
22 12
 \keyword{internal}
... ...
@@ -4,7 +4,7 @@
4 4
 \alias{plot_gene}
5 5
 \alias{plot_gene,NanoMethResult,character-method}
6 6
 \alias{plot_gene,ModBamResult,character-method}
7
-\title{Plot gene}
7
+\title{Plot gene methylation}
8 8
 \usage{
9 9
 plot_gene(x, gene, ...)
10 10
 
... ...
@@ -39,7 +39,7 @@ plot_gene(x, gene, ...)
39 39
 )
40 40
 }
41 41
 \arguments{
42
-\item{x}{the NanoMethResult object.}
42
+\item{x}{the NanoMethResult or ModBamResult object.}
43 43
 
44 44
 \item{gene}{the gene symbol for the gene to plot.}
45 45
 
... ...
@@ -78,7 +78,7 @@ a patchwork plot containing the methylation profile in the specified
78 78
 region.
79 79
 }
80 80
 \description{
81
-Plot gene
81
+Plot the methylation of a gene symbol specified within the exon(x) slot.
82 82
 }
83 83
 \section{Functions}{
84 84
 \itemize{
... ...
@@ -3,6 +3,7 @@
3 3
 \name{plot_gene_heatmap}
4 4
 \alias{plot_gene_heatmap}
5 5
 \alias{plot_gene_heatmap,NanoMethResult,character-method}
6
+\alias{plot_gene_heatmap,ModBamResult,character-method}
6 7
 \title{Plot gene methylation heatmap}
7 8
 \usage{
8 9
 plot_gene_heatmap(x, gene, ...)
... ...
@@ -14,9 +15,17 @@ plot_gene_heatmap(x, gene, ...)
14 15
   pos_style = c("to_scale", "compact"),
15 16
   subsample = 50
16 17
 )
18
+
19
+\S4method{plot_gene_heatmap}{ModBamResult,character}(
20
+  x,
21
+  gene,
22
+  window_prop = 0.3,
23
+  pos_style = c("to_scale", "compact"),
24
+  subsample = 50
25
+)
17 26
 }
18 27
 \arguments{
19
-\item{x}{the NanoMethResult object.}
28
+\item{x}{the NanoMethResult or ModBamResult object.}
20 29
 
21 30
 \item{gene}{the gene symbol for the gene to plot.}
22 31
 
... ...
@@ -39,7 +48,7 @@ a ggplot object of the heatmap
39 48
 a ggplot plot containing the heatmap.
40 49
 }
41 50
 \description{
42
-Plot gene methylation heatmap
51
+Plot the methylation heatmap of a gene symbol specified within the exon(x) slot.
43 52
 }
44 53
 \examples{
45 54
 nmr <- load_example_nanomethresult()
... ...
@@ -3,9 +3,10 @@
3 3
 \name{plot_region}
4 4
 \alias{plot_region}
5 5
 \alias{plot_region,NanoMethResult,character,numeric,numeric-method}
6
+\alias{plot_region,ModBamResult,character,numeric,numeric-method}
6 7
 \alias{plot_region,NanoMethResult,factor,numeric,numeric-method}
7 8
 \alias{plot_region,ModBamResult,factor,numeric,numeric-method}
8
-\title{Plot region}
9
+\title{Plot region methylation}
9 10
 \usage{
10 11
 plot_region(x, chr, start, end, ...)
11 12
 
... ...
@@ -25,6 +26,22 @@ plot_region(x, chr, start, end, ...)
25 26
   line_size = 2
26 27
 )
27 28
 
29
+\S4method{plot_region}{ModBamResult,character,numeric,numeric}(
30
+  x,
31
+  chr,
32
+  start,
33
+  end,
34
+  anno_regions = NULL,
35
+  binary_threshold = NULL,
36
+  avg_method = c("mean", "median"),
37
+  spaghetti = FALSE,
38
+  heatmap = FALSE,
39
+  span = NULL,
40
+  window_prop = 0,
41
+  palette = ggplot2::scale_colour_brewer(palette = "Set1"),
42
+  line_size = 2
43
+)
44
+
28 45
 \S4method{plot_region}{NanoMethResult,factor,numeric,numeric}(
29 46
   x,
30 47
   chr,
... ...
@@ -58,7 +75,7 @@ plot_region(x, chr, start, end, ...)
58 75
 )
59 76
 }
60 77
 \arguments{
61
-\item{x}{the NanoMethResult object.}
78
+\item{x}{the NanoMethResult or ModBamResult object.}
62 79
 
63 80
 \item{chr}{the chromosome to plot.}
64 81
 
... ...
@@ -99,7 +116,7 @@ a patchwork plot containing the methylation profile in the specified
99 116
 region.
100 117
 }
101 118
 \description{
102
-Plot region
119
+Plot the methylation of a genomic region.
103 120
 }
104 121
 \examples{
105 122
 nmr <- load_example_nanomethresult()
... ...
@@ -3,7 +3,9 @@
3 3
 \name{plot_region_heatmap}
4 4
 \alias{plot_region_heatmap}
5 5
 \alias{plot_region_heatmap,NanoMethResult,character,numeric,numeric-method}
6
+\alias{plot_region_heatmap,ModBamResult,character,numeric,numeric-method}
6 7
 \alias{plot_region_heatmap,NanoMethResult,factor,numeric,numeric-method}
8
+\alias{plot_region_heatmap,ModBamResult,factor,numeric,numeric-method}
7 9
 \title{Plot region methylation heatmap}
8 10
 \usage{
9 11
 plot_region_heatmap(x, chr, start, end, ...)
... ...
@@ -18,6 +20,16 @@ plot_region_heatmap(x, chr, start, end, ...)
18 20
   subsample = 50
19 21
 )
20 22
 
23
+\S4method{plot_region_heatmap}{ModBamResult,character,numeric,numeric}(
24
+  x,
25
+  chr,
26
+  start,
27
+  end,
28
+  pos_style = c("to_scale", "compact"),
29
+  window_prop = 0,
30
+  subsample = 50
31
+)
32
+
21 33
 \S4method{plot_region_heatmap}{NanoMethResult,factor,numeric,numeric}(
22 34
   x,
23 35
   chr,
... ...
@@ -27,9 +39,19 @@ plot_region_heatmap(x, chr, start, end, ...)
27 39
   window_prop = 0,
28 40
   subsample = 50
29 41
 )
42
+
43
+\S4method{plot_region_heatmap}{ModBamResult,factor,numeric,numeric}(
44
+  x,
45
+  chr,
46
+  start,
47
+  end,
48
+  pos_style = c("to_scale", "compact"),
49
+  window_prop = 0,
50
+  subsample = 50
51
+)
30 52
 }
31 53
 \arguments{
32
-\item{x}{the NanoMethResult object.}
54
+\item{x}{the NanoMethResult or ModBamResult object.}
33 55
 
34 56
 \item{chr}{the chromosome to plot.}
35 57
 
... ...
@@ -56,7 +78,7 @@ a ggplot object of the heatmap.
56 78
 a ggplot plot containing the heatmap.
57 79
 }
58 80
 \description{
59
-Plot region methylation heatmap
81
+Plot the methylation heatmap of a genomic region.
60 82
 }
61 83
 \examples{
62 84
 nmr <- load_example_nanomethresult()
... ...
@@ -6,17 +6,7 @@
6 6
 \usage{
7 7
 samples(object)
8 8
 }
9
-\arguments{
10
-\item{object}{the object.}
11
-}
12
-\value{
13
-the sample annotation.
14
-}
15 9
 \description{
16 10
 Get sample annotation
17
-}
18
-\examples{
19
-showMethods("samples")
20
-
21 11
 }
22 12
 \keyword{internal}