From 45425775cdfdd38b72aca42fb6465a50298de800 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Thu, 18 Apr 2024 21:48:50 +0000 Subject: [PATCH 1/3] fix: add fill for rbindlist getChemblMechanism function in chembl.R --- R/chembl.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/chembl.R b/R/chembl.R index d3eede7..339eff9 100644 --- a/R/chembl.R +++ b/R/chembl.R @@ -135,9 +135,13 @@ queryChemblAPI <- function(resource, field, filter_type, value, format = "json") getChemblMechanism <- function( chembl.ID, resources = "mechanism", field = "molecule_chembl_id", filter_type = "in", returnURL = FALSE, raw = FALSE) { + + funContext <- .funContext("getChemblMechanism") # constructChemblQuery(resource = "mechanism", field = "molecule_chembl_id", filter_type = "in", value = "CHEMBL1413") # urls <- constructChemblQuery(resource = resources, field = field, filter_type = filter_type, value = chembl.ID) # urls <- URLencode(urls) + + .info(funContext, "Retrieving ChEMBL Mechanism information for ", length(chembl.ID), " ChEMBL IDs.") response_dts <- lapply(chembl.ID, function(chembl.ID) { request <- .build_chembl_request(resource = resources, field = field, filter_type = filter_type, value = chembl.ID) @@ -165,8 +169,8 @@ getChemblMechanism <- function( } x }) - - data.table::rbindlist(response_dts) + + data.table::rbindlist(response_dts, fill = TRUE) } From 46ce860c2b424ef001780813bd5ef991d7cc438b Mon Sep 17 00:00:00 2001 From: Jermiah Date: Thu, 18 Apr 2024 21:49:01 +0000 Subject: [PATCH 2/3] fix: improve error handling in queryUnichemCompound function --- R/unichem.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/unichem.R b/R/unichem.R index ac422e4..8bbefde 100644 --- a/R/unichem.R +++ b/R/unichem.R @@ -106,7 +106,12 @@ queryUnichemCompound <- function( if(raw) return(response) if(response$response != "Success"){ - .err("Unichem API request failed.") + msg <- paste( + "Unichem API request failed for compound", compound, " + with type", type, + " . Error:", response$error + ) + .err(.funContext("AnnotationGx::queryUnichemCompound"), msg) } # Mapping names to be consistent with other API calls From 01c35710b0a671afd2fae4d694af73f44178f994 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Thu, 18 Apr 2024 21:49:11 +0000 Subject: [PATCH 3/3] chore: Bump version to 0.0.0.9097 in DESCRIPTION file --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f3ef105..d8e5f71 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: AnnotationGx Title: AnnotationGx: A package for building, updating and querying an annotation database for pharmaco-genomic data -Version: 0.0.0.9096 +Version: 0.0.0.9097 Authors@R: c( person("Jermiah", "Joseph", role = c("aut", "cre"), email = "jermiah.joseph@gmail.com"),