10
10
# ' directional signs based on the presence of an equal sign ("=").
11
11
# '
12
12
# ' @param prot [vector] A vector of genomic context strings to be processed.
13
+ # '
14
+ # ' @importFrom rlang abort
13
15
# '
14
16
# ' @return [vector] A vector of the same length as the input, where each genomic
15
17
# ' element is annotated with either a forward ("->") or reverse ("<-") direction,
23
25
# ' straightenOperonSeq(genomic_context)
24
26
# '
25
27
# ' # Output: "A->", "B->", "*", "<-C", "<-D", "=", "E->", "F->"
28
+
26
29
straightenOperonSeq <- function (prot ) {
30
+ # Check if 'prot' is a data frame
31
+ if (! is.vector(prot )) {
32
+ abort(" Error: 'prot' must be a vector." )
33
+ }
34
+
27
35
w <- prot # $GenContext.orig # was 'x'
28
36
29
37
y <- rep(NA , length(w ))
@@ -80,6 +88,8 @@ straightenOperonSeq <- function(prot) {
80
88
# '
81
89
# ' @param prot [data.frame] A data frame containing at least a column named
82
90
# ' 'GenContext', which represents the genomic contexts that need to be reversed.
91
+ # '
92
+ # ' @importFrom rlang abort
83
93
# '
84
94
# ' @return [data.frame] The input data frame with the 'GenContext' column updated t
85
95
# ' o reflect the reversed operons.
@@ -94,7 +104,13 @@ straightenOperonSeq <- function(prot) {
94
104
# ' reversed_prot <- reverseOperonSeq(prot)
95
105
# ' reversed_prot
96
106
# ' }
107
+
97
108
reverseOperonSeq <- function (prot ) {
109
+ # Check if 'prot' is a data frame
110
+ if (! is.data.frame(prot )) {
111
+ abort(" Error: 'prot' must be a data frame." )
112
+ }
113
+
98
114
gencontext <- prot $ GenContext
99
115
100
116
gencontext <- gsub(pattern = " >" , replacement = " >|" , x = gencontext )
0 commit comments