@@ -126,7 +126,6 @@ fetch_interpro <- function(uniprot_ids = NULL,
126
126
# Store the results from the current page
127
127
all_results [[current_page ]] <- query
128
128
129
-
130
129
# initialize progress bar
131
130
if (show_progress == TRUE & current_page == 1 & length(query_url_part ) == 1 & (! is(query , " character" ) && ! is.null(query $ count ))) {
132
131
pb <- progress :: progress_bar $ new(
@@ -169,23 +168,41 @@ fetch_interpro <- function(uniprot_ids = NULL,
169
168
}
170
169
}
171
170
171
+ # check if any querys were not completed and give a message about them
172
+ if (exists(" query_result" ) && any(purrr :: map_lgl(query_result , .f = ~ {length(.x ) == 0 }))){
173
+ problematic_ids <- uniprot_ids [purrr :: map_lgl(query_result , .f = ~ {length(.x ) == 0 })]
174
+
175
+ message(" \n The following IDs do not exist in the InterPro database:\n " , paste0(problematic_ids , collapse = " \n " ))
176
+ }
177
+
172
178
# If any element is character stop the function and report the issue
173
179
if (exists(" query_result" ) && any(purrr :: map_lgl(query_result , .f = ~ {
174
- purrr :: map_lgl(.x , is.character )
180
+ if (length(.x ) == 0 ){
181
+ FALSE
182
+ } else {
183
+ purrr :: map_lgl(.x , is.character )
184
+ }
175
185
}))) {
176
186
problematic_ids <- uniprot_ids [purrr :: map_lgl(query_result , .f = ~ {
177
- any(purrr :: map_lgl(.x , is.character ))
187
+ if (length(.x ) == 0 ){
188
+ FALSE
189
+ } else {
190
+ any(purrr :: map_lgl(.x , is.character ))
191
+ }
178
192
})]
179
193
issue <- purrr :: keep(query_result , .p = ~ {
180
- purrr :: map_lgl(.x , is.character )
194
+ if (length(.x ) == 0 ){
195
+ FALSE
196
+ } else {
197
+ purrr :: map_lgl(.x , is.character )
198
+ }
181
199
}) %> %
182
200
unlist()
183
201
184
202
message(" \n There was an issue fetching from InterPro:\n " , paste0(problematic_ids , " : " , issue , " \n " ))
185
203
return (NULL )
186
204
}
187
205
188
-
189
206
# if residue level information should be returned, fetch it here
190
207
if (return_residue_info ) {
191
208
query_residue <- purrr :: map_dfr(
@@ -340,5 +357,5 @@ fetch_interpro <- function(uniprot_ids = NULL,
340
357
}
341
358
)
342
359
343
- domain_result
360
+ return ( domain_result )
344
361
}
0 commit comments