Skip to contents

ComptoxR 4.0 generates its wrappers from the production API schemas. Most wrappers return the same data as before, but many have new names and some have been removed. chemi_stdizer_records() and chemi_toxprints_bulk() return a different shape; see below. This article lists what to change in a 3.x script. The full list, including every rename, is in the changelog.

The API key

ct_api_key() is gone. Wrappers read the ctx_api_key environment variable directly. Set it once in ~/.Renviron:

ctx_api_key=YOUR_KEY_HERE

or for the current session only:

Sys.setenv(ctx_api_key = "YOUR_KEY_HERE")

Renamed wrappers

Wrapper names now follow the API path. Most renames follow one of these patterns:

Calling an old name gives “could not find function”. Look the name up in the rename table in the changelog. One old name now belongs to a different endpoint: in 4.0, chemi_chet_curators_libraries() is the renamed chemi_chet_curators_libraries_by_lib_id() and needs a lib_id. The 3.x function of that name, which created a library, has been removed.

Bulk argument names

Most bulk CTX wrappers name their input after the identifier instead of query:

# 3.x
ct_hazard_toxval_search_bulk(query = ids)
# 4.0
ct_hazard_toxval_search_by_dtxsid_bulk(dtxsid = ids)

Calls that pass the IDs by position only need the new function name. ct_chemical_detail_search_by_dtxsid_bulk(), ct_chemical_detail_search_by_dtxcid_bulk() and ct_chemical_search_equal_bulk() still take query; ct_chemical_msready_search_by_mass_bulk() takes body. Check its help page.

Removed functions

Removed Use instead
ct_api_key() the ctx_api_key environment variable
generic_request(), generic_chemi_request() the wrapper for the endpoint
chemi_functional_use() chemi_amos_functional_uses_for_dtxsid()
chemi_predict() chemi_webtest_predict_bulk()
chemi_safety_section() chemi_resolver_pubchem_section()
chemi_toxprint() chemi_toxprints_calculate_bulk()
chemi_chet_chemicals_database_old() chemi_chet_chemicals_database()
chemi_chet_reaction_database_old() chemi_chet_reaction_database()

Wrappers for write, admin, upload and export endpoints were also removed, as were a few whose production schema is broken. The changelog lists each one.

Changed arguments