Browse code

small bugfixes

FelixErnst authored on 25/11/2019 23:05:39
Showing 6 changed files

... ...
@@ -791,11 +791,9 @@ setReplaceMethod(f = "settings",
791 791
   # search for modifications
792 792
   if(settings(ans,"find.mod")){
793 793
     if(seqtype(ans) == seqtype(RNAString())){
794
-      f <- which(Modstrings::shortName(Modstrings::ModRNAString()) %in% modType(ans))
795
-      modName <- Modstrings::fullName(Modstrings::ModRNAString())[f]
794
+      modName <- .get_modification_full_name(ans,seqtype(ans))
796 795
     } else if(seqtype(ans) == seqtype(DNAString())){
797
-      f <- which(Modstrings::shortName(Modstrings::ModDNAString()) %in% modType(ans))
798
-      modName <- Modstrings::fullName(Modstrings::ModDNAString())[f]
796
+      modName <- .get_modification_full_name(ans,seqtype(ans))
799 797
     } else {
800 798
       stop("")
801 799
     }
... ...
@@ -31,9 +31,10 @@ NULL
31 31
 #' @param coord coordinates of position to subset to. Either a \code{GRanges} or
32 32
 #' a \code{GRangesList} object. For both types the 'Parent' column is expected to
33 33
 #' match the transcript name.
34
-#' @param ... optional parameters:
34
+#' @param name Optional: Limit results to one specific transcript.
35
+#' @param pos Optional: Limit results to a specific position.
36
+#' @param ... Optional parameters:
35 37
 #' \itemize{
36
-#' \item{\code{name}:} {Limit results to one specific transcript.}
37 38
 #' \item{\code{type}:} {the modification type used for subsetting. By default 
38 39
 #' this is derived from the \code{modType(x)}, but it can be overwritten using 
39 40
 #' \code{type}. It must be a valid shortName for a modification according to
... ...
@@ -55,11 +56,11 @@ NULL
55 56
 #' If 'x' is a
56 57
 #' \itemize{
57 58
 #' \item{\code{\link[=SequenceData-class]{SequenceData}} or 
58
-#' \code{\link[=Modifier-class]{Modifier}}} {a \code{SplitDataFrameList}
59
+#' \code{\link[=Modifier-class]{Modifier}}:} {a \code{SplitDataFrameList}
59 60
 #' with elments per transcript.}
60 61
 #' \item{\code{\link[=SequenceDataSet-class]{SequenceDataSet}},
61 62
 #' \code{\link[=SequenceDataList-class]{SequenceDataList}} or
62
-#' \code{\link[=ModifierSet-class]{ModifierSet}}} {a \code{SimpleList} of
63
+#' \code{\link[=ModifierSet-class]{ModifierSet}}:} {a \code{SimpleList} of
63 64
 #' \code{SplitDataFrameList} with elments per transcript.}
64 65
 #' }
65 66
 #' 
... ...
@@ -110,8 +111,7 @@ NULL
110 111
   }
111 112
 }
112 113
 
