... | ... |
@@ -1,21 +1,21 @@ |
1 |
-# @title Make a PWM-resembling matrix out of a given n-vector |
|
2 |
-# |
|
3 |
-# @description The given matrix (or simply a vector) is reshaped to have four |
|
4 |
-# rows for four nucleotides and a relevant number of columns. |
|
5 |
-# |
|
6 |
-# @param mat Actually a vector that will be reshaped into a (PWM) |
|
7 |
-# matrix of DNA sequences. |
|
8 |
-# @param add_pseudo_counts Logical, taking values TRUE or FALSE, specifying |
|
9 |
-# whether or not pseudocounts are added to the matrix. |
|
10 |
-# @param scale Logical, taking values TRUE or FALSE, specifying whether or |
|
11 |
-# not the matrix is scaled column-wise, i.e., all columns summed to 1. |
|
12 |
-# |
|
13 |
-# @return A (PWM) matrix with 4 rows corresponding to the 4 nucleotides (A, C, |
|
14 |
-# G, T) and the relevant number of columns (i.e., number of elements in given |
|
15 |
-# vector/4) |
|
16 |
-# |
|
17 |
-# @export |
|
18 |
-# |
|
1 |
+#' @title Make a PWM-resembling matrix out of a given n-vector |
|
2 |
+#' |
|
3 |
+#' @description The given matrix (or simply a vector) is reshaped to have four |
|
4 |
+#' rows for four nucleotides and a relevant number of columns. |
|
5 |
+#' |
|
6 |
+#' @param mat Actually a vector that will be reshaped into a (PWM) |
|
7 |
+#' matrix of DNA sequences. |
|
8 |
+#' @param add_pseudo_counts Logical, taking values TRUE or FALSE, specifying |
|
9 |
+#' whether or not pseudocounts are added to the matrix. |
|
10 |
+#' @param scale Logical, taking values TRUE or FALSE, specifying whether or |
|
11 |
+#' not the matrix is scaled column-wise, i.e., all columns summed to 1. |
|
12 |
+#' |
|
13 |
+#' @return A (PWM) matrix with 4 rows corresponding to the 4 nucleotides (A, C, |
|
14 |
+#' G, T) and the relevant number of columns (i.e., number of elements in given |
|
15 |
+#' vector/4) |
|
16 |
+#' |
|
17 |
+#' @export |
|
18 |
+#' |
|
19 | 19 |
make_sinuc_PWMs <- function(mat, add_pseudo_counts = TRUE, scale = TRUE) { |
20 | 20 |
## |
21 | 21 |
sinuc <- c("A", "C", "G", "T") |
... | ... |
@@ -36,24 +36,24 @@ make_sinuc_PWMs <- function(mat, add_pseudo_counts = TRUE, scale = TRUE) { |
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
|
39 |
-# @title Similarly to the PWM-like matrix for mononucleotides, make one for |
|
40 |
-# dinucleotides |
|
41 |
-# |
|
42 |
-# @description This function converts the basis matrix with basis vectors |
|
43 |
-# of dinucleotide information into matrix of dimension |
|
44 |
-# 16 x (sequence_length) for visualization. |
|
45 |
-# |
|
46 |
-# @param vec Column vector of the basis matrix |
|
47 |
-# @param add_pseudo_counts Whether pesudocounts are to be added. TRUE or FALSE. |
|
48 |
-# @param scale Whether to perform per position scaling of the matrix. TRUE or |
|
49 |
-# FALSE |
|
50 |
-# |
|
51 |
-# @return A (PWM) matrix with 16 rows corresponding to the dinucleotide |
|
52 |
-# combinations of the four nucleotides (A, C, G, T) and the relevant number |
|
53 |
-# of columns (i.e., number of elements in given vector/16) |
|
54 |
-# |
|
55 |
-# @export |
|
56 |
-# |
|
39 |
+#' @title Similarly to the PWM-like matrix for mononucleotides, make one for |
|
40 |
+#' dinucleotides |
|
41 |
+#' |
|
42 |
+#' @description This function converts the basis matrix with basis vectors |
|
43 |
+#' of dinucleotide information into matrix of dimension |
|
44 |
+#' 16 x (sequence_length) for visualization. |
|
45 |
+#' |
|
46 |
+#' @param vec Column vector of the basis matrix |
|
47 |
+#' @param add_pseudo_counts Whether pesudocounts are to be added. TRUE or FALSE. |
|
48 |
+#' @param scale Whether to perform per position scaling of the matrix. TRUE or |
|
49 |
+#' FALSE |
|
50 |
+#' |
|
51 |
+#' @return A (PWM) matrix with 16 rows corresponding to the dinucleotide |
|
52 |
+#' combinations of the four nucleotides (A, C, G, T) and the relevant number |
|
53 |
+#' of columns (i.e., number of elements in given vector/16) |
|
54 |
+#' |
|
55 |
+#' @export |
|
56 |
+#' |
|
57 | 57 |
make_dinuc_PWMs <- function(vec, add_pseudo_counts = TRUE, scale = TRUE) { |
58 | 58 |
|
59 | 59 |
# column vector is expected as input |
80 | 82 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/make_sinuc_PWMs.R |
|
3 |
+\name{make_dinuc_PWMs} |
|
4 |
+\alias{make_dinuc_PWMs} |
|
5 |
+\title{Similarly to the PWM-like matrix for mononucleotides, make one for |
|
6 |
+ dinucleotides} |
|
7 |
+\usage{ |
|
8 |
+make_dinuc_PWMs(vec, add_pseudo_counts = TRUE, scale = TRUE) |
|
9 |
+} |
|
10 |
+\arguments{ |
|
11 |
+\item{vec}{Column vector of the basis matrix} |
|
12 |
+ |
|
13 |
+\item{add_pseudo_counts}{Whether pesudocounts are to be added. TRUE or FALSE.} |
|
14 |
+ |
|
15 |
+\item{scale}{Whether to perform per position scaling of the matrix. TRUE or |
|
16 |
+FALSE} |
|
17 |
+} |
|
18 |
+\value{ |
|
19 |
+A (PWM) matrix with 16 rows corresponding to the dinucleotide |
|
20 |
+combinations of the four nucleotides (A, C, G, T) and the relevant number |
|
21 |
+of columns (i.e., number of elements in given vector/16) |
|
22 |
+} |
|
23 |
+\description{ |
|
24 |
+This function converts the basis matrix with basis vectors |
|
25 |
+of dinucleotide information into matrix of dimension |
|
26 |
+16 x (sequence_length) for visualization. |
|
27 |
+} |
0 | 28 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/make_sinuc_PWMs.R |
|
3 |
+\name{make_sinuc_PWMs} |
|
4 |
+\alias{make_sinuc_PWMs} |
|
5 |
+\title{Make a PWM-resembling matrix out of a given n-vector} |
|
6 |
+\usage{ |
|
7 |
+make_sinuc_PWMs(mat, add_pseudo_counts = TRUE, scale = TRUE) |
|
8 |
+} |
|
9 |
+\arguments{ |
|
10 |
+\item{mat}{Actually a vector that will be reshaped into a (PWM) |
|
11 |
+matrix of DNA sequences.} |
|
12 |
+ |
|
13 |
+\item{add_pseudo_counts}{Logical, taking values TRUE or FALSE, specifying |
|
14 |
+whether or not pseudocounts are added to the matrix.} |
|
15 |
+ |
|
16 |
+\item{scale}{Logical, taking values TRUE or FALSE, specifying whether or |
|
17 |
+not the matrix is scaled column-wise, i.e., all columns summed to 1.} |
|
18 |
+} |
|
19 |
+\value{ |
|
20 |
+A (PWM) matrix with 4 rows corresponding to the 4 nucleotides (A, C, |
|
21 |
+G, T) and the relevant number of columns (i.e., number of elements in given |
|
22 |
+vector/4) |
|
23 |
+} |
|
24 |
+\description{ |
|
25 |
+The given matrix (or simply a vector) is reshaped to have four |
|
26 |
+rows for four nucleotides and a relevant number of columns. |
|
27 |
+} |