From 1119a3819462845ca4244b928fdf3eaae5d5c751 Mon Sep 17 00:00:00 2001 From: Paul Kruse Date: Mon, 10 Feb 2025 12:37:04 -0500 Subject: [PATCH 1/2] Added new projection value. --- R/chemical-APIs-batch.R | 5 +++-- man/get_chemical_details_batch.Rd | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/chemical-APIs-batch.R b/R/chemical-APIs-batch.R index 6ed425c3..6f8f7f13 100644 --- a/R/chemical-APIs-batch.R +++ b/R/chemical-APIs-batch.R @@ -7,7 +7,7 @@ #' @param Projection The format and chemical detail data returned. Allowed #' values are 'chemicaldetailall', 'chemicaldetailstandard', #' chemicalidentifier', 'chemicalstructure', 'ntatoolkit', -#' ccdchemicaldetails'. If left empty or there is a +#' ccdchemicaldetails', 'compact'. If left empty or there is a #' mismatch, the default format will be 'chemicaldetailstandard'. #' @param API_key The user-specific API key #' @param rate_limit Number of seconds to wait between each request @@ -137,7 +137,8 @@ get_chemical_details_batch_2 <- function(DTXSID = NULL, 'chemicalidentifier', 'chemicalstructure', 'ntatoolkit', - 'ccdchemicaldetails') + 'ccdchemicaldetails', + 'compact') index <- 2 if (!is.character(Projection)){ warning('Setting `Projection` to `chemicaldetailstandard`') diff --git a/man/get_chemical_details_batch.Rd b/man/get_chemical_details_batch.Rd index a3550cf9..9e5c1cfb 100644 --- a/man/get_chemical_details_batch.Rd +++ b/man/get_chemical_details_batch.Rd @@ -21,7 +21,7 @@ get_chemical_details_batch( \item{Projection}{The format and chemical detail data returned. Allowed values are 'chemicaldetailall', 'chemicaldetailstandard', chemicalidentifier', 'chemicalstructure', 'ntatoolkit', -ccdchemicaldetails'. If left empty or there is a +ccdchemicaldetails', 'compact'. If left empty or there is a mismatch, the default format will be 'chemicaldetailstandard'.} \item{API_key}{The user-specific API key} From f469b401c162fa981a363421ca58f6053f232ca6 Mon Sep 17 00:00:00 2001 From: Paul Kruse Date: Mon, 10 Feb 2025 12:37:21 -0500 Subject: [PATCH 2/2] Added new projection value. --- R/chemical-APIs.R | 13 +++++++++---- man/get_chemical_details.Rd | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/R/chemical-APIs.R b/R/chemical-APIs.R index c2736a36..1267d1fa 100644 --- a/R/chemical-APIs.R +++ b/R/chemical-APIs.R @@ -5,7 +5,7 @@ #' @param Projection The format and chemical detail data returned. Allowed #' values are 'chemicaldetailall', 'chemicaldetailstandard', #' 'chemicalidentifier', 'chemicalstructure', 'ntatoolkit', -#' 'ccdchemicaldetails'. If left empty or there is a mismatch, the default +#' 'ccdchemicaldetails', 'compact'. If left empty or there is a mismatch, the default #' format will be 'chemicaldetailstandard'. #' @param API_key The user-specific API key #' @param Server The root address for the API endpoint @@ -40,7 +40,8 @@ get_chemical_details <- function(DTXSID = NULL, 'chemicalidentifier', 'chemicalstructure', 'ntatoolkit', - 'ccdchemicaldetails') + 'ccdchemicaldetails', + 'compact') index <- 2 if (!is.character(Projection)){ warning('Setting `Projection` to `chemicaldetailstandard`') @@ -115,7 +116,7 @@ get_chemical_details <- function(DTXSID = NULL, create_data.table_chemical_details <- function(index = -1){ - if (index %in% 2:6 ){ + if (index %in% 2:7 ){ if (index == 2){ data <- data.table::data.table(id = character(), cpdataCount = integer(), @@ -191,7 +192,7 @@ create_data.table_chemical_details <- function(index = -1){ expocatMedianPrediction = character(), expocat = character(), nhanes = character()) - } else { + } else if (index == 6) { data <- data.table::data.table(id = character(), dtxsid = character(), dtxcid = character(), @@ -229,6 +230,10 @@ create_data.table_chemical_details <- function(index = -1){ inchikey = character(), wikipediaArticle = character(), cpdataCount = integer()) + } else { + data <- data.table::data.table(dtxsid = character(), + casrn = character(), + preferredName = character()) } return(data) } diff --git a/man/get_chemical_details.Rd b/man/get_chemical_details.Rd index a7aa2243..da6a68dd 100644 --- a/man/get_chemical_details.Rd +++ b/man/get_chemical_details.Rd @@ -21,7 +21,7 @@ get_chemical_details( \item{Projection}{The format and chemical detail data returned. Allowed values are 'chemicaldetailall', 'chemicaldetailstandard', 'chemicalidentifier', 'chemicalstructure', 'ntatoolkit', -'ccdchemicaldetails'. If left empty or there is a mismatch, the default +'ccdchemicaldetails', 'compact'. If left empty or there is a mismatch, the default format will be 'chemicaldetailstandard'.} \item{API_key}{The user-specific API key}