113
-#' @rdname subsetByCoord
114
-#' @export
114
+#' @keywords internal
115 115
 setMethod("subset",
116 116
           signature = c(x = "Modifier"),
117 117
           function(x, name, pos = 1L, ...){
... ...
@@ -283,6 +283,8 @@ NULL
283 283
   coord
284 284
 }
285 285
 
286
+#' @rdname subsetByCoord
287
+#' @export
286 288
 setMethod("subsetByCoord",
287 289
           signature = c(x = "SplitDataFrameList", coord = "GRanges"),
288 290
           function(x, coord, ...){
... ...
@@ -448,8 +450,7 @@ setMethod("subsetByCoord",
448 450
   .keep_one_labels_column(ans)
449 451
 }
450 452
 
451
-#' @rdname subsetByCoord
452
-#' @export
453
+#' @keywords internal
453 454
 setMethod("labelByCoord",
454 455
           signature = c(x = "SplitDataFrameList", coord = "GRanges"),
455 456
           function(x, coord, ...){
... ...
@@ -1,6 +1,14 @@
1 1
 #' @include RNAmodR.R
2 2
 NULL
3 3
 
4
+.get_modification_full_name <- function(x, type = c("RNA","DNA")){
5
+  type <- match.arg(type)
6
+  className <- paste0("Mod",type)
7
+  f <- which(Modstrings::shortName(Biostrings:::XString(className,"")) %in% modType(x))
8
+  modName <- Modstrings::fullName(Biostrings:::XString(className,""))[f]
9
+  modName
10
+}
11
+
4 12
 # gets the first non virtual class which x extends from
5 13
 .get_first_class_extends <- function(x){
6 14
   e <- extends(class(x))
... ...
@@ -14,11 +14,11 @@
14 14
 \alias{plotCompareByCoord,ModifierSet,GRangesList-method}
15 15
 \title{Comparison of Samples}
16 16
 \usage{
17
-compare(x, name, from = 1L, to = 30L, ...)
17
+compare(x, name, pos = 1L, ...)
18 18
 
19 19
 compareByCoord(x, coord, ...)
20 20
 
21
-plotCompare(x, name, from = 1L, to = 30L, normalize, ...)
21
+plotCompare(x, name, pos = 1L, normalize, ...)
22 22
 
23 23
 plotCompareByCoord(x, coord, normalize, ...)
24 24
 
... ...
@@ -29,8 +29,7 @@ plotCompareByCoord(x, coord, normalize, ...)
29 29
 \S4method{compareByCoord}{ModifierSet,GRangesList}(x, coord, normalize,
30 30
   ...)
31 31
 
32
-\S4method{plotCompare}{ModifierSet}(x, name, from = 1L, to = 30L,
33
-  normalize, ...)
32
+\S4method{plotCompare}{ModifierSet}(x, name, pos = 1L, normalize, ...)
34 33
 
35 34
 \S4method{plotCompareByCoord}{ModifierSet,GRanges}(x, coord, normalize,
36 35
   ...)
... ...
@@ -43,9 +42,7 @@ plotCompareByCoord(x, coord, normalize, ...)
43 42
 
44 43
 \item{name}{Only for \code{compare}: the transcript name}
45 44
 
46
-\item{from}{Only for \code{compare}: start position}
47
-
48
-\item{to}{Only for \code{compare}: end position}
45
+\item{pos}{Only for \code{compare}: pos for comparison}
49 46
 
50 47
 \item{...}{optional parameters:
51 48
 \itemize{
... ...
@@ -5,7 +5,6 @@
5 5
 \name{subsetByCoord}
6 6
 \alias{subsetByCoord}
7 7
 \alias{labelByCoord}
8
-\alias{subset,Modifier-method}
9 8
 \alias{subsetByCoord,Modifier,GRanges-method}
10 9
 \alias{subsetByCoord,Modifier,GRangesList-method}
11 10
 \alias{subset,ModifierSet-method}
... ...
@@ -15,6 +14,7 @@
15 14
 \alias{labelByCoord,Modifier,GRangesList-method}
16 15
 \alias{labelByCoord,ModifierSet,GRanges-method}
17 16
 \alias{labelByCoord,ModifierSet,GRangesList-method}
17
+\alias{subsetByCoord,SplitDataFrameList,GRanges-method}
18 18
 \alias{subset,SequenceData-method}
19 19
 \alias{subsetByCoord,SequenceData,GRanges-method}
20 20
 \alias{subsetByCoord,SequenceData,GRangesList-method}
... ...
@@ -24,7 +24,6 @@
24 24
 \alias{subset,SequenceDataList-method}
25 25
 \alias{subsetByCoord,SequenceDataList,GRanges-method}
26 26
 \alias{subsetByCoord,SequenceDataList,GRangesList-method}
27
-\alias{labelByCoord,SplitDataFrameList,GRanges-method}
28 27
 \alias{labelByCoord,SequenceData,GRanges-method}
29 28
 \alias{labelByCoord,SequenceData,GRangesList-method}
30 29
 \alias{labelByCoord,SequenceDataSet,GRanges-method}
... ...
@@ -38,8 +37,6 @@ subsetByCoord(x, coord, ...)
38 37
 
39 38
 labelByCoord(x, coord, ...)
40 39
 
41
-\S4method{subset}{Modifier}(x, name, pos = 1L, ...)
42
-
43 40
 \S4method{subsetByCoord}{Modifier,GRanges}(x, coord, ...)
44 41
 
45 42
 \S4method{subsetByCoord}{Modifier,GRangesList}(x, coord, ...)
... ...
@@ -58,6 +55,8 @@ labelByCoord(x, coord, ...)
58 55
 
59 56
 \S4method{labelByCoord}{ModifierSet,GRangesList}(x, coord, ...)
60 57
 
58
+\S4method{subsetByCoord}{SplitDataFrameList,GRanges}(x, coord, ...)
59
+
61 60
 \S4method{subset}{SequenceData}(x, name, pos = 1L, ...)
62 61
 
63 62
 \S4method{subsetByCoord}{SequenceData,GRanges}(x, coord, ...)
... ...
@@ -76,8 +75,6 @@ labelByCoord(x, coord, ...)
76 75
 
77 76
 \S4method{subsetByCoord}{SequenceDataList,GRangesList}(x, coord, ...)
78 77
 
79
-\S4method{labelByCoord}{SplitDataFrameList,GRanges}(x, coord, ...)
80
-
81 78
 \S4method{labelByCoord}{SequenceData,GRanges}(x, coord, ...)
82 79
 
83 80
 \S4method{labelByCoord}{SequenceData,GRangesList}(x, coord, ...)
... ...
@@ -98,9 +95,8 @@ labelByCoord(x, coord, ...)
98 95
 a \code{GRangesList} object. For both types the 'Parent' column is expected to
99 96
 match the transcript name.}
100 97
 
101
-\item{...}{optional parameters:
98
+\item{...}{Optional parameters:
102 99
 \itemize{
103
-\item{\code{name}:} {Limit results to one specific transcript.}
104 100
 \item{\code{type}:} {the modification type used for subsetting. By default 
105 101
 this is derived from the \code{modType(x)}, but it can be overwritten using 
106 102
 \code{type}. It must be a valid shortName for a modification according to
... ...
@@ -117,16 +113,20 @@ value \code{!= 0L} are set. (default: \code{merge = TRUE}).}
117 113
 positions labeled per transcript and not per chromosome?
118 114
 (default: \code{perTranscript = FALSE}).}
119 115
 }}
116
+
117
+\item{name}{Optional: Limit results to one specific transcript.}
118
+
119
+\item{pos}{Optional: Limit results to a specific position.}
120 120
 }
121 121
 \value{
122 122
 If 'x' is a
123 123
 \itemize{
124 124
 \item{\code{\link[=SequenceData-class]{SequenceData}} or 
125
-\code{\link[=Modifier-class]{Modifier}}} {a \code{SplitDataFrameList}
125
+\code{\link[=Modifier-class]{Modifier}}:} {a \code{SplitDataFrameList}
126 126
 with elments per transcript.}
127 127
 \item{\code{\link[=SequenceDataSet-class]{SequenceDataSet}},
128 128
 \code{\link[=SequenceDataList-class]{SequenceDataList}} or
129
-\code{\link[=ModifierSet-class]{ModifierSet}}} {a \code{SimpleList} of
129
+\code{\link[=ModifierSet-class]{ModifierSet}}:} {a \code{SimpleList} of
130 130
 \code{SplitDataFrameList} with elments per transcript.}
131 131
 }
132 132
 }