get_chem_id: Retrieve chemical identity from HTTK package

View source: R/get_chem_id.R

get_chem_idR Documentation

Retrieve chemical identity from HTTK package

Description

Given one of chem.name, chem.cas (Chemical Abstract Service Registry Number), dtxsid (DSStox Substance Identifier), or cichem, this function checks if the chemical is available in the chem.physical_and_invitro.data normalized structure and returns matching chemical identifiers.

Usage

get_chem_id(
  chem.cas = NULL,
  chem.name = NULL,
  dtxsid = NULL,
  cichem = NULL,
  internal.chem.id = FALSE
)

Arguments

chem.cas

CAS registry number (character, single value)

chem.name

Chemical name or synonym (character, single value)

dtxsid

DSSTox Substance identifier (character, single value)

cichem

Internal chemical ID code (character, single value)

internal.chem.id

If TRUE, returns the internal chemical ID (chem_id) instead of other identifiers

Details

The function accepts one chemical identifier.

Priority order for matching: 1. If chem.cas provided: matched against CASRN in chemicals table 2. If dtxsid provided: matched against DTXSID in chemicals table 3. If cichem provided: matched against cichem in chemicals table 4. If chem.name provided: matched via normalized synonyms table

When looking up by chem.name, the function searches the synonyms table in normalized form (lowercase, no spaces/hyphens), allowing flexible matching of different name formats for the same chemical.

An error is raised if: - Multiple chemicals match the provided identifier - No chemicals match any provided identifier

Value

A tibble with a single row containing:

chem_id

Internal chemical database ID

chem.cas

CAS registry number

chem.name

Primary compound name (from synonyms table)

dtxsid

DTXSID identifier

cichem

Internal chemical code

match_type

Which identifier was used for lookup (cas, dtxsid, cichem, or name)

Author(s)

John Wambaugh and Robert Pearce


httk documentation built on Nov. 26, 2026, 9:08 a.m.