Skip to content

Commit

Permalink
Updated fail behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
daynefiler committed Dec 3, 2021
1 parent f5f8e34 commit 2a965c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion R/convertVariantIds.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ convertVariantIds <- function(varids, genomes) {
qry <- Query$new()$query('convertIds',
glue('query convertIds {{ {qryBody} }}'))
tryres <- try(jsn <- gmCon$exec(qry$convertIds), silent = TRUE)
if (is(tryres, 'try-error')) stop(qfailmessage)
if (is(tryres, 'try-error')) {
warning(qfailmessage)
return(tryres)
}
res <- fromJSON(jsn, flatten = TRUE)$data
res
}
Expand Down
5 changes: 4 additions & 1 deletion R/getVariantPopData.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ getVariantPopData <- function(varids, genomes) {
qry <- Query$new()$query('convertIds',
glue('query convertIds {{ {qryBody} }}'))
tryres <- try(jsn <- gmCon$exec(qry$convertIds), silent = TRUE)
if (is(tryres, 'try-error')) stop(qfailmessage)
if (is(tryres, 'try-error')) {
warning(qfailmessage)
return(tryres)
}
resLst <- fromJSON(jsn, flatten = TRUE)$data
procPopData <- function(x) {
cbind(varid = x$variantId,
Expand Down
5 changes: 4 additions & 1 deletion R/getVariantsFromRegion.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ getVariantsFromRegion <- function(genomes, chroms, starts, stops = starts) {
qry <- Query$new()$query('getRegion',
glue('query getRegion {{ {qryBody} }}'))
tryres <- try(jsn <- gmCon$exec(qry$getRegion), silent = TRUE)
if (is(tryres, 'try-error')) stop(qfailmessage)
if (is(tryres, 'try-error')) {
warning(qfailmessage)
return(tryres)
}
res <- lapply(fromJSON(jsn)$data, "[[", 1)
res
}
Expand Down

0 comments on commit 2a965c4

Please sign in to comment.