diff --git a/DESCRIPTION b/DESCRIPTION index bab363d1..a2048772 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Type: Package Package: ccdR -Title: Utilities for Interacting with the 'CCTE' APIs +Title: Utilities for Interacting with the 'CTX' APIs Version: 1.0.0 Authors@R: c( person("Paul", "Kruse", email = "kruse.paul@epa.gov", @@ -17,13 +17,15 @@ Authors@R: c( person("Jason", "Brown", role = "ctb", email = "brown.jason@epa.gov") ) -Description: Access chemical, hazard, and bioactivity data from the Center for - Computational Toxicology and Exposure ('CCTE') APIs +Description: Access chemical, hazard, bioactivity, and exposure data from the + Computational Toxicology and Exposure ('CTX') APIs . 'ccdR' was developed to streamline the - process of accessing the information available through the 'CCTE' APIs - without requiring prior knowledge of how to use APIs. All data is also - available on the CompTox Chemical Dashboard ('CCD') - . + process of accessing the information available through the 'CTX' APIs + without requiring prior knowledge of how to use APIs. Most data is also + available on the CompTox Chemical Dashboard ('CCD') + and other resources found at the + EPA Computational Toxicology and Exposure Online Resources + . License: GPL (>= 3) Imports: cli, diff --git a/NAMESPACE b/NAMESPACE index 698c59b8..788106cf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,21 +1,22 @@ # Generated by roxygen2: do not edit by hand -S3method(print,ccte_credentials) +S3method(print,ctx_credentials) export(ccdr_hide_api_key) export(ccdr_show_api_key) -export(ccte_key) export(chemical_contains) export(chemical_contains_batch) export(chemical_equal) export(chemical_equal_batch) export(chemical_starts_with) export(chemical_starts_with_batch) +export(ctx_key) export(get_all_assays) export(get_all_public_chemical_lists) export(get_annotation_by_aeid) export(get_annotation_by_aeid_batch) export(get_bioactivity_details) export(get_bioactivity_details_batch) +export(get_bioactivity_endpoint_status) export(get_bioactivity_summary) export(get_bioactivity_summary_batch) export(get_cancer_hazard) @@ -61,6 +62,7 @@ export(get_genetox_summary) export(get_genetox_summary_batch) export(get_hazard_by_dtxsid) export(get_hazard_by_dtxsid_batch) +export(get_hazard_endpoint_status) export(get_human_hazard_by_dtxsid) export(get_human_hazard_by_dtxsid_batch) export(get_inchi) @@ -81,7 +83,7 @@ export(get_skin_eye_hazard_batch) export(get_smiles) export(has_ccdr_option) export(has_ccdr_options) -export(has_ccte_key) +export(has_ctx_key) export(register_ccdr) export(set_ccdr_option) export(showing_key) diff --git a/R/attach.R b/R/attach.R index 813e216c..bd4099be 100644 --- a/R/attach.R +++ b/R/attach.R @@ -5,13 +5,13 @@ ' ', "CCTE's Terms of Service: ", cli::col_blue(cli::style_italic( - cli::style_hyperlink('', 'https://api-ccte.epa.gov/docs/') + cli::style_hyperlink('', 'https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis') )) ) cite <- paste0( cli::col_green(cli::symbol$info), ' ', - 'Please cite ', cli::col_blue('ccdr'), ' if you use it! Use `citation(\'ccdr\')` for details.' + 'Please cite ', cli::col_blue('ccdR'), ' if you use it! Use `citation(\'ccdR\')` for details.' ) rlang::inform( @@ -32,11 +32,11 @@ bootstrap_ccdr <- function() { set_ccdr_option( - 'ccte' = structure( + 'ctx' = structure( list( ), - class = 'ccte_credentials' + class = 'ctx_credentials' ), 'display_api_key' = FALSE ) @@ -68,7 +68,7 @@ bootstrap_ccdr <- function() { } else { if (!silent) packageStartupMessage("API key file found but no api entry.") } - } else if ((ev <- Sys.getenv("CCTE_API_KEY")) != "") { + } else if ((ev <- Sys.getenv("CTX_API_KEY")) != "") { .pkgenv[["api"]] <- ev if (!silent) packageStartupMessage("Setting API key from environment variable.") } else { diff --git a/R/bioactivity-APIs-batch.R b/R/bioactivity-APIs-batch.R index a25f4d25..7fd600aa 100644 --- a/R/bioactivity-APIs-batch.R +++ b/R/bioactivity-APIs-batch.R @@ -12,7 +12,7 @@ #' @return A named list of data.frames containing bioactivity information for #' the chemicals with DTXSID or assays with AEID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull bioactivity details for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' batch_bioactivity <- get_bioactivity_details_batch(DTXSID = dtxsid) @@ -28,8 +28,8 @@ get_bioactivity_details_batch <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -163,7 +163,7 @@ get_bioactivity_details_batch <- function(DTXSID = NULL, #' @return A named list of data.frames containing bioactivity summary #' information for the assays with AEID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Get bioactivity summary for multiple aeids #' aeids <- get_bioactivity_summary_batch(AEID = c(159, 160)) @@ -175,8 +175,8 @@ get_bioactivity_summary_batch <- function(AEID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -232,7 +232,7 @@ get_bioactivity_summary_batch <- function(AEID = NULL, #' @return A named list of data.frames containing annotation information for the #' assays with AEID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Get annotations for multiple aeids #' aeid_annotations <- get_annotation_by_aeid_batch(AEID = c(159, 160)) @@ -242,8 +242,8 @@ get_annotation_by_aeid_batch <- function(AEID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } diff --git a/R/bioactivity-APIs.R b/R/bioactivity-APIs.R index 9c271c3e..72f00f98 100644 --- a/R/bioactivity-APIs.R +++ b/R/bioactivity-APIs.R @@ -11,7 +11,7 @@ #' @return A data.frame containing bioactivity information for the chemical or assay endpoint with #' identifier matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull BPA bioactivity details #' bpa <- get_bioactivity_details(DTXSID = 'DTXSID7020182') #' # Pull assay bioactivity details @@ -30,8 +30,8 @@ get_bioactivity_details <- function(DTXSID = NULL, else if (length(which(!sapply(list(DTXSID, AEID, SPID, m4id), is.null))) > 1) stop('Please input a value for only one of DTXSID, AEID, SPID, or m4id, but not multiple!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -76,11 +76,7 @@ get_bioactivity_details <- function(DTXSID = NULL, stop('Please input an API_key!') } if(response$status_code == 200){ - req_content <- httr::content(response, as = 'text', encoding = "UTF-8") - if (nchar(req_content) == 0){ - return(data.table::data.table()) - } - res <- jsonlite::fromJSON(req_content) + res <- jsonlite::fromJSON(httr::content(response, as = 'text', encoding = "UTF-8")) if (!is.data.frame(res) & (length(res) != 0)){ for (i in 1:length(res)){ if (is.null(res[[i]])) res[[i]] <- NA # set any NULLs to NA @@ -93,35 +89,9 @@ get_bioactivity_details <- function(DTXSID = NULL, param_cols <- c('mc3Param', 'mc4Param', 'mc5Param', 'mc6Param') col_index <- which(param_cols %in% names(res)) if (length(col_index) > 0){ - # In some cases, columns are given by data.frames and we will not try to unnest these - non_df_cols <- param_cols[col_index][which(sapply(param_cols[col_index], function(t){!is.data.frame(res[[t]])}))] - if (length(non_df_cols) > 0) - # In some cases, columns will be NA (in the m4id cases) and we will not try to unnest these - col_index <- which(unname(!sapply(res[which(names(res) %in% non_df_cols)], is.na))) - if (length(col_index) > 0){ - res <- tidyr::unnest_wider(data = res, col = param_cols[col_index]) - } + res <- tidyr::unnest_wider(data = res, col = param_cols[col_index]) } - - res_dt <- data.table::data.table(res) - - # For columns which are lists of lists, we want to unnest the lists - # Check which columns that tend to return nested are in the data.table - nested_list_cols <- intersect(names(res_dt), c('resp', 'logc', 'flag', 'mc6MthdId')) - - # Check which of these columns are lists of lists. Every entry must be a - # list in order to be unnested - nested_indices <- sapply(seq_along(nested_list_cols), function(t) { - all(sapply(as.data.frame(res_dt)[, nested_list_cols[[t]]], is.list)) - }) - - # Unnest the columns which are nested lists - if (length(nested_indices) > 0 && any(nested_indices)){ - res_temp <- tidyr::unnest(data = as.data.frame(res_dt), cols = nested_list_cols[nested_indices]) - res_dt <- data.table::as.data.table(res_temp) - } - return(res_dt) } else { if (verbose){ @@ -141,7 +111,7 @@ get_bioactivity_details <- function(DTXSID = NULL, #' @return A data.frame containing summary information corresponding to the #' input AEID #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull an assay bioactivity summary #' aeid_1386 <- get_bioactivity_summary(AEID = 1386) get_bioactivity_summary <- function(AEID = NULL, @@ -153,8 +123,8 @@ get_bioactivity_summary <- function(AEID = NULL, if (is.null(AEID)) stop('Please input an AEID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -208,7 +178,7 @@ get_bioactivity_summary <- function(AEID = NULL, #' #' @return A data.frame containing all the assays and associated information #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Retrieve all assays #' assays <- get_all_assays() get_all_assays <- function(API_key = NULL, @@ -216,8 +186,8 @@ get_all_assays <- function(API_key = NULL, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -258,7 +228,7 @@ get_all_assays <- function(API_key = NULL, #' @return A data.frame containing the annotated assays corresponding to the #' input AEID parameter #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Retrieve annotation for an assay #' annotation <- get_annotation_by_aeid(AEID = 159) get_annotation_by_aeid <- function(AEID = NULL, @@ -268,8 +238,8 @@ get_annotation_by_aeid <- function(AEID = NULL, if (is.null(AEID)) stop('Please input an AEID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -313,3 +283,17 @@ get_annotation_by_aeid <- function(AEID = NULL, } + +#' Bioactivity API Endpoint status +#' +#' @return Status of Bioactivity API Endpoints +#' @export +#' +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') +#' status <- get_bioactivity_endpoint_status() +#' print(status) + +get_bioactivity_endpoint_status <- function(){ + request <- httr::GET(url = paste0(bioactivity_api_server, "/health")) + return(request$status_code) +} diff --git a/R/ccdr_options.R b/R/ccdr_options.R index 90c74a52..43c51019 100644 --- a/R/ccdr_options.R +++ b/R/ccdr_options.R @@ -2,7 +2,7 @@ #' #' ccdr stores options as a named list in R's global options, i.e. #' `getOption('ccdr')`. It currently stores two such options, one for CCTE -#' credentialing and one to supress private API information in the URLs printed +#' credentialing and one to suppress private API information in the URLs printed #' to the screen when web queries are placed. For both of those, see #' [register_ccdr()]. #' @@ -28,7 +28,7 @@ #' @rdname ccdr_options #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Set ccdr options #' set_ccdr_option('display_api_key' = FALSE) set_ccdr_option <- function(...) { @@ -62,7 +62,7 @@ set_ccdr_option <- function(...) { #' @rdname ccdr_options #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Check if there are options registered to 'ccdr' #' has_ccdr_options() @@ -72,7 +72,7 @@ has_ccdr_options <- function() { #' @rdname ccdr_options #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Check if a specific option is registered for 'ccdr' #' has_ccdr_option('display_api_key') diff --git a/R/chemical-APIs-batch.R b/R/chemical-APIs-batch.R index 591cf4e5..3cfc852f 100644 --- a/R/chemical-APIs-batch.R +++ b/R/chemical-APIs-batch.R @@ -18,7 +18,7 @@ #' containing chemical information for the chemicals with DTXSID or DTXCID #' matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical details for multiple chemicals by dtxsid #' dtxsids <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_details <- get_chemical_details_batch(DTXSID = dtxsid) @@ -42,8 +42,8 @@ get_chemical_details_batch <- function(DTXSID = NULL, } if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -120,8 +120,8 @@ get_chemical_details_batch_2 <- function(DTXSID = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -274,8 +274,8 @@ get_smiles_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -332,8 +332,8 @@ get_molecular_weight_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -390,8 +390,8 @@ get_mol_v3000_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -448,8 +448,8 @@ get_mol_v2000_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -506,8 +506,8 @@ get_InChI_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -564,8 +564,8 @@ get_canonical_smiles_batch <- function(names = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -628,7 +628,7 @@ get_canonical_smiles_batch <- function(names = NULL, #' @return A named list of data.frames containing chemical information for the #' chemicals matching the search criteria. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals by property ranges #' prop_ranges <- get_chemical_by_property_range_batch(start_list = c(1.311, #' 211.99), @@ -644,8 +644,8 @@ get_chemical_by_property_range_batch <- function(start_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -733,8 +733,8 @@ get_chem_info_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -802,7 +802,7 @@ get_chem_info_batch_old <- function(DTXSID = NULL, #' @return A data.table containing chemical information for the chemicals with #' DTXSID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical info for multiple chemicals #' chem_info <- get_chem_info_batch(DTXSID = c('DTXSID7020182', #' 'DTXSID2021315')) @@ -814,8 +814,8 @@ get_chem_info_batch <- function(DTXSID = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -909,8 +909,8 @@ get_fate_by_dtxsid_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -958,7 +958,7 @@ get_fate_by_dtxsid_batch_old <- function(DTXSID = NULL, #' @return A data.table containing chemical fate information for the chemicals #' with DTXSID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical fate by dtxsids #' chemical_fates <- get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182', #' 'DTXSID2021315')) @@ -969,8 +969,8 @@ get_fate_by_dtxsid_batch <- function(DTXSID = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1045,7 +1045,7 @@ get_fate_by_dtxsid_batch <- function(DTXSID = NULL, #' @return A named list of data.frames of chemicals and related values matching #' the query parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that start with given substrings #' bpa_substrings <- chemical_starts_with_batch(word_list = c('DTXSID702018', #' 'DTXCID3018')) @@ -1056,8 +1056,8 @@ chemical_starts_with_batch <- function(word_list = NULL, verbose = FALSE, top = NULL){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1120,7 +1120,7 @@ chemical_starts_with_batch <- function(word_list = NULL, #' @return A named list of data.frames of chemicals and related values matching #' the query parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that match input strings #' bpa <- chemical_equal_batch(word_list = c('DTXSID7020182', 'DTXCID30182')) @@ -1129,8 +1129,8 @@ chemical_equal_batch <- function(word_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1196,7 +1196,7 @@ chemical_equal_batch <- function(word_list = NULL, #' @return A named list of data.frames of chemicals and related values matching #' the query parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that contain substrings #' substring_chemicals <- chemical_contains_batch(word_list = c('TXDIS702018', #' 'DTXSID70201')) @@ -1207,8 +1207,8 @@ chemical_contains_batch <- function(word_list = NULL, verbose = verbose, top = NULL){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1272,7 +1272,7 @@ chemical_contains_batch <- function(word_list = NULL, #' mass value. #' @export #' -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' #Pull chemicals by msready mass and error offset #' msready_data <- get_msready_by_mass_with_error_batch(masses = c(226, 228), #' error = 4) @@ -1283,8 +1283,8 @@ get_msready_by_mass_with_error_batch <- function(masses = NULL, rate_limit = 0, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1349,7 +1349,7 @@ get_msready_by_mass_with_error_batch <- function(masses = NULL, #' @return A named list of character lists with DTXSIDs with msready masses #' falling within the given ranges. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull msready chemicals by mass ranges #' msready_data <- get_msready_by_mass_batch(start_list = c(200.9, 200.95), #' end_list = c(200.95, 201.00)) @@ -1360,8 +1360,8 @@ get_msready_by_mass_batch <- function(start_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1418,7 +1418,7 @@ get_msready_by_mass_batch <- function(start_list = NULL, #' @return A named list of character lists of DTXSIDs with chemical formulas #' matching the search criteria #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull msready data for several chemical formulas #' msready_data <- get_msready_by_formula_batch(formula_list = c('C16H24N2O5S', #' 'C15H16O2')) @@ -1428,8 +1428,8 @@ get_msready_by_formula_batch <- function(formula_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1476,7 +1476,7 @@ get_msready_by_formula_batch <- function(formula_list = NULL, #' @return A named list of character lists of DTXSIDs with DTXCIDs matching the #' search criteria #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull msready chemicals matching specific DTXCID #' dtxcid_msready <- get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182', #' 'DTXCID001315')) @@ -1486,8 +1486,8 @@ get_msready_by_dtxcid_batch <- function(DTXCID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1539,7 +1539,7 @@ get_msready_by_dtxcid_batch <- function(DTXCID = NULL, #' @return A named list of data.frames containing information about lists that #' meet the search criteria. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical lists by type #' federal_state <- get_chemical_lists_by_type_batch(type_list = c('Federal', #' 'State')) @@ -1550,8 +1550,8 @@ get_chemical_lists_by_type_batch <- function(type_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1606,7 +1606,7 @@ get_chemical_lists_by_type_batch <- function(type_list = NULL, #' chemicals in a given list, use \code{\link{get_chemicals_in_list}}. #' @seealso \code{\link{get_chemicals_in_list}} #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical list information by list names #' list_info <- get_public_chemical_list_by_name_batch(name_list = c('CCL4', #' 'NATADB')) @@ -1617,8 +1617,8 @@ get_public_chemical_list_by_name_batch <- function(name_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1667,7 +1667,7 @@ get_public_chemical_list_by_name_batch <- function(name_list = NULL, #' #' @return A named list of chemical lists that contain the given chemicals. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull lists containing chemicals for multiple chemicals #' lists <- get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182', #' 'DTXSID2021315')) @@ -1677,8 +1677,8 @@ get_lists_containing_chemical_batch <- function(chemical_list = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1727,7 +1727,7 @@ get_lists_containing_chemical_batch <- function(chemical_list = NULL, #' @return A named list of data.frames each containing chemicals in the #' corresponding chemical lists. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals in lists for multiple lists #' chemicals_in_lists <- get_chemicals_in_list_batch(list_names = c('CCL4', 'NATADB')) @@ -1736,8 +1736,8 @@ get_chemicals_in_list_batch <- function(list_names = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1787,7 +1787,7 @@ get_chemicals_in_list_batch <- function(list_names = NULL, #' @return A named list of XML file format for representing a mrv file for each #' chemicals. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull mrv files for multiple chemicals by DTXSID #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' mrv_files <- get_chemical_mrv_batch(DTXSID = dtxsid) @@ -1801,8 +1801,8 @@ get_chemical_mrv_batch <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1878,7 +1878,7 @@ get_chemical_mrv_batch <- function(DTXSID = NULL, #' @return A named list of character strings giving a mol file representations #' of the given input chemicals. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull mol files for multiple chemicals by DTXSID #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' mol_files <- get_chemical_mol_batch(DTXSID = dtxsid) @@ -1892,8 +1892,8 @@ get_chemical_mol_batch <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1973,7 +1973,7 @@ get_chemical_mol_batch <- function(DTXSID = NULL, #' displaying an image, one may use \code{png::writePNG()} or #' \code{countcolors::plotArrayAsImage()} among many such functions. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull images for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' images <- get_chemical_image_batch(DTXSID = dtxsid) @@ -1990,8 +1990,8 @@ get_chemical_image_batch <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -2101,7 +2101,7 @@ get_chemical_image_batch <- function(DTXSID = NULL, #' @return A named list of lists containing synonym information for each input #' DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull synonyms for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' batch_synonyms <- get_chemical_synonym_batch(DTXSID = dtxsid) @@ -2111,8 +2111,8 @@ get_chemical_synonym_batch <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } diff --git a/R/chemical-APIs.R b/R/chemical-APIs.R index be5397bb..f1758d8d 100644 --- a/R/chemical-APIs.R +++ b/R/chemical-APIs.R @@ -15,7 +15,7 @@ #' @return A data.table containing chemical information for the chemical with #' DTXSID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical details for BPA #' bpa <- get_chemical_details(DTXSID = 'DTXSID7020182') @@ -31,8 +31,8 @@ get_chemical_details <- function(DTXSID = NULL, stop('Please input either a DTXSID or DTXCID, but not both!') if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose){ message('Using stored API key!') } @@ -288,8 +288,8 @@ get_chemical_details_by_listname <- function(listname = NULL, } if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() message('Using stored API key!') } } @@ -326,7 +326,7 @@ get_chemical_details_by_listname <- function(listname = NULL, #' #' @return A string giving a SMILES string for the input chemical. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' bpa_smiles <- get_smiles(name = "Bisphenol A") get_smiles <- function(name = NULL, @@ -338,8 +338,8 @@ get_smiles <- function(name = NULL, } if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() message('Using stored API key!') } } @@ -374,7 +374,7 @@ get_smiles <- function(name = NULL, #' given. #' @return A string giving the associated InChIKey. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' bpa_inchikey <- get_inchikey(name = "Bisphenol A") get_inchikey <- function(name = NULL, @@ -386,8 +386,8 @@ get_inchikey <- function(name = NULL, } if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() message('Using stored API key!') } } @@ -422,7 +422,7 @@ get_inchikey <- function(name = NULL, #' given. #' @return A string giving the associated inchi string. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' bpa_inchi <- get_inchi(name = "Bisphenol A") get_inchi <- function(name = NULL, @@ -434,8 +434,8 @@ get_inchi <- function(name = NULL, } if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() message('Using stored API key!') } } @@ -474,7 +474,7 @@ get_inchi <- function(name = NULL, #' @return A data.frame containing chemical information for chemicals matching #' the search criteria. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals with a given property in a set range #' density <- get_chemical_by_property_range(start = 1.311, end = 1.313, #' property = 'Density') @@ -486,8 +486,8 @@ get_chemical_by_property_range <- function(start = NULL, Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() message('Using stored API key!') } } @@ -542,7 +542,7 @@ get_chemical_by_property_range <- function(start = NULL, #' @return A data.frame containing chemical information for the chemical with #' DTXSID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical information for BPA #' bpa <- get_chem_info(DTXSID = 'DTXSID7020182') @@ -554,8 +554,8 @@ get_chem_info <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if(verbose){ message('Using stored API key!') } @@ -622,7 +622,7 @@ get_chem_info <- function(DTXSID = NULL, #' @return @return A data.frame containing chemical information for the chemical with #' DTXSID matching the input parameter. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical fate data for BPA #' bpa <- get_fate_by_dtxsid(DTXSID = 'DTXSID7020182') @@ -633,8 +633,8 @@ get_fate_by_dtxsid <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -677,7 +677,7 @@ get_fate_by_dtxsid <- function(DTXSID = NULL, #' @return A data.frame of chemicals and related values matching the query #' parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that start with a fragment DTXSID #' dtxsid_fragment <- chemical_starts_with(word = 'DTXSID702018') @@ -689,8 +689,8 @@ chemical_starts_with <- function(word = NULL, if (is.null(word) || !is.character(word)){ stop('Please input a character value for word!') } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -745,7 +745,7 @@ chemical_starts_with <- function(word = NULL, #' @return A data.frame of chemicals and related values matching the query #' parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals with matching DTXSID #' bpa_dtxsid <- chemical_equal(word = 'DTXSID7020182') @@ -756,8 +756,8 @@ chemical_equal <- function(word = NULL, if (is.null(word) || !is.character(word)){ stop('Please input a character value for word!') } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -805,7 +805,7 @@ chemical_equal <- function(word = NULL, #' @return A data.frame of chemicals and related values matching the query #' parameters #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that contain substring #' substring_chemicals <- chemical_contains(word = 'TXSID702018') @@ -817,8 +817,8 @@ chemical_contains <- function(word = NULL, if (is.null(word) || !is.character(word)){ stop('Please input a character value for word!') } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -903,7 +903,7 @@ prepare_word <- function(word){ #' #' @return A list of DTXSIDs with msready mass falling within the given range. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals with msready mass in given range #' mass_range <- get_msready_by_mass(start = 200.9, end = 200.95) @@ -915,8 +915,8 @@ get_msready_by_mass <- function(start = NULL, if(is.null(start) || is.null(end) || !is.numeric(start) || !is.numeric(end)){ stop('Please input a numeric value for both start and end!') } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -966,7 +966,7 @@ get_msready_by_mass <- function(start = NULL, #' @return A character list of DTXSIDs with chemical formulas matching the #' search criteria #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals that match input formula #' mass_formula <- get_msready_by_formula(formula = 'C16H24N2O5S') @@ -979,8 +979,8 @@ get_msready_by_formula <- function(formula = NULL, } else if (!is.character(formula)){ stop("Please input a character string for the formula parameter!") } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1019,7 +1019,7 @@ get_msready_by_formula <- function(formula = NULL, #' @return A character list of DTXSIDs with DTXCIDs matching the #' search criteria #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemicals with matching DTXCID #' dtxcid_msready <- get_msready_by_dtxcid(DTXSID = 'DTXCID30182') @@ -1032,8 +1032,8 @@ get_msready_by_dtxcid <- function(DTXCID = NULL, } else if (!is.character(DTXCID)){ stop("Please input a character string for the DTXCID parameter!") } else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1077,7 +1077,7 @@ get_msready_by_dtxcid <- function(DTXCID = NULL, #' @return A data.frame containing information about lists that meet the search #' criteria. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical lists by type #' federal <- get_chemical_lists_by_type(type = 'Federal') @@ -1089,8 +1089,8 @@ get_chemical_lists_by_type <- function(type = NULL, if (is.null(type) | !is.character(type)) stop('Please input a value for parameter type from the list `federal`, `international`, `state`, and `other`!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1154,7 +1154,7 @@ get_chemical_lists_by_type <- function(type = NULL, #' use \code{\link{get_chemicals_in_list}}. #' @seealso \code{\link{get_chemicals_in_list}} #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical list by list name #' ccl4 <- get_public_chemical_list_by_name(list_name = 'CCL4') @@ -1166,8 +1166,8 @@ get_public_chemical_list_by_name <- function(list_name = NULL, if (is.null(list_name)) stop('Please input list_name!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1225,7 +1225,7 @@ get_public_chemical_list_by_name <- function(list_name = NULL, #' #' @return A list of names of chemical lists that contain the given chemical #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical lists containing BPA #' bpa_lists <- get_lists_containing_chemical(DTXSID = 'DTXSID7020182') @@ -1236,8 +1236,8 @@ get_lists_containing_chemical <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a non-null value for DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1273,7 +1273,7 @@ get_lists_containing_chemical <- function(DTXSID = NULL, #' #' @return A data.frame of the chemical list #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Retrieve chemicals contained in chemical list 'CCL4' #' ccl4_chemicals <- get_chemicals_in_list(list_name = 'CCL4') @@ -1290,8 +1290,8 @@ get_chemicals_in_list <- function(list_name = NULL, if (is.null(list_name) | !is.character(list_name)) stop('Please input a character value for list_name!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1344,8 +1344,8 @@ get_chemicals_in_list_start <- function(list_name = NULL, else if (is.null(word) | !is.character(word)) stop('Please input a character value for word!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1386,9 +1386,9 @@ get_chemicals_in_list_start <- function(list_name = NULL, #' @param verbose A logical indicating if some “progress report” should be given. #' #' @return A data.frame containing information on all public chemical lists -#' available from the CCTE chemical api. +#' available from the CTX chemical api. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull all chemical lists #' all_lists <- get_all_public_chemical_lists() @@ -1397,8 +1397,8 @@ get_all_public_chemical_lists <- function(Projection = '', Server = chemical_api_server, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1456,7 +1456,7 @@ get_all_public_chemical_lists <- function(Projection = '', #' #' @return XML file format for representing a mrv file. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull mrv file for BPA by dtxsid #' bpa_mrv <- get_chemical_mrv(DTXSID = 'DTXSID7020182') #' # Pull mrv file for BPA by dtxcid @@ -1472,8 +1472,8 @@ get_chemical_mrv <- function(DTXSID = NULL, else if (!is.null(DTXSID) & !is.null(DTXCID)) stop('Please input either a DTXSID or DTXCID, but not both!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1519,7 +1519,7 @@ get_chemical_mrv <- function(DTXSID = NULL, #' #' @return A character string giving a mol file representation #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull mol file for BPA by dtxsid #' bpa_mol <- get_chemical_mol(DTXSID = 'DTXSID7020182') #' # Pull mol file for BPA by dtxcid @@ -1535,8 +1535,8 @@ get_chemical_mol <- function(DTXSID = NULL, else if (!is.null(DTXSID) & !is.null(DTXCID)) stop('Please input either a DTXSID or DTXCID, but not both!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1588,7 +1588,7 @@ get_chemical_mol <- function(DTXSID = NULL, #' displaying this, one may use \code{png::writePNG()} or #' \code{countcolors::plotArrayAsImage()} among many such functions. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull chemical image for BPA by dtxsid #' bpa_image_matrix <- get_chemical_image(DTXSID = 'DTXSID7020182') #' if (requireNamespace("countcolors", quietly = TRUE)){ @@ -1612,8 +1612,8 @@ get_chemical_image <- function(DTXSID = NULL, else if (length(which(!sapply(list(DTXSID, DTXCID, SMILES), is.null))) > 1) stop('Please input only one DTXSID, DTXCID, or SMILES, and not multiple!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1672,7 +1672,7 @@ get_chemical_image <- function(DTXSID = NULL, #' #' @return A named list of synonym information for the input DTXSID #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull synonyms for BPA #' bpa_synonym <- get_chemical_synonym(DTXSID = 'DTXSID7020182') @@ -1683,8 +1683,8 @@ get_chemical_synonym <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -1717,11 +1717,11 @@ get_chemical_synonym <- function(DTXSID = NULL, #' @return Status of Chemical API Endpoints #' @export #' -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' status <- get_chemical_endpoint_status() #' print(status) get_chemical_endpoint_status <- function(){ - request <- httr::GET(url = "https://api-ccte.epa.gov/chemical/health") + request <- httr::GET(url = paste0(chemical_api_server, "/health")) return(request$status_code) } diff --git a/R/exposure-APIs-batch.R b/R/exposure-APIs-batch.R index 42bb7c73..e86ffcf6 100644 --- a/R/exposure-APIs-batch.R +++ b/R/exposure-APIs-batch.R @@ -11,7 +11,7 @@ #' data for each input DTXSID. #' @export #' -#' @examples has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examples has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull exposure functional use data for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_func_use <- get_exposure_functional_use_batch(DTXSID = dtxsid) @@ -22,8 +22,8 @@ get_exposure_functional_use_batch <- function(DTXSID = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -79,7 +79,7 @@ get_exposure_functional_use_batch <- function(DTXSID = NULL, #' categories that have probability of 0 #' @export #' -#' @examples has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examples has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull exposure functional use probability data for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_func_use_prob <- get_exposure_functional_use_batch(DTXSID = dtxsid) @@ -89,8 +89,8 @@ get_exposure_functional_use_probability_batch <- function(DTXSID = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -164,7 +164,7 @@ get_exposure_functional_use_probability_batch <- function(DTXSID = NULL, #' data for each input DTXSID. #' @export #' -#' @examples has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examples has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull exposure functional use data for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_product_data <- get_exposure_product_data_batch(DTXSID = dtxsid) @@ -174,8 +174,8 @@ get_exposure_product_data_batch <- function(DTXSID = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -227,7 +227,7 @@ get_exposure_product_data_batch <- function(DTXSID = NULL, #' tags use data for each input DTXSID. #' @export #' -#' @examples has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examples has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull exposure functional use data for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' exp_list_tags <- get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = dtxsid) @@ -238,8 +238,8 @@ get_exposure_list_presence_tags_by_dtxsid_batch <- function(DTXSID = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } diff --git a/R/exposure-APIs.R b/R/exposure-APIs.R index 5ef212e3..f1bf5fbf 100644 --- a/R/exposure-APIs.R +++ b/R/exposure-APIs.R @@ -7,7 +7,7 @@ #' #' @return A data.frame of functional use data. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull functional use data for BPA #' bpa <- get_exposure_functional_use(DTXSID = 'DTXSID7020182') @@ -18,8 +18,8 @@ get_exposure_functional_use <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input an DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -56,7 +56,7 @@ get_exposure_functional_use <- function(DTXSID = NULL, #' @return A data.frame with probabilities corresponding to various routes of #' exposure related to functional use. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull functional use probability data for BPA #' bpa <- get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182') @@ -67,8 +67,8 @@ get_exposure_functional_use_probability <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input an DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -102,7 +102,7 @@ get_exposure_functional_use_probability <- function(DTXSID = NULL, #' #' @return A data.frame of functional use categories. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull functional use category data for BPA #' functional_use_categories <- get_exposure_functional_use_category() @@ -110,8 +110,8 @@ get_exposure_functional_use_category <- function(API_key = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -147,7 +147,7 @@ get_exposure_functional_use_category <- function(API_key = NULL, #' @return A data.frame with product information relating to exposure to the #' given chemical #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull exposure product data for BPA #' bpa <- get_exposure_product_data(DTXSID = 'DTXSID7020182') @@ -158,8 +158,8 @@ get_exposure_product_data <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input an DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -193,7 +193,7 @@ get_exposure_product_data <- function(DTXSID = NULL, #' #' @return A data.frame consisting of all the product use categories #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull product data use categories for BPA #' puc_categories <- get_exposure_product_data_puc() @@ -201,8 +201,8 @@ get_exposure_product_data_puc <- function(API_key = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -237,7 +237,7 @@ get_exposure_product_data_puc <- function(API_key = NULL, #' #' @return A data.frame with all the list presence tags and associated data. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull list presence tags #' tags <- get_exposure_list_presence_tags() @@ -245,8 +245,8 @@ get_exposure_list_presence_tags <- function(API_key = NULL, Server = exposure_api_server, verbose = FALSE){ if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -281,7 +281,7 @@ get_exposure_list_presence_tags <- function(API_key = NULL, #' #' @return A data.frame of document information and list presence tags #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull list presence tags for BPA #' bpa <- get_exposure_list_presence_tags(DTXSID = 'DTXSID7020182') @@ -292,8 +292,8 @@ get_exposure_list_presence_tags_by_dtxsid <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input an DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()){ - API_key <- ccte_key() + if (has_ctx_key()){ + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -325,11 +325,11 @@ get_exposure_list_presence_tags_by_dtxsid <- function(DTXSID = NULL, #' @return Status of Exposure API Endpoints #' @export #' -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' status <- get_exposure_endpoint_status() #' print(status) get_exposure_endpoint_status <- function(){ - request <- httr::GET(url = "https://api-ccte.epa.gov/exposure/health") + request <- httr::GET(url = paste0(exposure_api_server, "/health")) return(request$status_code) } diff --git a/R/hazard-APIs-batch.R b/R/hazard-APIs-batch.R index 51a5a1f1..05fa3fd4 100644 --- a/R/hazard-APIs-batch.R +++ b/R/hazard-APIs-batch.R @@ -14,8 +14,8 @@ get_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -65,7 +65,7 @@ get_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, #' @return A data.table containing chemical (human and eco) hazard data for each #' input chemical. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull hazard data for multiple chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' batch_hazard <- get_hazard_by_dtxsid_batch(DTXSID = dtxsid) @@ -76,8 +76,8 @@ get_hazard_by_dtxsid_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -183,8 +183,8 @@ get_human_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -233,7 +233,7 @@ get_human_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, #' #' @return A data.table containing chemical human hazard data. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull human hazard data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_human_hazard <- get_human_hazard_by_dtxsid_batch(DTXSID = dtxsid) @@ -244,8 +244,8 @@ get_human_hazard_by_dtxsid_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -316,8 +316,8 @@ get_ecotox_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -366,7 +366,7 @@ get_ecotox_hazard_by_dtxsid_batch_old <- function(DTXSID = NULL, #' #' @return A data.table containing chemical ecotox hazard data. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull ecotox hazard data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_ecotox_hazard <- get_ecotox_hazard_by_dtxsid_batch(DTXSID = dtxsid) @@ -377,8 +377,8 @@ get_ecotox_hazard_by_dtxsid_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -450,8 +450,8 @@ get_skin_eye_hazard_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -501,7 +501,7 @@ get_skin_eye_hazard_batch_old <- function(DTXSID = NULL, #' @return A named list of data.frames containing skin and eye hazard data for #' each input DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull skin eye hazard data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_skin_eye_hazard <- get_skin_eye_hazard_batch(DTXSID = dtxsid) @@ -512,8 +512,8 @@ get_skin_eye_hazard_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -596,8 +596,8 @@ get_cancer_hazard_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -647,7 +647,7 @@ get_cancer_hazard_batch_old <- function(DTXSID = NULL, #' @return A data.table containing cancer hazard and #' related data for each input DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull cancer hazard data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_cancer_hazard <- get_cancer_hazard_batch(DTXSID = dtxsid) @@ -658,8 +658,8 @@ get_cancer_hazard_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -737,8 +737,8 @@ get_genetox_summary_batch_old <- function(DTXSID = NULL, rate_limit = 0L, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -789,7 +789,7 @@ get_genetox_summary_batch_old <- function(DTXSID = NULL, #' @return A data.table of genetox summary data for each input #' DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull genetox summary data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_genetox_summary_hazard <- get_genetox_summary_batch(DTXSID = dtxsid) @@ -800,8 +800,8 @@ get_genetox_summary_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -882,8 +882,8 @@ get_genetox_details_batch_old <- function(DTXSID = NULL, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -934,7 +934,7 @@ get_genetox_details_batch_old <- function(DTXSID = NULL, #' @return A data.table of genetox detail data for each input #' DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull genetox details data for multiples chemicals #' dtxsid <- c('DTXSID7020182', 'DTXSID2021315') #' dtxsid_genetox_details_hazard <- get_genetox_details_batch(DTXSID = dtxsid) @@ -945,8 +945,8 @@ get_genetox_details_batch <- function(DTXSID = NULL, Server = hazard_api_server, verbose = FALSE){ if (is.null(API_key) || !is.character(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } diff --git a/R/hazard-APIs.R b/R/hazard-APIs.R index 20285b7e..fe7c1399 100644 --- a/R/hazard-APIs.R +++ b/R/hazard-APIs.R @@ -7,7 +7,7 @@ #' #' @return A data.frame containing chemical (human and eco) hazard data #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull hazard data for BPA #' bpa <- get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') @@ -18,8 +18,8 @@ get_hazard_by_dtxsid <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -56,7 +56,7 @@ get_hazard_by_dtxsid <- function(DTXSID = NULL, #' #' @return A data.frame containing chemical human hazard data #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull human hazard data for BPA #' bpa_human <- get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') @@ -67,8 +67,8 @@ get_human_hazard_by_dtxsid <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -104,7 +104,7 @@ get_human_hazard_by_dtxsid <- function(DTXSID = NULL, #' #' @return A data.frame containing chemical (ecotox) hazard data #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull ecotox hazard data for BPA #' bpa_ecotox <- get_ecotox_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') @@ -115,8 +115,8 @@ get_ecotox_hazard_by_dtxsid <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -153,7 +153,7 @@ get_ecotox_hazard_by_dtxsid <- function(DTXSID = NULL, #' #' @return A data.frame containing skin and eye hazard data. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull skin and eye hazard data for BPA #' bpa_skin_eye <- get_skin_eye_hazard_batch(DTXSID = 'DTXSID7020182') @@ -164,8 +164,8 @@ get_skin_eye_hazard <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -201,7 +201,7 @@ get_skin_eye_hazard <- function(DTXSID = NULL, #' #' @return A data.frame of cancer hazard data related to the input DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull cancer hazard data for BPA #' bpa_cancer <- get_cancer_hazard(DTXSID = 'DTXSID7020182') @@ -212,8 +212,8 @@ get_cancer_hazard <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -250,7 +250,7 @@ get_cancer_hazard <- function(DTXSID = NULL, #' #' @return A data.frame of genetox summary data related to the input DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull genetox summary for BPA #' bpa_genetox_summary <- get_genetox_summary(DTXSID = 'DTXSID7020182') @@ -261,8 +261,8 @@ get_genetox_summary <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -299,7 +299,7 @@ get_genetox_summary <- function(DTXSID = NULL, #' #' @return A data.frame of genetox detail data related to the input DTXSID. #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Pull genetox details for BPA #' bpa_genetox_details <- get_genetox_details(DTXSID = 'DTXSID7020182') @@ -310,8 +310,8 @@ get_genetox_details <- function(DTXSID = NULL, if (is.null(DTXSID)) stop('Please input a DTXSID!') else if (is.null(API_key)){ - if (has_ccte_key()) { - API_key <- ccte_key() + if (has_ctx_key()) { + API_key <- ctx_key() if (verbose) { message('Using stored API key!') } @@ -338,3 +338,18 @@ get_genetox_details <- function(DTXSID = NULL, return() } + + +#' Hazard API Endpoint status +#' +#' @return Status of Hazard API Endpoints +#' @export +#' +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') +#' status <- get_hazard_endpoint_status() +#' print(status) + +get_hazard_endpoint_status <- function(){ + request <- httr::GET(url = paste0(hazard_api_server,"/health")) + return(request$status_code) +} diff --git a/R/register_ccte.R b/R/register_ctx.R similarity index 77% rename from R/register_ccte.R rename to R/register_ctx.R index 5ace4b24..b4817e4f 100644 --- a/R/register_ccte.R +++ b/R/register_ctx.R @@ -1,11 +1,12 @@ -#' Register a CCTE API +#' Register a CTX API #' -#' This page contains documentation tools related to enabling CCTE API services +#' This page contains documentation tools related to enabling CTX API services #' in R. #' #' To obtain an API key and enable services, go to -#' \url{https://api-ccte.epa.gov/docs/}. This documentation shows you how to -#' obtain an API key to allow access to the CCTE APIs. +#' \url{https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis}. +#' This documentation shows you how to obtain an API key to allow access to the +#' CTX APIs. #' #' To tell ccdR about your API key, use [register_ccdr()], e.g. @@ -18,8 +19,8 @@ #' #' Users should be aware that the API key, a string of garbled #' characters/numbers/symbols, is a PRIVATE key - it uniquely identifies and -#' authenticates you to CCTE's services. If anyone gets your API key, they can -#' use it to masquerade as you to CCTE. To mitigate against users inadvertently +#' authenticates you to CTX's services. If anyone gets your API key, they can +#' use it to masquerade as you to CTX. To mitigate against users inadvertently #' sharing their keys, by default ccdR never displays a user's key in messages #' displayed to the console. #' @@ -46,20 +47,20 @@ #' * `register_ccdr()` has no return value but has the side effect of #' storing the API key. #' -#' * `print.ccte_credentials()` has no return value and is an S3 method for -#' printing the `ccte_credentials` class. +#' * `print.ctx_credentials()` has no return value and is an S3 method for +#' printing the `ctx_credentials` class. #' -#' * `ccte_key()` returns a string, either the stored API key or +#' * `ctx_key()` returns a string, either the stored API key or #' \code{NA_character_}. #' -#' * `has_ccte_key()` returns a Boolean. +#' * `has_ctx_key()` returns a Boolean. #' @name register_ccdr #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Check if API key is showing #' showing_key() @@ -76,7 +77,7 @@ showing_key <- function() { #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Toggle API key to display #' ccdr_show_api_key() @@ -90,7 +91,7 @@ ccdr_show_api_key <- function() { #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Toggle API key to be hidden #' ccdr_hide_api_key() @@ -104,7 +105,7 @@ ccdr_hide_api_key <- function() { #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Register key for this session #' register_ccdr(key = 'YOUR API KEY') #' # Register key over sessions @@ -171,13 +172,13 @@ register_ccdr <- function(key, write = FALSE) { # # set key in current session .pkgenv[["api"]] <- key - #Sys.setenv('CCTE_API_KEY' = key) + #Sys.setenv('CTX_API_KEY' = key) } else if (!missing(key) && !write) { # set key in current session .pkgenv[["api"]] <- key - #Sys.setenv('CCTE_API_KEY' = key) + #Sys.setenv('CTX_API_KEY' = key) } @@ -197,24 +198,24 @@ register_ccdr <- function(key, write = FALSE) { #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') -#' # Print function for ccte_credentials class -#' print.ccte_credentials() +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') +#' # Print function for ctx_credentials class +#' print.ctx_credentials() -print.ccte_credentials <- function(...) { - cat('Key -', if (!has_ccte_key()) '' else {if(showing_key()) ccte_key() else 'xxx' }, '\n') +print.ctx_credentials <- function(...) { + cat('Key -', if (!has_ctx_key()) '' else {if(showing_key()) ctx_key() else 'xxx' }, '\n') } #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') -#' # Display ccte API key -#' ccte_key() +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') +#' # Display ctx API key +#' ctx_key() -ccte_key <- function() { - key <- .pkgenv[["api"]] #Sys.getenv('CCTE_API_KEY') +ctx_key <- function() { + key <- .pkgenv[["api"]] #Sys.getenv('CTX_API_KEY') if (key == '') { return(NA_character_) @@ -226,11 +227,11 @@ ccte_key <- function() { #' @rdname register_ccdr #' @export -#' @examplesIf has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +#' @examplesIf has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') #' # Check whether API key is registered -#' has_ccte_key() +#' has_ctx_key() -has_ccte_key <- function () !is.na(ccte_key()) +has_ctx_key <- function () !is.na(ctx_key()) diff --git a/README.Rmd b/README.Rmd index 7c7f39c5..b62b553a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -16,9 +16,12 @@ knitr::opts_chunk$set( # ccdR +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/ccdR)](https://cran.r-project.org/package=ccdR) +[![Monthly Downloads](https://cranlogs.r-pkg.org/badges/last-month/ccdR?color=7BAFD4)](https://cranlogs.r-pkg.org/badges/last-month/ccdR?color=7BAFD4) -The goal of ccdR is to provide R users a set of functions to access the [CCTE API](https://api-ccte.epa.gov/docs/index.html) without requiring extensive experience interacting directly with APIs. +The goal of ccdR is to provide R users a set of functions to access the [CTX APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis) +without requiring extensive experience interacting directly with APIs. ## Installation @@ -39,4 +42,4 @@ install.packages('ccdR') ``` -Disclaimer: You won't need a API key to install the ccdR package, but will need to supply an API key to use ccdR. Please visit [CCTE API](https://api-ccte.epa.gov/docs/index.html) to request an API key. +Disclaimer: You won't need a API key to install the ccdR package, but will need to supply an API key to use ccdR. Please visit [CTX APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis) to request an API key. diff --git a/README.md b/README.md index 5a18662c..58f9c864 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,16 @@ # ccdR + +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/ccdR)](https://cran.r-project.org/package=ccdR) +[![Monthly +Downloads](https://cranlogs.r-pkg.org/badges/last-month/ccdR?color=7BAFD4)](https://cranlogs.r-pkg.org/badges/last-month/ccdR?color=7BAFD4) The goal of ccdR is to provide R users a set of functions to access the -[CCTE API](https://api-ccte.epa.gov/docs/index.html) without requiring -extensive experience interacting directly with APIs. +[CTX +APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis) +without requiring extensive experience interacting directly with APIs. ## Installation @@ -20,7 +25,7 @@ if (!library(devtools, logical.return = TRUE)){ library(devtools) } -devtools::install_github("USEPA/ccdR") +devtools::install_gitub("USEPA/ccdR") ``` You can install from CRAN using the following: @@ -30,5 +35,6 @@ install.packages('ccdR') ``` Disclaimer: You won’t need a API key to install the ccdR package, but -will need to supply an API key to use ccdR. Please visit [CCTE -API](https://api-ccte.epa.gov/docs/index.html) to request an API key. +will need to supply an API key to use ccdR. Please visit [CTX +APIs](https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis) +to request an API key. diff --git a/man/ccdr_options.Rd b/man/ccdr_options.Rd index 9da3061f..bf97fe89 100644 --- a/man/ccdr_options.Rd +++ b/man/ccdr_options.Rd @@ -29,20 +29,20 @@ of setting options used by other functions. \description{ ccdr stores options as a named list in R's global options, i.e. \code{getOption('ccdr')}. It currently stores two such options, one for CCTE -credentialing and one to supress private API information in the URLs printed +credentialing and one to suppress private API information in the URLs printed to the screen when web queries are placed. For both of those, see \code{\link[=register_ccdr]{register_ccdr()}}. } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Set ccdr options set_ccdr_option('display_api_key' = FALSE) \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Check if there are options registered to 'ccdr' has_ccdr_options() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Check if a specific option is registered for 'ccdr' has_ccdr_option('display_api_key') \dontshow{\}) # examplesIf} diff --git a/man/chemical_contains.Rd b/man/chemical_contains.Rd index 7bbf6036..f397d4c7 100644 --- a/man/chemical_contains.Rd +++ b/man/chemical_contains.Rd @@ -33,7 +33,7 @@ parameters Chemical contains } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that contain substring substring_chemicals <- chemical_contains(word = 'TXSID702018') \dontshow{\}) # examplesIf} diff --git a/man/chemical_contains_batch.Rd b/man/chemical_contains_batch.Rd index 03ee5714..b73669c4 100644 --- a/man/chemical_contains_batch.Rd +++ b/man/chemical_contains_batch.Rd @@ -33,7 +33,7 @@ the query parameters Chemical contains batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that contain substrings substring_chemicals <- chemical_contains_batch(word_list = c('TXDIS702018', 'DTXSID70201')) diff --git a/man/chemical_equal.Rd b/man/chemical_equal.Rd index a2fb804c..a5e3aca7 100644 --- a/man/chemical_equal.Rd +++ b/man/chemical_equal.Rd @@ -29,7 +29,7 @@ parameters Chemical equal } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals with matching DTXSID bpa_dtxsid <- chemical_equal(word = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/chemical_equal_batch.Rd b/man/chemical_equal_batch.Rd index 6a4e4324..87cf8b6f 100644 --- a/man/chemical_equal_batch.Rd +++ b/man/chemical_equal_batch.Rd @@ -29,7 +29,7 @@ the query parameters Chemical equal batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that match input strings bpa <- chemical_equal_batch(word_list = c('DTXSID7020182', 'DTXCID30182')) \dontshow{\}) # examplesIf} diff --git a/man/chemical_starts_with.Rd b/man/chemical_starts_with.Rd index bb2ecd5b..c01b7bc8 100644 --- a/man/chemical_starts_with.Rd +++ b/man/chemical_starts_with.Rd @@ -34,7 +34,7 @@ parameters Chemical starts with } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that start with a fragment DTXSID dtxsid_fragment <- chemical_starts_with(word = 'DTXSID702018') \dontshow{\}) # examplesIf} diff --git a/man/chemical_starts_with_batch.Rd b/man/chemical_starts_with_batch.Rd index 10f35fed..0c1ba60a 100644 --- a/man/chemical_starts_with_batch.Rd +++ b/man/chemical_starts_with_batch.Rd @@ -33,7 +33,7 @@ the query parameters Chemical starts with batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that start with given substrings bpa_substrings <- chemical_starts_with_batch(word_list = c('DTXSID702018', 'DTXCID3018')) diff --git a/man/get_all_assays.Rd b/man/get_all_assays.Rd index 8369d38e..641d5f32 100644 --- a/man/get_all_assays.Rd +++ b/man/get_all_assays.Rd @@ -24,7 +24,7 @@ A data.frame containing all the assays and associated information Retrieve all assays } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Retrieve all assays assays <- get_all_assays() \dontshow{\}) # examplesIf} diff --git a/man/get_all_public_chemical_lists.Rd b/man/get_all_public_chemical_lists.Rd index 31c3ba31..671e6d0c 100644 --- a/man/get_all_public_chemical_lists.Rd +++ b/man/get_all_public_chemical_lists.Rd @@ -24,13 +24,13 @@ value.} } \value{ A data.frame containing information on all public chemical lists -available from the CCTE chemical api. +available from the CTX chemical api. } \description{ Get all public chemical lists } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull all chemical lists all_lists <- get_all_public_chemical_lists() \dontshow{\}) # examplesIf} diff --git a/man/get_annotation_by_aeid.Rd b/man/get_annotation_by_aeid.Rd index bc410806..7f7c3a58 100644 --- a/man/get_annotation_by_aeid.Rd +++ b/man/get_annotation_by_aeid.Rd @@ -28,7 +28,7 @@ input AEID parameter Retrieve annotations for AEID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Retrieve annotation for an assay annotation <- get_annotation_by_aeid(AEID = 159) \dontshow{\}) # examplesIf} diff --git a/man/get_annotation_by_aeid_batch.Rd b/man/get_annotation_by_aeid_batch.Rd index d41d81e9..fdec77e0 100644 --- a/man/get_annotation_by_aeid_batch.Rd +++ b/man/get_annotation_by_aeid_batch.Rd @@ -31,7 +31,7 @@ assays with AEID matching the input parameter. Retrieve annotations for AEID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Get annotations for multiple aeids aeid_annotations <- get_annotation_by_aeid_batch(AEID = c(159, 160)) \dontshow{\}) # examplesIf} diff --git a/man/get_bioactivity_details.Rd b/man/get_bioactivity_details.Rd index 863f093d..3252e9be 100644 --- a/man/get_bioactivity_details.Rd +++ b/man/get_bioactivity_details.Rd @@ -37,7 +37,7 @@ identifier matching the input parameter. Retrieve bioactivity data from DTXSID, AEID, SPID, or m4id } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull BPA bioactivity details bpa <- get_bioactivity_details(DTXSID = 'DTXSID7020182') # Pull assay bioactivity details diff --git a/man/get_bioactivity_details_batch.Rd b/man/get_bioactivity_details_batch.Rd index dfe4ca2b..5e92c21d 100644 --- a/man/get_bioactivity_details_batch.Rd +++ b/man/get_bioactivity_details_batch.Rd @@ -40,7 +40,7 @@ the chemicals with DTXSID or assays with AEID matching the input parameter. Retrieve bioactivity data from DTXSID or AEID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull bioactivity details for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') batch_bioactivity <- get_bioactivity_details_batch(DTXSID = dtxsid) diff --git a/man/get_bioactivity_endpoint_status.Rd b/man/get_bioactivity_endpoint_status.Rd new file mode 100644 index 00000000..d2194307 --- /dev/null +++ b/man/get_bioactivity_endpoint_status.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bioactivity-APIs.R +\name{get_bioactivity_endpoint_status} +\alias{get_bioactivity_endpoint_status} +\title{Bioactivity API Endpoint status} +\usage{ +get_bioactivity_endpoint_status() +} +\value{ +Status of Bioactivity API Endpoints +} +\description{ +Bioactivity API Endpoint status +} +\examples{ +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +status <- get_bioactivity_endpoint_status() +print(status) +\dontshow{\}) # examplesIf} +} diff --git a/man/get_bioactivity_summary.Rd b/man/get_bioactivity_summary.Rd index 817bbc2f..88d05f0b 100644 --- a/man/get_bioactivity_summary.Rd +++ b/man/get_bioactivity_summary.Rd @@ -28,7 +28,7 @@ input AEID Retrieve bioactivity summary for AEID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull an assay bioactivity summary aeid_1386 <- get_bioactivity_summary(AEID = 1386) \dontshow{\}) # examplesIf} diff --git a/man/get_bioactivity_summary_batch.Rd b/man/get_bioactivity_summary_batch.Rd index 619fa7be..63bfaf61 100644 --- a/man/get_bioactivity_summary_batch.Rd +++ b/man/get_bioactivity_summary_batch.Rd @@ -31,7 +31,7 @@ information for the assays with AEID matching the input parameter. Retrieve bioactivity summary data from AEID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Get bioactivity summary for multiple aeids aeids <- get_bioactivity_summary_batch(AEID = c(159, 160)) \dontshow{\}) # examplesIf} diff --git a/man/get_cancer_hazard.Rd b/man/get_cancer_hazard.Rd index b0a66cc5..e1626531 100644 --- a/man/get_cancer_hazard.Rd +++ b/man/get_cancer_hazard.Rd @@ -27,7 +27,7 @@ A data.frame of cancer hazard data related to the input DTXSID. Get cancer hazard } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull cancer hazard data for BPA bpa_cancer <- get_cancer_hazard(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_cancer_hazard_batch.Rd b/man/get_cancer_hazard_batch.Rd index f3cb024f..2eea9ecc 100644 --- a/man/get_cancer_hazard_batch.Rd +++ b/man/get_cancer_hazard_batch.Rd @@ -31,7 +31,7 @@ related data for each input DTXSID. Get cancer hazard batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull cancer hazard data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_cancer_hazard <- get_cancer_hazard_batch(DTXSID = dtxsid) diff --git a/man/get_chem_info.Rd b/man/get_chem_info.Rd index 4e2b4acb..f3b07cba 100644 --- a/man/get_chem_info.Rd +++ b/man/get_chem_info.Rd @@ -33,7 +33,7 @@ DTXSID matching the input parameter. Retrieve chemical information } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical information for BPA bpa <- get_chem_info(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_chem_info_batch.Rd b/man/get_chem_info_batch.Rd index 10f422f1..97f398ac 100644 --- a/man/get_chem_info_batch.Rd +++ b/man/get_chem_info_batch.Rd @@ -37,7 +37,7 @@ DTXSID matching the input parameter. Retrieve chemical information in batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical info for multiple chemicals chem_info <- get_chem_info_batch(DTXSID = c('DTXSID7020182', 'DTXSID2021315')) diff --git a/man/get_chemical_by_property_range.Rd b/man/get_chemical_by_property_range.Rd index 5cf3b714..9d941b6b 100644 --- a/man/get_chemical_by_property_range.Rd +++ b/man/get_chemical_by_property_range.Rd @@ -35,7 +35,7 @@ the search criteria. Get chemicals by property and its value range } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals with a given property in a set range density <- get_chemical_by_property_range(start = 1.311, end = 1.313, property = 'Density') diff --git a/man/get_chemical_by_property_range_batch.Rd b/man/get_chemical_by_property_range_batch.Rd index 8a00b40d..a705e8b5 100644 --- a/man/get_chemical_by_property_range_batch.Rd +++ b/man/get_chemical_by_property_range_batch.Rd @@ -34,7 +34,7 @@ chemicals matching the search criteria. Retrieve chemicals by property and value range in batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals by property ranges prop_ranges <- get_chemical_by_property_range_batch(start_list = c(1.311, 211.99), diff --git a/man/get_chemical_details.Rd b/man/get_chemical_details.Rd index dc8589c3..a7aa2243 100644 --- a/man/get_chemical_details.Rd +++ b/man/get_chemical_details.Rd @@ -39,7 +39,7 @@ DTXSID matching the input parameter. Retrieve chemical details from DTXSID of DTXCID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical details for BPA bpa <- get_chemical_details(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_chemical_details_batch.Rd b/man/get_chemical_details_batch.Rd index 24104305..a3550cf9 100644 --- a/man/get_chemical_details_batch.Rd +++ b/man/get_chemical_details_batch.Rd @@ -40,7 +40,7 @@ matching the input parameter. Retrieve chemical details from DTXSID of DTXCID in batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical details for multiple chemicals by dtxsid dtxsids <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_details <- get_chemical_details_batch(DTXSID = dtxsid) diff --git a/man/get_chemical_endpoint_status.Rd b/man/get_chemical_endpoint_status.Rd index 5626d730..c0ef67e8 100644 --- a/man/get_chemical_endpoint_status.Rd +++ b/man/get_chemical_endpoint_status.Rd @@ -13,7 +13,7 @@ Status of Chemical API Endpoints Chemical API Endpoint status } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} status <- get_chemical_endpoint_status() print(status) \dontshow{\}) # examplesIf} diff --git a/man/get_chemical_image.Rd b/man/get_chemical_image.Rd index 7071f653..6f8c6e09 100644 --- a/man/get_chemical_image.Rd +++ b/man/get_chemical_image.Rd @@ -39,7 +39,7 @@ displaying this, one may use \code{png::writePNG()} or Get image file by DTXSID or DTXCID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical image for BPA by dtxsid bpa_image_matrix <- get_chemical_image(DTXSID = 'DTXSID7020182') if (requireNamespace("countcolors", quietly = TRUE)){ diff --git a/man/get_chemical_image_batch.Rd b/man/get_chemical_image_batch.Rd index 41232c4c..74fc4a4a 100644 --- a/man/get_chemical_image_batch.Rd +++ b/man/get_chemical_image_batch.Rd @@ -39,7 +39,7 @@ displaying an image, one may use \code{png::writePNG()} or Get image file by DTXSID or DTXCID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull images for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') images <- get_chemical_image_batch(DTXSID = dtxsid) diff --git a/man/get_chemical_lists_by_type.Rd b/man/get_chemical_lists_by_type.Rd index 2acc130e..64506c7c 100644 --- a/man/get_chemical_lists_by_type.Rd +++ b/man/get_chemical_lists_by_type.Rd @@ -34,7 +34,7 @@ criteria. Get chemical lists by type } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical lists by type federal <- get_chemical_lists_by_type(type = 'Federal') \dontshow{\}) # examplesIf} diff --git a/man/get_chemical_lists_by_type_batch.Rd b/man/get_chemical_lists_by_type_batch.Rd index 96ecd80d..7707d204 100644 --- a/man/get_chemical_lists_by_type_batch.Rd +++ b/man/get_chemical_lists_by_type_batch.Rd @@ -35,7 +35,7 @@ meet the search criteria. Get chemical lists by type batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical lists by type federal_state <- get_chemical_lists_by_type_batch(type_list = c('Federal', 'State')) diff --git a/man/get_chemical_mol.Rd b/man/get_chemical_mol.Rd index 2512677a..d8d63150 100644 --- a/man/get_chemical_mol.Rd +++ b/man/get_chemical_mol.Rd @@ -30,7 +30,7 @@ A character string giving a mol file representation Get mol file by DTXSID or DTXCID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull mol file for BPA by dtxsid bpa_mol <- get_chemical_mol(DTXSID = 'DTXSID7020182') # Pull mol file for BPA by dtxcid diff --git a/man/get_chemical_mol_batch.Rd b/man/get_chemical_mol_batch.Rd index 553d8888..da8e94bb 100644 --- a/man/get_chemical_mol_batch.Rd +++ b/man/get_chemical_mol_batch.Rd @@ -31,7 +31,7 @@ of the given input chemicals. Get mol file by DTXSID or DTXCID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull mol files for multiple chemicals by DTXSID dtxsid <- c('DTXSID7020182', 'DTXSID2021315') mol_files <- get_chemical_mol_batch(DTXSID = dtxsid) diff --git a/man/get_chemical_mrv.Rd b/man/get_chemical_mrv.Rd index e367b0e5..e7230c72 100644 --- a/man/get_chemical_mrv.Rd +++ b/man/get_chemical_mrv.Rd @@ -30,7 +30,7 @@ XML file format for representing a mrv file. Get mrv file by DTXSID or DTXCID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull mrv file for BPA by dtxsid bpa_mrv <- get_chemical_mrv(DTXSID = 'DTXSID7020182') # Pull mrv file for BPA by dtxcid diff --git a/man/get_chemical_mrv_batch.Rd b/man/get_chemical_mrv_batch.Rd index dd616850..91162ce6 100644 --- a/man/get_chemical_mrv_batch.Rd +++ b/man/get_chemical_mrv_batch.Rd @@ -31,7 +31,7 @@ chemicals. Ger mrv file by DTXSID or DTXCID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull mrv files for multiple chemicals by DTXSID dtxsid <- c('DTXSID7020182', 'DTXSID2021315') mrv_files <- get_chemical_mrv_batch(DTXSID = dtxsid) diff --git a/man/get_chemical_synonym.Rd b/man/get_chemical_synonym.Rd index e77364bc..73e46614 100644 --- a/man/get_chemical_synonym.Rd +++ b/man/get_chemical_synonym.Rd @@ -27,7 +27,7 @@ A named list of synonym information for the input DTXSID Get chemical synonym } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull synonyms for BPA bpa_synonym <- get_chemical_synonym(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_chemical_synonym_batch.Rd b/man/get_chemical_synonym_batch.Rd index 865e4a77..894c4391 100644 --- a/man/get_chemical_synonym_batch.Rd +++ b/man/get_chemical_synonym_batch.Rd @@ -28,7 +28,7 @@ DTXSID. Get chemical synonym batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull synonyms for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') batch_synonyms <- get_chemical_synonym_batch(DTXSID = dtxsid) diff --git a/man/get_chemicals_in_list.Rd b/man/get_chemicals_in_list.Rd index 23c7feeb..3a8ef8a5 100644 --- a/man/get_chemicals_in_list.Rd +++ b/man/get_chemicals_in_list.Rd @@ -27,7 +27,7 @@ A data.frame of the chemical list Get chemicals in a given chemical list } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Retrieve chemicals contained in chemical list 'CCL4' ccl4_chemicals <- get_chemicals_in_list(list_name = 'CCL4') \dontshow{\}) # examplesIf} diff --git a/man/get_chemicals_in_list_batch.Rd b/man/get_chemicals_in_list_batch.Rd index c8a7cd15..8288349a 100644 --- a/man/get_chemicals_in_list_batch.Rd +++ b/man/get_chemicals_in_list_batch.Rd @@ -28,7 +28,7 @@ corresponding chemical lists. Get chemicals in a given chemical list batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals in lists for multiple lists chemicals_in_lists <- get_chemicals_in_list_batch(list_names = c('CCL4', 'NATADB')) \dontshow{\}) # examplesIf} diff --git a/man/get_ecotox_hazard_by_dtxsid.Rd b/man/get_ecotox_hazard_by_dtxsid.Rd index a6144286..8421ed71 100644 --- a/man/get_ecotox_hazard_by_dtxsid.Rd +++ b/man/get_ecotox_hazard_by_dtxsid.Rd @@ -27,7 +27,7 @@ A data.frame containing chemical (ecotox) hazard data Get ecotox hazard data by DTXSID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull ecotox hazard data for BPA bpa_ecotox <- get_ecotox_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_ecotox_hazard_by_dtxsid_batch.Rd b/man/get_ecotox_hazard_by_dtxsid_batch.Rd index 26e46dd5..d72be5dc 100644 --- a/man/get_ecotox_hazard_by_dtxsid_batch.Rd +++ b/man/get_ecotox_hazard_by_dtxsid_batch.Rd @@ -30,7 +30,7 @@ A data.table containing chemical ecotox hazard data. Get ecotox hazard data by DTXSID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull ecotox hazard data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_ecotox_hazard <- get_ecotox_hazard_by_dtxsid_batch(DTXSID = dtxsid) diff --git a/man/get_exposure_endpoint_status.Rd b/man/get_exposure_endpoint_status.Rd index 7bfebc06..a90e2f6f 100644 --- a/man/get_exposure_endpoint_status.Rd +++ b/man/get_exposure_endpoint_status.Rd @@ -13,7 +13,7 @@ Status of Exposure API Endpoints Exposure API Endpoint status } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} status <- get_exposure_endpoint_status() print(status) \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_functional_use.Rd b/man/get_exposure_functional_use.Rd index 0d9d2d6d..2f435138 100644 --- a/man/get_exposure_functional_use.Rd +++ b/man/get_exposure_functional_use.Rd @@ -27,7 +27,7 @@ A data.frame of functional use data. Retrieve exposure related functional use data } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull functional use data for BPA bpa <- get_exposure_functional_use(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_functional_use_batch.Rd b/man/get_exposure_functional_use_batch.Rd index 9c7fc8e3..b68ce258 100644 --- a/man/get_exposure_functional_use_batch.Rd +++ b/man/get_exposure_functional_use_batch.Rd @@ -32,7 +32,7 @@ data for each input DTXSID. Retrieve exposure related functional use data batch } \examples{ -has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') # Pull exposure functional use data for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_func_use <- get_exposure_functional_use_batch(DTXSID = dtxsid) diff --git a/man/get_exposure_functional_use_category.Rd b/man/get_exposure_functional_use_category.Rd index 20171f3c..ae783f23 100644 --- a/man/get_exposure_functional_use_category.Rd +++ b/man/get_exposure_functional_use_category.Rd @@ -24,7 +24,7 @@ A data.frame of functional use categories. Retrieve functional use categories } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull functional use category data for BPA functional_use_categories <- get_exposure_functional_use_category() \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_functional_use_probability.Rd b/man/get_exposure_functional_use_probability.Rd index 58491f5c..b8f4f053 100644 --- a/man/get_exposure_functional_use_probability.Rd +++ b/man/get_exposure_functional_use_probability.Rd @@ -28,7 +28,7 @@ exposure related to functional use. Retrieve probability of exposure for functional use category } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull functional use probability data for BPA bpa <- get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_functional_use_probability_batch.Rd b/man/get_exposure_functional_use_probability_batch.Rd index d9c4fe5e..5187ac60 100644 --- a/man/get_exposure_functional_use_probability_batch.Rd +++ b/man/get_exposure_functional_use_probability_batch.Rd @@ -33,7 +33,7 @@ categories that have probability of 0 Retrieve exposure functional use probability data batch } \examples{ -has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') # Pull exposure functional use probability data for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_func_use_prob <- get_exposure_functional_use_batch(DTXSID = dtxsid) diff --git a/man/get_exposure_list_presence_tags.Rd b/man/get_exposure_list_presence_tags.Rd index 1bff2bf4..07f7fd1e 100644 --- a/man/get_exposure_list_presence_tags.Rd +++ b/man/get_exposure_list_presence_tags.Rd @@ -24,7 +24,7 @@ A data.frame with all the list presence tags and associated data. Retrieve list presence tags } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull list presence tags tags <- get_exposure_list_presence_tags() \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_list_presence_tags_by_dtxsid.Rd b/man/get_exposure_list_presence_tags_by_dtxsid.Rd index 567fdad0..68745a8e 100644 --- a/man/get_exposure_list_presence_tags_by_dtxsid.Rd +++ b/man/get_exposure_list_presence_tags_by_dtxsid.Rd @@ -27,7 +27,7 @@ A data.frame of document information and list presence tags Retrieve document data and list presence tags for a chemical } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull list presence tags for BPA bpa <- get_exposure_list_presence_tags(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_list_presence_tags_by_dtxsid_batch.Rd b/man/get_exposure_list_presence_tags_by_dtxsid_batch.Rd index 1bda67d2..483b6952 100644 --- a/man/get_exposure_list_presence_tags_by_dtxsid_batch.Rd +++ b/man/get_exposure_list_presence_tags_by_dtxsid_batch.Rd @@ -32,7 +32,7 @@ tags use data for each input DTXSID. Retrieve document data and list presence tags for chemicals batch } \examples{ -has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') # Pull exposure functional use data for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') exp_list_tags <- get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = dtxsid) diff --git a/man/get_exposure_product_data.Rd b/man/get_exposure_product_data.Rd index 2a1ef35d..92421c2b 100644 --- a/man/get_exposure_product_data.Rd +++ b/man/get_exposure_product_data.Rd @@ -28,7 +28,7 @@ given chemical Retrieve product data for exposure purposes } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull exposure product data for BPA bpa <- get_exposure_product_data(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_exposure_product_data_batch.Rd b/man/get_exposure_product_data_batch.Rd index f814ac26..542dc791 100644 --- a/man/get_exposure_product_data_batch.Rd +++ b/man/get_exposure_product_data_batch.Rd @@ -32,7 +32,7 @@ data for each input DTXSID. Retrieve product data for exposure purposes batch } \examples{ -has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY') +has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY') # Pull exposure functional use data for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_product_data <- get_exposure_product_data_batch(DTXSID = dtxsid) diff --git a/man/get_exposure_product_data_puc.Rd b/man/get_exposure_product_data_puc.Rd index fabd1940..a46b57e9 100644 --- a/man/get_exposure_product_data_puc.Rd +++ b/man/get_exposure_product_data_puc.Rd @@ -24,7 +24,7 @@ A data.frame consisting of all the product use categories Retrieve product use categories related to exposure } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull product data use categories for BPA puc_categories <- get_exposure_product_data_puc() \dontshow{\}) # examplesIf} diff --git a/man/get_fate_by_dtxsid.Rd b/man/get_fate_by_dtxsid.Rd index a010b408..f10382e2 100644 --- a/man/get_fate_by_dtxsid.Rd +++ b/man/get_fate_by_dtxsid.Rd @@ -28,7 +28,7 @@ DTXSID matching the input parameter. Get fate by DTXSID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical fate data for BPA bpa <- get_fate_by_dtxsid(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_fate_by_dtxsid_batch.Rd b/man/get_fate_by_dtxsid_batch.Rd index 712f376b..a18133af 100644 --- a/man/get_fate_by_dtxsid_batch.Rd +++ b/man/get_fate_by_dtxsid_batch.Rd @@ -31,7 +31,7 @@ with DTXSID matching the input parameter. Retrieve chemical fate data in batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical fate by dtxsids chemical_fates <- get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182', 'DTXSID2021315')) diff --git a/man/get_genetox_details.Rd b/man/get_genetox_details.Rd index 06e5b7b8..8615b36e 100644 --- a/man/get_genetox_details.Rd +++ b/man/get_genetox_details.Rd @@ -27,7 +27,7 @@ A data.frame of genetox detail data related to the input DTXSID. Get genetox details } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull genetox details for BPA bpa_genetox_details <- get_genetox_details(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_genetox_details_batch.Rd b/man/get_genetox_details_batch.Rd index da11f1ce..fe485043 100644 --- a/man/get_genetox_details_batch.Rd +++ b/man/get_genetox_details_batch.Rd @@ -31,7 +31,7 @@ DTXSID. Get genetox details batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull genetox details data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_genetox_details_hazard <- get_genetox_details_batch(DTXSID = dtxsid) diff --git a/man/get_genetox_summary.Rd b/man/get_genetox_summary.Rd index bc0a5514..9307606c 100644 --- a/man/get_genetox_summary.Rd +++ b/man/get_genetox_summary.Rd @@ -27,7 +27,7 @@ A data.frame of genetox summary data related to the input DTXSID. Get genetox summary } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull genetox summary for BPA bpa_genetox_summary <- get_genetox_summary(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_genetox_summary_batch.Rd b/man/get_genetox_summary_batch.Rd index 3602813c..e752a673 100644 --- a/man/get_genetox_summary_batch.Rd +++ b/man/get_genetox_summary_batch.Rd @@ -31,7 +31,7 @@ DTXSID. Get genetox summary batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull genetox summary data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_genetox_summary_hazard <- get_genetox_summary_batch(DTXSID = dtxsid) diff --git a/man/get_hazard_by_dtxsid.Rd b/man/get_hazard_by_dtxsid.Rd index 85a81432..4a53a73d 100644 --- a/man/get_hazard_by_dtxsid.Rd +++ b/man/get_hazard_by_dtxsid.Rd @@ -27,7 +27,7 @@ A data.frame containing chemical (human and eco) hazard data Get hazard data by DTXSID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull hazard data for BPA bpa <- get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_hazard_by_dtxsid_batch.Rd b/man/get_hazard_by_dtxsid_batch.Rd index 3ac4bb2c..10c29874 100644 --- a/man/get_hazard_by_dtxsid_batch.Rd +++ b/man/get_hazard_by_dtxsid_batch.Rd @@ -31,7 +31,7 @@ input chemical. Get hazard data by DTXSID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull hazard data for multiple chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') batch_hazard <- get_hazard_by_dtxsid_batch(DTXSID = dtxsid) diff --git a/man/get_hazard_endpoint_status.Rd b/man/get_hazard_endpoint_status.Rd new file mode 100644 index 00000000..65834d38 --- /dev/null +++ b/man/get_hazard_endpoint_status.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/hazard-APIs.R +\name{get_hazard_endpoint_status} +\alias{get_hazard_endpoint_status} +\title{Hazard API Endpoint status} +\usage{ +get_hazard_endpoint_status() +} +\value{ +Status of Hazard API Endpoints +} +\description{ +Hazard API Endpoint status +} +\examples{ +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +status <- get_hazard_endpoint_status() +print(status) +\dontshow{\}) # examplesIf} +} diff --git a/man/get_human_hazard_by_dtxsid.Rd b/man/get_human_hazard_by_dtxsid.Rd index ef4aedf1..56437575 100644 --- a/man/get_human_hazard_by_dtxsid.Rd +++ b/man/get_human_hazard_by_dtxsid.Rd @@ -27,7 +27,7 @@ A data.frame containing chemical human hazard data Get human hazard data by DTXSID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull human hazard data for BPA bpa_human <- get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_human_hazard_by_dtxsid_batch.Rd b/man/get_human_hazard_by_dtxsid_batch.Rd index 1765ffef..baaa5a02 100644 --- a/man/get_human_hazard_by_dtxsid_batch.Rd +++ b/man/get_human_hazard_by_dtxsid_batch.Rd @@ -30,7 +30,7 @@ A data.table containing chemical human hazard data. Get human hazard data by DTXSID batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull human hazard data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_human_hazard <- get_human_hazard_by_dtxsid_batch(DTXSID = dtxsid) diff --git a/man/get_inchi.Rd b/man/get_inchi.Rd index d1a9cc9f..bce0207a 100644 --- a/man/get_inchi.Rd +++ b/man/get_inchi.Rd @@ -28,7 +28,7 @@ A string giving the associated inchi string. Get InChI } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bpa_inchi <- get_inchi(name = "Bisphenol A") \dontshow{\}) # examplesIf} } diff --git a/man/get_inchikey.Rd b/man/get_inchikey.Rd index f290fa3a..704ddf4c 100644 --- a/man/get_inchikey.Rd +++ b/man/get_inchikey.Rd @@ -28,7 +28,7 @@ A string giving the associated InChIKey. Get InChIKey } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bpa_inchikey <- get_inchikey(name = "Bisphenol A") \dontshow{\}) # examplesIf} } diff --git a/man/get_lists_containing_chemical.Rd b/man/get_lists_containing_chemical.Rd index c7398a87..d5750835 100644 --- a/man/get_lists_containing_chemical.Rd +++ b/man/get_lists_containing_chemical.Rd @@ -27,7 +27,7 @@ A list of names of chemical lists that contain the given chemical Get chemical lists containing given chemical } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical lists containing BPA bpa_lists <- get_lists_containing_chemical(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_lists_containing_chemical_batch.Rd b/man/get_lists_containing_chemical_batch.Rd index 174313d0..86739cbd 100644 --- a/man/get_lists_containing_chemical_batch.Rd +++ b/man/get_lists_containing_chemical_batch.Rd @@ -27,7 +27,7 @@ A named list of chemical lists that contain the given chemicals. Get chemical lists containing given chemical batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull lists containing chemicals for multiple chemicals lists <- get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182', 'DTXSID2021315')) diff --git a/man/get_msready_by_dtxcid.Rd b/man/get_msready_by_dtxcid.Rd index cb3ebf31..e7ea0eaf 100644 --- a/man/get_msready_by_dtxcid.Rd +++ b/man/get_msready_by_dtxcid.Rd @@ -28,7 +28,7 @@ search criteria Get msready by DTXCID } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals with matching DTXCID dtxcid_msready <- get_msready_by_dtxcid(DTXSID = 'DTXCID30182') \dontshow{\}) # examplesIf} diff --git a/man/get_msready_by_dtxcid_batch.Rd b/man/get_msready_by_dtxcid_batch.Rd index c852e5b5..53755636 100644 --- a/man/get_msready_by_dtxcid_batch.Rd +++ b/man/get_msready_by_dtxcid_batch.Rd @@ -28,7 +28,7 @@ search criteria Get msready by DTXCID batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull msready chemicals matching specific DTXCID dtxcid_msready <- get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182', 'DTXCID001315')) diff --git a/man/get_msready_by_formula.Rd b/man/get_msready_by_formula.Rd index a5bb9726..7c7ca7e2 100644 --- a/man/get_msready_by_formula.Rd +++ b/man/get_msready_by_formula.Rd @@ -28,7 +28,7 @@ search criteria Get msready by formula } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals that match input formula mass_formula <- get_msready_by_formula(formula = 'C16H24N2O5S') \dontshow{\}) # examplesIf} diff --git a/man/get_msready_by_formula_batch.Rd b/man/get_msready_by_formula_batch.Rd index c8cd7a20..20f97335 100644 --- a/man/get_msready_by_formula_batch.Rd +++ b/man/get_msready_by_formula_batch.Rd @@ -28,7 +28,7 @@ matching the search criteria Get msready by formula batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull msready data for several chemical formulas msready_data <- get_msready_by_formula_batch(formula_list = c('C16H24N2O5S', 'C15H16O2')) diff --git a/man/get_msready_by_mass.Rd b/man/get_msready_by_mass.Rd index 572947dc..a3340771 100644 --- a/man/get_msready_by_mass.Rd +++ b/man/get_msready_by_mass.Rd @@ -30,7 +30,7 @@ A list of DTXSIDs with msready mass falling within the given range. Get msready by mass } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemicals with msready mass in given range mass_range <- get_msready_by_mass(start = 200.9, end = 200.95) \dontshow{\}) # examplesIf} diff --git a/man/get_msready_by_mass_batch.Rd b/man/get_msready_by_mass_batch.Rd index 9510afae..5ccf6496 100644 --- a/man/get_msready_by_mass_batch.Rd +++ b/man/get_msready_by_mass_batch.Rd @@ -31,7 +31,7 @@ falling within the given ranges. Get ms ready by mass batch search } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull msready chemicals by mass ranges msready_data <- get_msready_by_mass_batch(start_list = c(200.9, 200.95), end_list = c(200.95, 201.00)) diff --git a/man/get_msready_by_mass_with_error_batch.Rd b/man/get_msready_by_mass_with_error_batch.Rd index 816fb441..cc1778e3 100644 --- a/man/get_msready_by_mass_with_error_batch.Rd +++ b/man/get_msready_by_mass_with_error_batch.Rd @@ -31,7 +31,7 @@ mass value. Get msready by mass and error offset } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} #Pull chemicals by msready mass and error offset msready_data <- get_msready_by_mass_with_error_batch(masses = c(226, 228), error = 4) diff --git a/man/get_public_chemical_list_by_name.Rd b/man/get_public_chemical_list_by_name.Rd index d1d40ac1..d6f0ef5d 100644 --- a/man/get_public_chemical_list_by_name.Rd +++ b/man/get_public_chemical_list_by_name.Rd @@ -34,7 +34,7 @@ use \code{\link{get_chemicals_in_list}}. Get chemical list by name } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical list by list name ccl4 <- get_public_chemical_list_by_name(list_name = 'CCL4') \dontshow{\}) # examplesIf} diff --git a/man/get_public_chemical_list_by_name_batch.Rd b/man/get_public_chemical_list_by_name_batch.Rd index 6b869e92..1c4331b5 100644 --- a/man/get_public_chemical_list_by_name_batch.Rd +++ b/man/get_public_chemical_list_by_name_batch.Rd @@ -34,7 +34,7 @@ chemicals in a given list, use \code{\link{get_chemicals_in_list}}. Get chemical list by name batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull chemical list information by list names list_info <- get_public_chemical_list_by_name_batch(name_list = c('CCL4', 'NATADB')) diff --git a/man/get_skin_eye_hazard.Rd b/man/get_skin_eye_hazard.Rd index 97c1ca93..29c3343a 100644 --- a/man/get_skin_eye_hazard.Rd +++ b/man/get_skin_eye_hazard.Rd @@ -27,7 +27,7 @@ A data.frame containing skin and eye hazard data. Get skin and eye hazard } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull skin and eye hazard data for BPA bpa_skin_eye <- get_skin_eye_hazard_batch(DTXSID = 'DTXSID7020182') \dontshow{\}) # examplesIf} diff --git a/man/get_skin_eye_hazard_batch.Rd b/man/get_skin_eye_hazard_batch.Rd index b31b07a2..3df1147e 100644 --- a/man/get_skin_eye_hazard_batch.Rd +++ b/man/get_skin_eye_hazard_batch.Rd @@ -31,7 +31,7 @@ each input DTXSID. Get skin and eye hazard batch } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pull skin eye hazard data for multiples chemicals dtxsid <- c('DTXSID7020182', 'DTXSID2021315') dtxsid_skin_eye_hazard <- get_skin_eye_hazard_batch(DTXSID = dtxsid) diff --git a/man/get_smiles.Rd b/man/get_smiles.Rd index dfc07388..5e69bdce 100644 --- a/man/get_smiles.Rd +++ b/man/get_smiles.Rd @@ -28,7 +28,7 @@ A string giving a SMILES string for the input chemical. Get Smiles } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bpa_smiles <- get_smiles(name = "Bisphenol A") \dontshow{\}) # examplesIf} } diff --git a/man/register_ccdr.Rd b/man/register_ccdr.Rd index 9544aa26..35695bd0 100644 --- a/man/register_ccdr.Rd +++ b/man/register_ccdr.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/register_ccte.R +% Please edit documentation in R/register_ctx.R \name{register_ccdr} \alias{register_ccdr} \alias{showing_key} \alias{ccdr_show_api_key} \alias{ccdr_hide_api_key} -\alias{print.ccte_credentials} -\alias{ccte_key} -\alias{has_ccte_key} -\title{Register a CCTE API} +\alias{print.ctx_credentials} +\alias{ctx_key} +\alias{has_ctx_key} +\title{Register a CTX API} \usage{ showing_key() @@ -18,11 +18,11 @@ ccdr_hide_api_key() register_ccdr(key, write = FALSE) -\method{print}{ccte_credentials}(...) +\method{print}{ctx_credentials}(...) -ccte_key() +ctx_key() -has_ccte_key() +has_ctx_key() } \arguments{ \item{key}{an API key} @@ -40,21 +40,22 @@ changing the display settings of the API key. changing the display settings of the API key. \item \code{register_ccdr()} has no return value but has the side effect of storing the API key. -\item \code{print.ccte_credentials()} has no return value and is an S3 method for -printing the \code{ccte_credentials} class. -\item \code{ccte_key()} returns a string, either the stored API key or +\item \code{print.ctx_credentials()} has no return value and is an S3 method for +printing the \code{ctx_credentials} class. +\item \code{ctx_key()} returns a string, either the stored API key or \code{NA_character_}. -\item \code{has_ccte_key()} returns a Boolean. +\item \code{has_ctx_key()} returns a Boolean. } } \description{ -This page contains documentation tools related to enabling CCTE API services +This page contains documentation tools related to enabling CTX API services in R. } \details{ To obtain an API key and enable services, go to -\url{https://api-ccte.epa.gov/docs/}. This documentation shows you how to -obtain an API key to allow access to the CCTE APIs. +\url{https://www.epa.gov/comptox-tools/computational-toxicology-and-exposure-apis}. +This documentation shows you how to obtain an API key to allow access to the +CTX APIs. To tell ccdR about your API key, use \code{\link[=register_ccdr]{register_ccdr()}}, e.g. \code{register_ccdr(key = 'grbwigbwoginrowgbwibgdibdvinrginiwgo')} (that's a fake @@ -65,8 +66,8 @@ sessions. Users should be aware that the API key, a string of garbled characters/numbers/symbols, is a PRIVATE key - it uniquely identifies and -authenticates you to CCTE's services. If anyone gets your API key, they can -use it to masquerade as you to CCTE. To mitigate against users inadvertently +authenticates you to CTX's services. If anyone gets your API key, they can +use it to masquerade as you to CTX. To mitigate against users inadvertently sharing their keys, by default ccdR never displays a user's key in messages displayed to the console. @@ -79,34 +80,34 @@ ccdR we recommend a heightened sense of security and self-awareness: only use trusted packages, do not save the API keys in script files, etc. } \examples{ -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Check if API key is showing showing_key() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Toggle API key to display ccdr_show_api_key() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Toggle API key to be hidden ccdr_hide_api_key() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Register key for this session register_ccdr(key = 'YOUR API KEY') # Register key over sessions register_ccdr(key = 'YOUR API KEY', write = TRUE) \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -# Print function for ccte_credentials class -print.ccte_credentials() +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# Print function for ctx_credentials class +print.ctx_credentials() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -# Display ccte API key -ccte_key() +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# Display ctx API key +ctx_key() \dontshow{\}) # examplesIf} -\dontshow{if (has_ccte_key() & is.na(ccte_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (has_ctx_key() & is.na(ctx_key() == 'FAKE_KEY')) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Check whether API key is registered -has_ccte_key() +has_ctx_key() \dontshow{\}) # examplesIf} } diff --git a/tests/testthat/test-bioactivity-APIs-batch.R b/tests/testthat/test-bioactivity-APIs-batch.R index 91c14bb4..534980d8 100644 --- a/tests/testthat/test-bioactivity-APIs-batch.R +++ b/tests/testthat/test-bioactivity-APIs-batch.R @@ -3,11 +3,11 @@ with_mock_dir("bioactivity-batch",{ # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # # #store env variable so tests don't overwrite -# #tmp <- Sys.getenv("CCTE_API_KEY") -# #on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# #if(Sys.getenv("CCTE_API_KEY") == ""){ +# #tmp <- Sys.getenv("CTX_API_KEY") +# #on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# #if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # #} # expect_message(get_bioactivity_details_batch(DTXSID = c('DTXSID8031865'), verbose = TRUE), 'Using stored API key!') # expect_message(get_bioactivity_details_batch(DTXSID = c('DTXSID8031865'), API_key = 1, verbose = TRUE), 'Using stored API key!') @@ -21,12 +21,12 @@ test_that('DTXSID/AEID errors', { }) test_that('Rate limit warnings', { - expect_warning(get_bioactivity_details_batch(DTXSID = c(''), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_bioactivity_details_batch(DTXSID = c(''), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_bioactivity_details_batch(DTXSID = c(''), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_bioactivity_details_batch(DTXSID = c(''), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') }) test_that('Return data types', { expect_type(get_bioactivity_details_batch(DTXSID = c('DTXSID8031865'), API_key = ''), 'list') - expect_type(get_bioactivity_details_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_bioactivity_details_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_bioactivity_details_batch(AEID = c(1), API_key = 'test_key'), 'list') })}) diff --git a/tests/testthat/test-bioactivity-APIs.R b/tests/testthat/test-bioactivity-APIs.R index 1fb15a76..810c0fa2 100644 --- a/tests/testthat/test-bioactivity-APIs.R +++ b/tests/testthat/test-bioactivity-APIs.R @@ -3,11 +3,11 @@ with_mock_dir("bioactivity",{ # test_that("Catch missing API", { # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # #store env variable so tests don't overwrite -# # tmp <- Sys.getenv("CCTE_API_KEY") -# # on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# # if(Sys.getenv("CCTE_API_KEY") == ""){ +# # tmp <- Sys.getenv("CTX_API_KEY") +# # on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# # if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # # } # # expect_message(get_bioactivity_details(DTXSID = 'DTXSID8031865', verbose = TRUE), 'Using stored API key!') @@ -19,8 +19,8 @@ test_that("DTXSID/AEID errors", { }) test_that('Return data type', { - #expect_type(get_bioactivity_details(DTXSID = 'DTXSID8031865', API_key = ccte_key()), 'list') - expect_type(get_bioactivity_details(DTXSID = '', API_key = ccte_key()), 'NULL') + #expect_type(get_bioactivity_details(DTXSID = 'DTXSID8031865', API_key = ctx_key()), 'list') + expect_type(get_bioactivity_details(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_bioactivity_details(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') expect_type(get_bioactivity_details(AEID = 1), 'list') #expect_type(get_bioactivity_details(AEID = 42, API_key = ''), 'NULL') diff --git a/tests/testthat/test-chemical-APIs-batch.R b/tests/testthat/test-chemical-APIs-batch.R index 1ea6c4b6..95b33e71 100644 --- a/tests/testthat/test-chemical-APIs-batch.R +++ b/tests/testthat/test-chemical-APIs-batch.R @@ -1,11 +1,11 @@ with_mock_dir("chemical-batch",{ # test_that("catch missing APIs", { # #store env variable so tests don't overwrite -# # tmp <- Sys.getenv("CCTE_API_KEY") -# # on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# # if(Sys.getenv("CCTE_API_KEY") == ""){ +# # tmp <- Sys.getenv("CTX_API_KEY") +# # on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# # if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # # } # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # expect_message(get_chemical_details_batch(DTXSID = c('DTXSID7020182'), verbose = TRUE), 'Using stored API key!') @@ -82,44 +82,44 @@ test_that("DTXSID/DTXCID errors", { }) test_that('Rate limit warnings', { - expect_warning(get_chemical_details_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_details_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - #expect_warning(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - #expect_warning(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = 8, API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = 8, API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_details_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_details_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + #expect_warning(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + #expect_warning(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = 8, API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = 8, API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_fate_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') expect_warning(get_msready_by_mass_with_error_batch(mass = 226, error = 1, rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') expect_warning(get_msready_by_mass_with_error_batch(mass = 226, error = 1, rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_mass_batch(start_list = c(1), end_list = c(1), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_mass_batch(start_list = c(1), end_list = c(1), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_lists_by_type_batch(type_list = c('federal'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_lists_by_type_batch(type_list = c('federal'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemicals_in_list_batch(list_names = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemicals_in_list_batch(list_names = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_mass_batch(start_list = c(1), end_list = c(1), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_mass_batch(start_list = c(1), end_list = c(1), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_lists_by_type_batch(type_list = c('federal'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_lists_by_type_batch(type_list = c('federal'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemicals_in_list_batch(list_names = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemicals_in_list_batch(list_names = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') }) test_that('Numeric range input errors and warnings', { @@ -168,82 +168,82 @@ test_that('Word search errors', { }) test_that('miscellaneous list mismatch warnings', { - expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182', 'DTXSID2021315', 'DTXSID50186350'), type = c('experimental', ''), API_key = ccte_key()), "Setting type to ''!") - expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = c('predicted', 'experimental'), API_key = ccte_key()), "Setting type to ''!") + expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182', 'DTXSID2021315', 'DTXSID50186350'), type = c('experimental', ''), API_key = ctx_key()), "Setting type to ''!") + expect_warning(get_chem_info_batch(DTXSID = c('DTXSID7020182'), type = c('predicted', 'experimental'), API_key = ctx_key()), "Setting type to ''!") }) test_that('Return data types', { - expect_type(get_chemical_details_batch(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_chemical_details_batch(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_chemical_details_batch(DTXCID = 'DTXCID30182', API_key = ccte_key()), 'list') - expect_type(get_chemical_details_batch(DTXCID = 'DTXCID30182', Projection = '', API_key = ccte_key()), 'list') - expect_type(get_chemical_details_batch(DTXSID = '', API_key = ccte_key()), 'list') + expect_type(get_chemical_details_batch(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_chemical_details_batch(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_chemical_details_batch(DTXCID = 'DTXCID30182', API_key = ctx_key()), 'list') + expect_type(get_chemical_details_batch(DTXCID = 'DTXCID30182', Projection = '', API_key = ctx_key()), 'list') + expect_type(get_chemical_details_batch(DTXSID = '', API_key = ctx_key()), 'list') expect_type(get_chemical_details_batch(DTXSID = 'DTXSID7020182', API_key = ''), 'list') expect_type(generate_ranges(end = 'p'), 'list') expect_type(generate_ranges(end = -1), 'list') expect_type(generate_ranges(end = 205), 'list') expect_type(generate_dtxsid_string(items = c('DTXSID7020182', 'DTXSID7026185')), 'character') - expect_type(get_chemical_by_property_range_batch(start_list = c(NA_real_), end_list = (NA_real_), property_list = c('density'), API_key = ccte_key()), 'list') - #expect_type(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ccte_key()), 'list') - #expect_type(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemical_by_property_range_batch(start_list = c(NA_real_), end_list = (NA_real_), property_list = c('density'), API_key = ctx_key()), 'list') + #expect_type(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ctx_key()), 'list') + #expect_type(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c(''), API_key = ctx_key()), 'list') #expect_type(get_chemical_by_property_range_batch(start_list = c(1), end_list = c(2), property_list = c('Boiling point'), API_key = ''), 'list') - expect_type(get_chem_info_batch(DTXSID = 'DTXSID7020182', type = 'predicted', API_key = ccte_key()), 'list') - expect_type(get_chem_info_batch(DTXSID = '', type = 'predicted', API_key = ccte_key()), 'list') + expect_type(get_chem_info_batch(DTXSID = 'DTXSID7020182', type = 'predicted', API_key = ctx_key()), 'list') + expect_type(get_chem_info_batch(DTXSID = '', type = 'predicted', API_key = ctx_key()), 'list') expect_type(get_chem_info_batch(DTXSID = 'DTXSID7020182', type = 'predicted', API_key = ''), 'list') expect_type(get_chem_info_batch(DTXSID = 'DTXSID7020182', type = 9, API_key = ''), 'list') - expect_type(get_fate_by_dtxsid_batch(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_fate_by_dtxsid_batch(DTXSID = '', API_key = ccte_key()), 'list') + expect_type(get_fate_by_dtxsid_batch(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_fate_by_dtxsid_batch(DTXSID = '', API_key = ctx_key()), 'list') expect_type(get_fate_by_dtxsid_batch(DTXSID = 'DTXSID7020182', API_key = ''), 'list') - expect_type(chemical_starts_with_batch(word_list = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ccte_key()), 'list') + expect_type(chemical_starts_with_batch(word_list = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(chemical_starts_with_batch(word_list = c('gvfdsr7'), API_key = ctx_key()), 'list') expect_type(chemical_starts_with_batch(word_list = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(chemical_equal_batch(word_list = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ccte_key()), 'list') + expect_type(chemical_equal_batch(word_list = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(chemical_equal_batch(word_list = c('gvfdsr7'), API_key = ctx_key()), 'list') expect_type(chemical_equal_batch(word_list = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(chemical_contains_batch(word_list = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ccte_key()), 'list') + expect_type(chemical_contains_batch(word_list = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(chemical_contains_batch(word_list = c('gvfdsr7'), API_key = ctx_key()), 'list') expect_type(chemical_contains_batch(word_list = c('DTXSID7020182'), API_key = ''), 'list') expect_type(get_msready_by_mass_with_error_batch(masses = 226, error = 1), 'list') expect_type(get_msready_by_mass_with_error_batch(masses = c(226, 228), error = 1), 'list') - expect_type(get_msready_by_mass_batch(start_list = c(16.0313), end_list = c(16.0314), API_key = ccte_key()), 'list') - expect_type(get_msready_by_mass_batch(start_list = c(16.0314), end_list = c(16.0314), API_key = ccte_key()), 'list') + expect_type(get_msready_by_mass_batch(start_list = c(16.0313), end_list = c(16.0314), API_key = ctx_key()), 'list') + expect_type(get_msready_by_mass_batch(start_list = c(16.0314), end_list = c(16.0314), API_key = ctx_key()), 'list') expect_type(get_msready_by_mass_batch(start_list = c(-16.0313), end_list = c(16.0314), API_key = ''), 'list') - expect_type(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ccte_key()), 'list') - expect_type(get_msready_by_formula_batch(formula_list = c('8x'), API_key = ccte_key()), 'list') - expect_type(get_msready_by_formula_batch(formula_list = c(''), API_key = ccte_key()), 'list') + expect_type(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ctx_key()), 'list') + expect_type(get_msready_by_formula_batch(formula_list = c('8x'), API_key = ctx_key()), 'list') + expect_type(get_msready_by_formula_batch(formula_list = c(''), API_key = ctx_key()), 'list') expect_type(get_msready_by_formula_batch(formula_list = c('CH4'), API_key = ''), 'list') - expect_type(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ccte_key()), 'list') - expect_type(get_msready_by_dtxcid_batch(DTXCID = c(''), API_key = ccte_key()), 'list') + expect_type(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ctx_key()), 'list') + expect_type(get_msready_by_dtxcid_batch(DTXCID = c(''), API_key = ctx_key()), 'list') expect_type(get_msready_by_dtxcid_batch(DTXCID = c('DTXCID30182'), API_key = ''), 'list') - expect_type(get_chemical_lists_by_type_batch(type = c('federal'), API_key = ccte_key()), 'list') - expect_type(get_chemical_lists_by_type_batch(type = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemical_lists_by_type_batch(type = c('federal'), API_key = ctx_key()), 'list') + expect_type(get_chemical_lists_by_type_batch(type = c(''), API_key = ctx_key()), 'list') expect_type(get_chemical_lists_by_type_batch(type = c('federal'), API_key = ''), 'list') - expect_type(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ccte_key()), 'list') - expect_type(get_public_chemical_list_by_name_batch(name_list = c(''), API_key = ccte_key()), 'list') + expect_type(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ctx_key()), 'list') + expect_type(get_public_chemical_list_by_name_batch(name_list = c(''), API_key = ctx_key()), 'list') expect_type(get_public_chemical_list_by_name_batch(name_list = c('BIOSOLIDS2021'), API_key = ''), 'list') - expect_type(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_lists_containing_chemical_batch(chemical_list = c(''), API_key = ccte_key()), 'list') + expect_type(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_lists_containing_chemical_batch(chemical_list = c(''), API_key = ctx_key()), 'list') expect_type(get_lists_containing_chemical_batch(chemical_list = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_chemicals_in_list_batch(list_names = c('BIOSOLDIS2021'), API_key = ccte_key()), 'list') - expect_type(get_chemicals_in_list_batch(list_names = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemicals_in_list_batch(list_names = c('BIOSOLDIS2021'), API_key = ctx_key()), 'list') + expect_type(get_chemicals_in_list_batch(list_names = c(''), API_key = ctx_key()), 'list') expect_type(get_chemicals_in_list_batch(list_names = c('BIOSOLDIS2021'), API_key = ''), 'list') - expect_type(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_mrv_batch(DTXCID = c('DTXCID30182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_mrv_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_mrv_batch(DTXCID = c('DTXCID30182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_mrv_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_chemical_mrv_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') expect_type(get_chemical_mrv_batch(DTXCID = c('DTXCID30182'), API_key = ''), 'list') - expect_type(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_mol_batch(DTXCID = c('DTXCID30182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_mol_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_mol_batch(DTXCID = c('DTXCID30182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_mol_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_chemical_mol_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') expect_type(get_chemical_mol_batch(DTXCID = c('DTXCID30182'), API_key = ''), 'list') - expect_type(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_image_batch(DTXCID = c('DTXCID30182'), format = c('png'), API_key = ccte_key()), 'list') - expect_type(get_chemical_image_batch(DTXSID = c(''), format = c('svg'), API_key = ccte_key()), 'list') + expect_type(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_image_batch(DTXCID = c('DTXCID30182'), format = c('png'), API_key = ctx_key()), 'list') + expect_type(get_chemical_image_batch(DTXSID = c(''), format = c('svg'), API_key = ctx_key()), 'list') expect_type(get_chemical_image_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') expect_type(get_chemical_image_batch(DTXCID = c('DTXCID30182'), format = c('png'), API_key = ''), 'list') - expect_type(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_chemical_synonym_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_chemical_synonym_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_chemical_synonym_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') }) }) diff --git a/tests/testthat/test-chemical-APIs.R b/tests/testthat/test-chemical-APIs.R index 84de8268..5e119fe8 100644 --- a/tests/testthat/test-chemical-APIs.R +++ b/tests/testthat/test-chemical-APIs.R @@ -3,11 +3,11 @@ with_mock_dir("chemical",{ # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # # #store env variable so tests don't overwrite -# # tmp <- Sys.getenv("CCTE_API_KEY") -# # on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# # if(Sys.getenv("CCTE_API_KEY") == ""){ +# # tmp <- Sys.getenv("CTX_API_KEY") +# # on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# # if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # # } # # expect_message(get_chemical_details(DTXSID = 'DTXSID7020182', verbose = TRUE), 'Using stored API key!') @@ -59,7 +59,7 @@ test_that('Numeric range input errors and warnings', { expect_error(get_chemical_by_property_range(end = 4, API_key = 'test_key'), 'Please input a numeric value for both start and end!') expect_error(get_chemical_by_property_range(start = 4, end = 'k', API_key = 'test_key'), 'Please input a numeric value for both start and end!') expect_error(get_chemical_by_property_range(start = TRUE, end = 4, API_key = 'test_key'), 'Please input a numeric value for both start and end!') - expect_error(get_chemical_by_property_range(start = 3, end = 4, API_key = ccte_key()), 'Please input a value for property!') + expect_error(get_chemical_by_property_range(start = 3, end = 4, API_key = ctx_key()), 'Please input a value for property!') expect_error(get_msready_by_mass(API_key = 'test_key'), 'Please input a numeric value for both start and end!') expect_error(get_msready_by_mass(start = 4, API_key = 'test_key'), 'Please input a numeric value for both start and end!') expect_error(get_msready_by_mass(end = 4, API_key = 'test_key'), 'Please input a numeric value for both start and end!') @@ -68,7 +68,7 @@ test_that('Numeric range input errors and warnings', { expect_error(get_msready_by_mass(start = -1, end = 4, API_key = 'test_key'), 'Both start and end must be non-negative!') expect_error(get_msready_by_mass(start = 4, end = -1, API_key = 'test_key'), 'Both start and end must be non-negative!') expect_warning(get_msready_by_mass(start = 4, end = 1), 'Swapping values for start and end!') - #expect_warning(get_chemical_by_property_range(start = 4, end = 3, property = 'density', API_key = ccte_key()), 'Swapping values for start and end!') + #expect_warning(get_chemical_by_property_range(start = 4, end = 3, property = 'density', API_key = ctx_key()), 'Swapping values for start and end!') }) @@ -76,20 +76,20 @@ test_that('projection/type errors/warnings', { expect_error(get_chemical_details(DTXSID = 'DTXSID7020182', Projection = 't', API_key = 'test_key'), 'Please input a correct value for `Projection`!') expect_warning(get_chemical_details(DTXSID = 'DTXSID7020182', Projection = 2), 'Setting `Projection` to `chemicaldetailstandard`') expect_warning(get_chemical_details(DTXSID = 'DTXSID7020182', Projection = c('ntatoolkit', 'chemicaldetailstandard')), 'Setting `Projection` to `chemicaldetailstandard`') - expect_message(get_chemical_details(DTXSID = 'DTXSID7020182', Projection = c('ntatoolkit', 'chemicaldetaitandard'), API_key = ccte_key()), 'Using `Projection` = ntatoolkit!') + expect_message(get_chemical_details(DTXSID = 'DTXSID7020182', Projection = c('ntatoolkit', 'chemicaldetaitandard'), API_key = ctx_key()), 'Using `Projection` = ntatoolkit!') expect_warning(get_chem_info(DTXSID = 'DTXSID', type = c('', 'predicted')), 'Setting type to ""!') expect_error(get_chem_info(DTXSID = 'DTXSID', type = 'l', API_key = 'test_key'), 'Please input a correct choice for type!') expect_error(get_chemical_lists_by_type(), 'Please input a value for parameter type') expect_error(get_chemical_lists_by_type(type = 1), 'Please input a value for parameter type') - expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = 1, API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = '1', API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = c('', 'chemicallistall'), API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = 1, API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = '1', API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = c('', 'chemicallistall'), API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_all_public_chemical_lists(Projection = 1, API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_all_public_chemical_lists(Projection = '1', API_key = ccte_key()), 'Setting `Projection` to empty string!') - expect_warning(get_all_public_chemical_lists(Projection = c('', 'chemicallistall'), API_key = ccte_key()), 'Setting `Projection` to empty string!') + expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = 1, API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = '1', API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_chemical_lists_by_type(type = 'federal', Projection = c('', 'chemicallistall'), API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = 1, API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = '1', API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_public_chemical_list_by_name(list_name = 'federal', Projection = c('', 'chemicallistall'), API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_all_public_chemical_lists(Projection = 1, API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_all_public_chemical_lists(Projection = '1', API_key = ctx_key()), 'Setting `Projection` to empty string!') + expect_warning(get_all_public_chemical_lists(Projection = c('', 'chemicallistall'), API_key = ctx_key()), 'Setting `Projection` to empty string!') }) test_that('Word search errors', { @@ -108,69 +108,69 @@ test_that('Word search errors', { }) test_that('Return data type', { - expect_type(get_chemical_details(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') + expect_type(get_chemical_details(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_chemical_details(DTXCID = 'DTXCID30182'), 'list') - expect_type(get_chemical_details(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_details(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_details(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - #expect_type(get_chemical_by_property_range(start = 99.8, end = 100.2, property = 'boiling point', API_key = ccte_key()), 'list') - #expect_type(get_chemical_by_property_range(start = 99.8, end = 100.2, property = 'nonsense', API_key = ccte_key()), 'NULL') - expect_type(get_chem_info(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') + #expect_type(get_chemical_by_property_range(start = 99.8, end = 100.2, property = 'boiling point', API_key = ctx_key()), 'list') + #expect_type(get_chemical_by_property_range(start = 99.8, end = 100.2, property = 'nonsense', API_key = ctx_key()), 'NULL') + expect_type(get_chem_info(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_chem_info(DTXSID = 'DTXSID7020182', type = 'predicted'), 'list') - expect_type(get_chem_info(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_chem_info(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_chem_info(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_fate_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_fate_by_dtxsid(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_fate_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_fate_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_fate_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(chemical_starts_with(word = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(chemical_starts_with(word = '', API_key = ccte_key()), 'NULL') + expect_type(chemical_starts_with(word = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(chemical_starts_with(word = '', API_key = ctx_key()), 'NULL') #expect_type(chemical_starts_with(word = 'DTXSID7020182', API_key = ''), 'NULL') expect_type(chemical_equal(word = 'Bisphenol A'), 'list') - expect_type(chemical_equal(word = 'gvfds', API_key = ccte_key()), 'NULL') + expect_type(chemical_equal(word = 'gvfds', API_key = ctx_key()), 'NULL') #expect_type(chemical_equal(word = 'Bisphenol A', API_key = ''), 'NULL') expect_type(chemical_contains(word = 'Bisphenol A'), 'list') - expect_type(chemical_contains(word = 'gvfdsr7', API_key = ccte_key()), 'NULL') + expect_type(chemical_contains(word = 'gvfdsr7', API_key = ctx_key()), 'NULL') #expect_type(chemical_contains(word = 'Bisphenol A', API_key = ''), 'NULL') expect_type(get_msready_by_mass(start = 16.0313, end = 16.0314), 'character') expect_type(get_msready_by_mass(start = 16.0314, end = 16.0314), 'list') #expect_type(get_msready_by_mass(start = 16.0313, end = 16.0314, API_key =''), 'NULL') - expect_type(get_msready_by_formula(formula = 'CH4', API_key = ccte_key()), 'character') + expect_type(get_msready_by_formula(formula = 'CH4', API_key = ctx_key()), 'character') expect_type(get_msready_by_formula(formula = '8x'), 'list') - expect_type(get_msready_by_formula(formula = '', API_key = ccte_key()), 'NULL') + expect_type(get_msready_by_formula(formula = '', API_key = ctx_key()), 'NULL') #expect_type(get_msready_by_formula(formula = 'CH4', API_key = ''), 'NULL') - expect_type(get_msready_by_dtxcid(DTXCID = 'DTXCID30182', API_key = ccte_key()), 'character') - expect_type(get_msready_by_dtxcid(DTXCID = '', API_key = ccte_key()), 'NULL') + expect_type(get_msready_by_dtxcid(DTXCID = 'DTXCID30182', API_key = ctx_key()), 'character') + expect_type(get_msready_by_dtxcid(DTXCID = '', API_key = ctx_key()), 'NULL') #expect_type(get_msready_by_dtxcid(DTXCID = 'DTXCID30182', API_key = ''), 'NULL') - expect_type(get_chemical_lists_by_type(type = 'federal', API_key = ccte_key()), 'list') - expect_type(get_chemical_lists_by_type(type = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_lists_by_type(type = 'federal', API_key = ctx_key()), 'list') + expect_type(get_chemical_lists_by_type(type = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_lists_by_type(type = 'federal', API_key = ''), 'NULL') - expect_type(get_public_chemical_list_by_name(list_name = 'Biosolids2021', API_key = ccte_key()), 'list') - expect_type(get_public_chemical_list_by_name(list_name = '', API_key = ccte_key()), 'NULL') + expect_type(get_public_chemical_list_by_name(list_name = 'Biosolids2021', API_key = ctx_key()), 'list') + expect_type(get_public_chemical_list_by_name(list_name = '', API_key = ctx_key()), 'NULL') #expect_type(get_public_chemical_list_by_name(list_name = 'BIOSOLIDS2021', API_key = ''), 'NULL') - expect_type(get_lists_containing_chemical(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'character') - expect_type(get_lists_containing_chemical(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_lists_containing_chemical(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'character') + expect_type(get_lists_containing_chemical(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_lists_containing_chemical(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') expect_type(get_chemicals_in_list(list_name = 'CCL4'), 'list') - expect_type(get_chemicals_in_list(list_name = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemicals_in_list(list_name = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemicals_in_list(list_name = 'BIOSOLDIS2021', API_key = ''), 'NULL') - expect_type(get_all_public_chemical_lists(API_key = ccte_key()), 'list') + expect_type(get_all_public_chemical_lists(API_key = ctx_key()), 'list') #expect_type(get_all_public_chemical_lists(API_key = ''), 'NULL') - expect_type(get_chemical_mrv(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'character') + expect_type(get_chemical_mrv(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'character') expect_type(get_chemical_mrv(DTXCID = 'DTXCID30182'), 'character') - expect_type(get_chemical_mrv(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_mrv(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_mrv(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') #expect_type(get_chemical_mrv(DTXCID = 'DTXCID30182', API_key = ''), 'NULL') - expect_type(get_chemical_mol(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'character') + expect_type(get_chemical_mol(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'character') expect_type(get_chemical_mol(DTXCID = 'DTXCID30182'), 'character') - expect_type(get_chemical_mol(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_mol(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_mol(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') #expect_type(get_chemical_mol(DTXCID = 'DTXCID30182', API_key = ''), 'NULL') - expect_type(get_chemical_image(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'double') + expect_type(get_chemical_image(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'double') expect_type(get_chemical_image(DTXCID = 'DTXCID30182', format = 'png'), 'double') - expect_type(get_chemical_image(DTXSID = '', format = 'svg', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_image(DTXSID = '', format = 'svg', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_image(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') #expect_type(get_chemical_image(DTXCID = 'DTXCID30182', format = 'png', API_key = ''), 'NULL') - expect_type(get_chemical_synonym(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_chemical_synonym(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_chemical_synonym(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_chemical_synonym(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_chemical_synonym(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') }) diff --git a/tests/testthat/test-exposure-APIs-batch.R b/tests/testthat/test-exposure-APIs-batch.R index 68dbfa83..f8ce6612 100644 --- a/tests/testthat/test-exposure-APIs-batch.R +++ b/tests/testthat/test-exposure-APIs-batch.R @@ -16,23 +16,23 @@ test_that("DTXSID errors", { }) test_that("Rate limit warnings", { - expect_warning(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') }) test_that("Return data type", { - expect_type(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_exposure_functional_use_batch(DTXSID = c(''), API_key = ccte_key()), 'list') - expect_type(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_exposure_functional_use_probability_batch(DTXSID = c(''), API_key = ccte_key()), 'list') - expect_type(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_exposure_product_data_batch(DTXSID = c(''), API_key = ccte_key()), 'list') - expect_type(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_exposure_functional_use_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_exposure_functional_use_batch(DTXSID = c(''), API_key = ctx_key()), 'list') + expect_type(get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_exposure_functional_use_probability_batch(DTXSID = c(''), API_key = ctx_key()), 'list') + expect_type(get_exposure_product_data_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_exposure_product_data_batch(DTXSID = c(''), API_key = ctx_key()), 'list') + expect_type(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_exposure_list_presence_tags_by_dtxsid_batch(DTXSID = c(''), API_key = ctx_key()), 'list') })}) diff --git a/tests/testthat/test-exposure-APIs.R b/tests/testthat/test-exposure-APIs.R index 7a4d33fc..77fd38df 100644 --- a/tests/testthat/test-exposure-APIs.R +++ b/tests/testthat/test-exposure-APIs.R @@ -8,15 +8,15 @@ test_that("catch missing DTXSID", { }) test_that("Return data type", { - expect_type(get_exposure_functional_use(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_exposure_functional_use(DTXSID = '', API_key = ccte_key()), 'NULL') - expect_type(get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_exposure_functional_use_probability(DTXSID = '', API_key = ccte_key()), 'NULL') - expect_type(get_exposure_functional_use_category(API_key = ccte_key()), 'list') - expect_type(get_exposure_product_data(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_exposure_product_data(DTXSID = '', API_key = ccte_key()), 'NULL') - expect_type(get_exposure_product_data_puc(API_key = ccte_key()), 'list') - expect_type(get_exposure_list_presence_tags(API_key = ccte_key()), 'list') - expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_exposure_functional_use(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_exposure_functional_use(DTXSID = '', API_key = ctx_key()), 'NULL') + expect_type(get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_exposure_functional_use_probability(DTXSID = '', API_key = ctx_key()), 'NULL') + expect_type(get_exposure_functional_use_category(API_key = ctx_key()), 'list') + expect_type(get_exposure_product_data(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_exposure_product_data(DTXSID = '', API_key = ctx_key()), 'NULL') + expect_type(get_exposure_product_data_puc(API_key = ctx_key()), 'list') + expect_type(get_exposure_list_presence_tags(API_key = ctx_key()), 'list') + expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') })}) diff --git a/tests/testthat/test-hazard-APIs-batch.R b/tests/testthat/test-hazard-APIs-batch.R index d7addd1b..8df5cd73 100644 --- a/tests/testthat/test-hazard-APIs-batch.R +++ b/tests/testthat/test-hazard-APIs-batch.R @@ -1,11 +1,11 @@ with_mock_dir("hazard-batch",{ # test_that("catch missing APIs", { # #store env variable so tests don't overwrite -# # tmp <- Sys.getenv("CCTE_API_KEY") -# # on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# # if(Sys.getenv("CCTE_API_KEY") == ""){ +# # tmp <- Sys.getenv("CTX_API_KEY") +# # on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# # if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # # } # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # expect_message(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), verbose = TRUE), 'Using stored API key!') @@ -49,42 +49,42 @@ test_that('DTXSID errors', { }) test_that('Rate limit warnings', { - expect_warning(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') - expect_warning(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = '0'), 'Setting rate limit to 0 seconds between requests!') + expect_warning(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key(), rate_limit = -1), 'Setting rate limit to 0 seconds between requests!') }) test_that('Return data types', { - expect_type(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_human_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_human_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_human_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_ecotox_hazard_by_dtxsid_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_skin_eye_hazard_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_skin_eye_hazard_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_skin_eye_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_cancer_hazard_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_cancer_hazard_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_cancer_hazard_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_genetox_summary_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_genetox_summary_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_genetox_summary_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') - expect_type(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ccte_key()), 'list') - expect_type(get_genetox_details_batch(DTXSID = c(''), API_key = ccte_key()), 'list') + expect_type(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ctx_key()), 'list') + expect_type(get_genetox_details_batch(DTXSID = c(''), API_key = ctx_key()), 'list') expect_type(get_genetox_details_batch(DTXSID = c('DTXSID7020182'), API_key = ''), 'list') })}) diff --git a/tests/testthat/test-hazard-APIs.R b/tests/testthat/test-hazard-APIs.R index dcecca92..0feaf305 100644 --- a/tests/testthat/test-hazard-APIs.R +++ b/tests/testthat/test-hazard-APIs.R @@ -2,11 +2,11 @@ with_mock_dir("hazard",{ # test_that("catch missing API", { # # Run register_ccdr(key = 'YOUR KEY', write = TRUE) prior to running tests # #store env variable so tests don't overwrite -# # tmp <- Sys.getenv("CCTE_API_KEY") -# # on.exit(Sys.setenv("CCTE_API_KEY" = tmp)) -# # if(Sys.getenv("CCTE_API_KEY") == ""){ +# # tmp <- Sys.getenv("CTX_API_KEY") +# # on.exit(Sys.setenv("CTX_API_KEY" = tmp)) +# # if(Sys.getenv("CTX_API_KEY") == ""){ # # #set env variable temporarily for testing -# # Sys.setenv("CCTE_API_KEY" = "stored_api_key") +# # Sys.setenv("CTX_API_KEY" = "stored_api_key") # # } # expect_message(get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', verbose = TRUE), 'Using stored API key!') # expect_message(get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', verbose = TRUE), 'Using stored API key!') @@ -28,26 +28,26 @@ test_that("catch missing DTXSID", { }) test_that("Return data type", { - expect_type(get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_hazard_by_dtxsid(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_hazard_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_human_hazard_by_dtxsid(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_human_hazard_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_human_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_ecotox_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_ecotox_hazard_by_dtxsid(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_ecotox_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_ecotox_hazard_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_ecotox_hazard_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_skin_eye_hazard(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_skin_eye_hazard(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_skin_eye_hazard(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_skin_eye_hazard(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_skin_eye_hazard(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_cancer_hazard(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_cancer_hazard(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_cancer_hazard(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_cancer_hazard(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_cancer_hazard(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_genetox_summary(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_genetox_summary(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_genetox_summary(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_genetox_summary(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_genetox_summary(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') - expect_type(get_genetox_details(DTXSID = 'DTXSID7020182', API_key = ccte_key()), 'list') - expect_type(get_genetox_details(DTXSID = '', API_key = ccte_key()), 'NULL') + expect_type(get_genetox_details(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') + expect_type(get_genetox_details(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_genetox_details(DTXSID = 'DTXSID7020182', API_key = ''), 'NULL') }) }) diff --git a/vignettes/Bioactivity.Rmd b/vignettes/Bioactivity.Rmd index e00562ab..4b5cecf7 100644 --- a/vignettes/Bioactivity.Rmd +++ b/vignettes/Bioactivity.Rmd @@ -114,11 +114,8 @@ Specific assays may be searched as well as all available assays that have data u `get_annotation_by_aeid()` retrieves annotation for a specific assay endpoint id (aeid). -```{r ccdR annotation by aeid, message=FALSE, eval=FALSE} -res_dt <- get_annotation_by_aeid(AEID = "891") -# optionally perform this unnest, apply names_repair = "unique" to give a unique column name -# note - the gene column may be an array of multiple genes rather than just one, meaning this step may not work -#res_dt <- res_dt |> tidyr::unnest_wider(col = c("citation", "gene", "assayList"), names_repair = "unique") +```{r ccdR annotation by aeid, message=FALSE} +assay <- get_annotation_by_aeid(AEID = "891") ``` ```{r, echo=FALSE} @@ -134,11 +131,8 @@ assays <- data.table::rbindlist(assays) ``` -```{r ccdR all assays, message=FALSE, eval=FALSE} -res_dt <- get_all_assays() -# optionally perform the following unnest, apply names_repair = "unique" to give a unique column name -# note - the gene column may be an array of multiple genes rather than just one, meaning this step may not work -#res_dt <- res_dt |> tidyr::unnest_wider(col = c("citation", "gene", "assayList"), names_repair = "unique") +```{r ccdR-all-assays, message=FALSE, eval=FALSE} +printFormattedTable(assays, c(4, 18, 19, 33, 51)) # printed using custom formatted table ``` ### Get all assay annotations @@ -158,8 +152,8 @@ There are several resources for retrieving bioactivity data associated with a va `get_bioactivity_summary()` retrieves a summary of the number of active hits compared to the total number tested for both multiple and single concentration by aeid. -```{r ccdR summary by aeid, message=FALSE, eval=FALSE} -res_dt <- get_bioactivity_summary(AEID = "891") +```{r ccdR summary by aeid, message=FALSE} +summary <- get_bioactivity_summary(AEID = "891") ``` ```{r, echo=FALSE} @@ -183,9 +177,9 @@ printFormattedTable(summary) # printed using custom formatted table `get_bioactivity_details()` can retrieve all available multiple concentration data by assay endpoint id (aeid), sample id (spid), Level 4 ID (m4id), or chemical DTXSID. Returned is chemical information, level 3 concentration-response values, level 4 fit parameters, level 5 hit parameters, and level 6 flags for individual chemicals tested. An example for each request parameter is provided below: -```{r ccdR data by m4id, message=FALSE, results = FALSE, eval=FALSE} -res_dt <- get_bioactivity_details(m4id = 739695) - +```{r ccdR data by spid, message=FALSE, results = FALSE} +# By spid +spid_data <- get_bioactivity_details(SPID = 'TP0000904H05') ``` ```{r, echo=FALSE} @@ -197,11 +191,11 @@ printFormattedTable(head(spid_data), c(ncol(spid_data)-2)) # printed using custo m4id_data <- get_bioactivity_details(m4id = 739695) ``` - -```{r ccdR data by dtxsid, message=FALSE, results = FALSE, eval=FALSE} -res_dt <- get_bioactivity_details(DTXSID = "DTXSID7020182") +```{r, echo=FALSE} +printFormattedTable(m4id_data, c(ncol(m4id_data) - 2)) # printed using custom formatted table ``` + ```{r ccdR data by dtxsid, message=FALSE, results = FALSE} # By DTXSID dtxsid_data <- get_bioactivity_details(DTXSID = "DTXSID30944145") @@ -212,8 +206,9 @@ printFormattedTable(dtxsid_data, c(ncol(dtxsid_data)-2)) # printed using custom ``` -```{r ccdR data by aeid, message=FALSE, results = FALSE, eval=FALSE} -res_dt <- get_bioactivity_details(AEID = "891") +```{r ccdR data by aeid, message=FALSE, results = FALSE} +# By aeid +aeid_data <- get_bioactivity_details(AEID = 704) ``` ```{r, echo=FALSE} diff --git a/vignettes/Chemical.Rmd b/vignettes/Chemical.Rmd index 67ee91b7..08df781e 100644 --- a/vignettes/Chemical.Rmd +++ b/vignettes/Chemical.Rmd @@ -1,5 +1,5 @@ --- -title: "Chemical APIs" +title: "Chemical API" author: "Center for Computational Toxicology and Exposure" output: prettydoc::html_pretty: @@ -96,7 +96,6 @@ More information on Chemicals and Chemistry Data can be found here: