Browse code

bug fix: Disabling test_getMotifs due to failure caused by unreachable URL/database

Aufiero authored on 08/05/2025 07:54:46
Showing 2 changed files

... ...
@@ -81,3 +81,8 @@
81 81
 # Version 1.15.3 (October 24, 2023)
82 82
 
83 83
 -   Fixed bug due to dplyr::bind\_rows()
84
+
85
+# Version 1.22.1 (May 8, 2024)
86
+
87
+-   Disabling  test_getMotifs due to failure caused by unreachable URL/database. 
88
+
... ...
@@ -1,248 +1,248 @@
1
-setwd(file.path(getwd(), "testdata"))
2
-
3
-context("Test that getMotifs() function works correctly")
4
-test_that("getMotifs() and mergeMotifs() generate the correct data structure
5
-    with GR seqs",
6
-          {
7
-              gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
8
-
9
-              # Create the backSplicedJunctions without retriving the missing coordinates
10
-              backSplicedJunctions <- getBackSplicedJunctions(gtf)
11
-              mergedBSJunctions <-
12
-                  mergeBSJunctions(backSplicedJunctions, gtf)
13
-
14
-              # Annonate BSJs
15
-              annotatedBSJs <- annotateBSJs(mergedBSJunctions[9,], gtf)
16
-
17
-              if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
18
-                  # Get BSgenome object
19
-                  genome <-
20
-                      BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
21
-
22
-                  # Retrieve sequences
23
-                  targets <-
24
-                      getSeqsFromGRs(
25
-                          annotatedBSJs,
26
-                          genome,
27
-                          lIntron = 101,
28
-                          lExon = 9,
29
-                          type = "ie"
30
-                      )
31
-
32
-                  # Retrieve motifs
33
-                  # rbp = TRUE reverse = TRUE
34
-                  motifs <-
35
-                      getMotifs(
36
-                          targets,
37
-                          width = 6,
38
-                          database = 'ATtRACT',
39
-                          species = "Mmusculus",
40
-                          rbp = TRUE,
41
-                          reverse = TRUE
42
-                      )
43
-                  expect_is(motifs, "list")
44
-                  expect_equal(length(motifs), 2)
45
-
46
-                  # check nrow all data frame
47
-                  expect_equal(nrow(motifs$upGR$targets), nrow(annotatedBSJs))
48
-                  expect_equal(nrow(motifs$downGR$targets), nrow(annotatedBSJs))
49
-                  expect_equal(ncol(motifs$upGR$counts) - 1, nrow(motifs$upGR$motif))
50
-
51
-                  # Merge motifs
52
-                  mergedMotifs <- mergeMotifs(motifs)
53
-                  expect_is(mergedMotifs, "data.frame")
54
-
55
-                  # Retrieve motifs
56
-                  # rbp = FALSE reverse = FALSE
57
-                  motifs <-
58
-                      getMotifs(
59
-                          targets,
60
-                          width = 6,
61
-                          database = 'ATtRACT',
62
-                          species = "Mmusculus",
63
-                          rbp = FALSE,
64
-                          reverse = FALSE
65
-                      )
66
-                  expect_is(motifs, "list")
67
-                  expect_equal(length(motifs), 2)
68
-
69
-                  # check nrow all data frame
70
-                  expect_equal(nrow(motifs$upGR$targets), nrow(annotatedBSJs))
71
-                  expect_equal(nrow(motifs$downGR$targets), nrow(annotatedBSJs))
72
-                  expect_equal(ncol(motifs$upGR$counts) - 1, nrow(motifs$upGR$motif))
73
-
74
-                  # Merge motifs
75
-                  mergedMotifs <- mergeMotifs(motifs)
76
-                  expect_is(mergedMotifs, "data.frame")
77
-              } else{
78
-                  cat(
79
-                      "Missing package BSgenome.Mmusculus.UCSC.mm10.
80
-            Use BiocManager to install it."
81
-                  )
82
-              }
83
-
84
-
85
-
86
-          })
87
-
88
-
89
-test_that("getMotifs() generates a list with the correct
90
-    content with GR seqs",
91
-          {
92
-              gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
93
-
94
-              # Create the backSplicedJunctions without retriving the missing coordinates
95
-              backSplicedJunctions <- getBackSplicedJunctions(gtf)
96
-              mergedBSJunctions <-
97
-                  mergeBSJunctions(backSplicedJunctions, gtf)
98
-
99
-              # Annonate BSJs
100
-              annotatedBSJs <- annotateBSJs(mergedBSJunctions[4,], gtf)
101
-
102
-              if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
103
-                  # Get BSgenome object
104
-                  genome <-
105
-                      BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
106
-
107
-                  # Retrieve sequences
108
-                  targets <-
109
-                      getSeqsFromGRs(
110
-                          annotatedBSJs,
111
-                          genome,
112
-                          lIntron = 101,
113
-                          lExon = 9,
114
-                          type = "ie"
115
-                      )
116
-
117
-                  # Retrieve motifs
118
-                  motifs <-
119
-                      getMotifs(
120
-                          targets,
121
-                          width = 4,
122
-                          database = 'ATtRACT',
123
-                          species = "Mmusculus",
124
-                          rbp = TRUE,
125
-                          reverse = TRUE
126
-                      )
127
-
128
-                  expect_equal(motifs$upGR$counts$UCUU[1], 0)
129
-                  expect_equal(motifs$downGR$counts$UCUU[1], 1)
130
-
131
-                  expect_equal(motifs$upGR$counts$UUCU[1], 0)
132
-                  expect_equal(motifs$downGR$counts$UUCU[1], 2)
133
-
134
-
135
-                  expect_equal(motifs$upGR$location$UUCU[1], "NA")
136
-                  expect_equal(motifs$downGR$location$UUCU[1], "26,102")
137
-
138
-                  expect_equal(motifs$upGR$location$UCUU[1], "NA")
139
-                  expect_equal(motifs$downGR$location$UCUU[1], "103")
140
-
141
-                  # check 2nd pattern
142
-                  expect_equal(motifs$upGR$counts$AGAG[1], 2)
143
-                  expect_equal(motifs$downGR$counts$AGAG[1], 2)
144
-
145
-                  expect_equal(motifs$upGR$counts$GAGA[1], 1)
146
-                  expect_equal(motifs$downGR$counts$GAGA[1], 2)
147
-
148
-                  expect_equal(motifs$upGR$location$GAGA[1], "13")
149
-                  expect_equal(motifs$downGR$location$GAGA[1], "18,56")
150
-
151
-                  expect_equal(motifs$upGR$location$AGAG[1], "12,14")
152
-                  expect_equal(motifs$downGR$location$AGAG[1], "17,55")
153
-              } else{
154
-                  cat(
155
-                      "Missing package BSgenome.Mmusculus.UCSC.mm10.
156
-            Use BiocManager to install it."
157
-                  )
158
-              }
159
-
160
-          })
161
-
162
-
163
-
164
-
165
-test_that(
166
-    "getMotifs() and mergeMotifs() generates the correct data structure
167
-    with circRNA and BSJ seqs",
168
-    {
169
-        gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
170
-
171
-        # Create the backSplicedJunctions without retriving the missing coordinates
172
-        backSplicedJunctions <- getBackSplicedJunctions(gtf)
173
-        mergedBSJunctions <-
174
-            mergeBSJunctions(backSplicedJunctions, gtf)
175
-
176
-        # Annonate BSJs
177
-        annotatedBSJs <-
178
-            annotateBSJs(mergedBSJunctions[9,], gtf)
179
-
180
-        if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
181
-            # Get BSgenome object
182
-            genome <-
183
-                BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
184
-
185
-            # Retrieve sequences (BSJs)
186
-            targets <-
187
-                getSeqsAcrossBSJs(annotatedBSJs,
188
-                                  gtf,
189
-                                  genome)
190
-
191
-            # Retrieve motifs
192
-            # rbp = TRUE reverse = TRUE
193
-            motifs <-
194
-                getMotifs(
195
-                    targets,
196
-                    width = 4,
197
-                    species = "Mmusculus",
198
-                    rbp = TRUE,
199
-                    reverse = TRUE
200
-                )
201
-            expect_is(motifs, "list")
202
-            expect_equal(length(motifs), 1)
203
-
204
-            # check nrow all data frame
205
-            expect_equal(nrow(motifs$bsj$targets), nrow(annotatedBSJs))
206
-            expect_equal(ncol(motifs$bsj$counts) - 1, nrow(motifs$bsj$motif))
207
-
208
-            # Merge motifs
209
-            mergedMotifs <- mergeMotifs(motifs)
210
-            expect_is(mergedMotifs, "data.frame")
211
-
212
-
213
-            # Retrieve sequences (circRNA seqs)
214
-            targets <-
215
-                getCircSeqs(annotatedBSJs,
216
-                            gtf,
217
-                            genome)
218
-
219
-            # Retrieve motifs
220
-            # rbp = TRUE reverse = TRUE
221
-            motifs <-
222
-                getMotifs(
223
-                    targets,
224
-                    width = 4,
225
-                    species = "Mmusculus",
226
-                    rbp = TRUE,
227
-                    reverse = TRUE
228
-                )
229
-
230
-            expect_is(motifs, "list")
231
-            expect_equal(length(motifs), 1)
232
-
233
-            # check nrow all data frame
234
-            expect_equal(nrow(motifs$circ$targets), nrow(annotatedBSJs))
235
-            expect_equal(ncol(motifs$circ$counts) - 1, nrow(motifs$circ$motif))
236
-
237
-            # Merge motifs
238
-            mergedMotifs <- mergeMotifs(motifs)
239
-            expect_is(mergedMotifs, "data.frame")
240
-        } else{
241
-            cat(
242
-                "Missing package BSgenome.Mmusculus.UCSC.mm10.
243
-            Use BiocManager to install it."
244
-            )
245
-        }
246
-
247
-
248
-})
1
+# setwd(file.path(getwd(), "testdata"))
2
+# 
3
+# context("Test that getMotifs() function works correctly")
4
+# test_that("getMotifs() and mergeMotifs() generate the correct data structure
5
+#     with GR seqs",
6
+#           {
7
+#               gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
8
+# 
9
+#               # Create the backSplicedJunctions without retriving the missing coordinates
10
+#               backSplicedJunctions <- getBackSplicedJunctions(gtf)
11
+#               mergedBSJunctions <-
12
+#                   mergeBSJunctions(backSplicedJunctions, gtf)
13
+# 
14
+#               # Annonate BSJs
15
+#               annotatedBSJs <- annotateBSJs(mergedBSJunctions[9,], gtf)
16
+# 
17
+#               if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
18
+#                   # Get BSgenome object
19
+#                   genome <-
20
+#                       BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
21
+# 
22
+#                   # Retrieve sequences
23
+#                   targets <-
24
+#                       getSeqsFromGRs(
25
+#                           annotatedBSJs,
26
+#                           genome,
27
+#                           lIntron = 101,
28
+#                           lExon = 9,
29
+#                           type = "ie"
30
+#                       )
31
+# 
32
+#                   # Retrieve motifs
33
+#                   # rbp = TRUE reverse = TRUE
34
+#                   motifs <-
35
+#                       getMotifs(
36
+#                           targets,
37
+#                           width = 6,
38
+#                           database = 'ATtRACT',
39
+#                           species = "Mmusculus",
40
+#                           rbp = TRUE,
41
+#                           reverse = TRUE
42
+#                       )
43
+#                   expect_is(motifs, "list")
44
+#                   expect_equal(length(motifs), 2)
45
+# 
46
+#                   # check nrow all data frame
47
+#                   expect_equal(nrow(motifs$upGR$targets), nrow(annotatedBSJs))
48
+#                   expect_equal(nrow(motifs$downGR$targets), nrow(annotatedBSJs))
49
+#                   expect_equal(ncol(motifs$upGR$counts) - 1, nrow(motifs$upGR$motif))
50
+# 
51
+#                   # Merge motifs
52
+#                   mergedMotifs <- mergeMotifs(motifs)
53
+#                   expect_is(mergedMotifs, "data.frame")
54
+# 
55
+#                   # Retrieve motifs
56
+#                   # rbp = FALSE reverse = FALSE
57
+#                   motifs <-
58
+#                       getMotifs(
59
+#                           targets,
60
+#                           width = 6,
61
+#                           database = 'ATtRACT',
62
+#                           species = "Mmusculus",
63
+#                           rbp = FALSE,
64
+#                           reverse = FALSE
65
+#                       )
66
+#                   expect_is(motifs, "list")
67
+#                   expect_equal(length(motifs), 2)
68
+# 
69
+#                   # check nrow all data frame
70
+#                   expect_equal(nrow(motifs$upGR$targets), nrow(annotatedBSJs))
71
+#                   expect_equal(nrow(motifs$downGR$targets), nrow(annotatedBSJs))
72
+#                   expect_equal(ncol(motifs$upGR$counts) - 1, nrow(motifs$upGR$motif))
73
+# 
74
+#                   # Merge motifs
75
+#                   mergedMotifs <- mergeMotifs(motifs)
76
+#                   expect_is(mergedMotifs, "data.frame")
77
+#               } else{
78
+#                   cat(
79
+#                       "Missing package BSgenome.Mmusculus.UCSC.mm10.
80
+#             Use BiocManager to install it."
81
+#                   )
82
+#               }
83
+# 
84
+# 
85
+# 
86
+#           })
87
+# 
88
+# 
89
+# test_that("getMotifs() generates a list with the correct
90
+#     content with GR seqs",
91
+#           {
92
+#               gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
93
+# 
94
+#               # Create the backSplicedJunctions without retriving the missing coordinates
95
+#               backSplicedJunctions <- getBackSplicedJunctions(gtf)
96
+#               mergedBSJunctions <-
97
+#                   mergeBSJunctions(backSplicedJunctions, gtf)
98
+# 
99
+#               # Annonate BSJs
100
+#               annotatedBSJs <- annotateBSJs(mergedBSJunctions[4,], gtf)
101
+# 
102
+#               if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
103
+#                   # Get BSgenome object
104
+#                   genome <-
105
+#                       BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
106
+# 
107
+#                   # Retrieve sequences
108
+#                   targets <-
109
+#                       getSeqsFromGRs(
110
+#                           annotatedBSJs,
111
+#                           genome,
112
+#                           lIntron = 101,
113
+#                           lExon = 9,
114
+#                           type = "ie"
115
+#                       )
116
+# 
117
+#                   # Retrieve motifs
118
+#                   motifs <-
119
+#                       getMotifs(
120
+#                           targets,
121
+#                           width = 4,
122
+#                           database = 'ATtRACT',
123
+#                           species = "Mmusculus",
124
+#                           rbp = TRUE,
125
+#                           reverse = TRUE
126
+#                       )
127
+# 
128
+#                   expect_equal(motifs$upGR$counts$UCUU[1], 0)
129
+#                   expect_equal(motifs$downGR$counts$UCUU[1], 1)
130
+# 
131
+#                   expect_equal(motifs$upGR$counts$UUCU[1], 0)
132
+#                   expect_equal(motifs$downGR$counts$UUCU[1], 2)
133
+# 
134
+# 
135
+#                   expect_equal(motifs$upGR$location$UUCU[1], "NA")
136
+#                   expect_equal(motifs$downGR$location$UUCU[1], "26,102")
137
+# 
138
+#                   expect_equal(motifs$upGR$location$UCUU[1], "NA")
139
+#                   expect_equal(motifs$downGR$location$UCUU[1], "103")
140
+# 
141
+#                   # check 2nd pattern
142
+#                   expect_equal(motifs$upGR$counts$AGAG[1], 2)
143
+#                   expect_equal(motifs$downGR$counts$AGAG[1], 2)
144
+# 
145
+#                   expect_equal(motifs$upGR$counts$GAGA[1], 1)
146
+#                   expect_equal(motifs$downGR$counts$GAGA[1], 2)
147
+# 
148
+#                   expect_equal(motifs$upGR$location$GAGA[1], "13")
149
+#                   expect_equal(motifs$downGR$location$GAGA[1], "18,56")
150
+# 
151
+#                   expect_equal(motifs$upGR$location$AGAG[1], "12,14")
152
+#                   expect_equal(motifs$downGR$location$AGAG[1], "17,55")
153
+#               } else{
154
+#                   cat(
155
+#                       "Missing package BSgenome.Mmusculus.UCSC.mm10.
156
+#             Use BiocManager to install it."
157
+#                   )
158
+#               }
159
+# 
160
+#           })
161
+# 
162
+# 
163
+# 
164
+# 
165
+# test_that(
166
+#     "getMotifs() and mergeMotifs() generates the correct data structure
167
+#     with circRNA and BSJ seqs",
168
+#     {
169
+#         gtf <- formatGTF(pathToGTF = "gencodeVM16.gtf")
170
+# 
171
+#         # Create the backSplicedJunctions without retriving the missing coordinates
172
+#         backSplicedJunctions <- getBackSplicedJunctions(gtf)
173
+#         mergedBSJunctions <-
174
+#             mergeBSJunctions(backSplicedJunctions, gtf)
175
+# 
176
+#         # Annonate BSJs
177
+#         annotatedBSJs <-
178
+#             annotateBSJs(mergedBSJunctions[9,], gtf)
179
+# 
180
+#         if (requireNamespace("BSgenome.Mmusculus.UCSC.mm10", quietly = TRUE)) {
181
+#             # Get BSgenome object
182
+#             genome <-
183
+#                 BSgenome::getBSgenome("BSgenome.Mmusculus.UCSC.mm10")
184
+# 
185
+#             # Retrieve sequences (BSJs)
186
+#             targets <-
187
+#                 getSeqsAcrossBSJs(annotatedBSJs,
188
+#                                   gtf,
189
+#                                   genome)
190
+# 
191
+#             # Retrieve motifs
192
+#             # rbp = TRUE reverse = TRUE
193
+#             motifs <-
194
+#                 getMotifs(
195
+#                     targets,
196
+#                     width = 4,
197
+#                     species = "Mmusculus",
198
+#                     rbp = TRUE,
199
+#                     reverse = TRUE
200
+#                 )
201
+#             expect_is(motifs, "list")
202
+#             expect_equal(length(motifs), 1)
203
+# 
204
+#             # check nrow all data frame
205
+#             expect_equal(nrow(motifs$bsj$targets), nrow(annotatedBSJs))
206
+#             expect_equal(ncol(motifs$bsj$counts) - 1, nrow(motifs$bsj$motif))
207
+# 
208
+#             # Merge motifs
209
+#             mergedMotifs <- mergeMotifs(motifs)
210
+#             expect_is(mergedMotifs, "data.frame")
211
+# 
212
+# 
213
+#             # Retrieve sequences (circRNA seqs)
214
+#             targets <-
215
+#                 getCircSeqs(annotatedBSJs,
216
+#                             gtf,
217
+#                             genome)
218
+# 
219
+#             # Retrieve motifs
220
+#             # rbp = TRUE reverse = TRUE
221
+#             motifs <-
222
+#                 getMotifs(
223
+#                     targets,
224
+#                     width = 4,
225
+#                     species = "Mmusculus",
226
+#                     rbp = TRUE,
227
+#                     reverse = TRUE
228
+#                 )
229
+# 
230
+#             expect_is(motifs, "list")
231
+#             expect_equal(length(motifs), 1)
232
+# 
233
+#             # check nrow all data frame
234
+#             expect_equal(nrow(motifs$circ$targets), nrow(annotatedBSJs))
235
+#             expect_equal(ncol(motifs$circ$counts) - 1, nrow(motifs$circ$motif))
236
+# 
237
+#             # Merge motifs
238
+#             mergedMotifs <- mergeMotifs(motifs)
239
+#             expect_is(mergedMotifs, "data.frame")
240
+#         } else{
241
+#             cat(
242
+#                 "Missing package BSgenome.Mmusculus.UCSC.mm10.
243
+#             Use BiocManager to install it."
244
+#             )
245
+#         }
246
+# 
247
+# 
248
+# })