chemistry_tools.pubchem.description

Attention

This package has the following additional requirements:

cawdrey>=0.1.7
mathematical>=0.1.13
pillow>=7.0.0
pyparsing>=2.4.6
tabulate>=0.8.9

These can be installed as follows:

python -m pip install chemistry-tools[pubchem]

Functions to access the name and description of compounds in the PubChem database.

Functions:

get_common_name(name)

Returns the common name for the compound with the given name.

get_compound_id(name)

Returns the compound ID (CID) for the compound with the given name.

get_description(name)

Returns the description compound with the given name.

get_iupac_name(name)

Returns the systematic IUPAC name for the compound with the given name.

parse_description(description_data)

Parse raw data from the description endpoint of the REST API.

rest_get_description(identifier[, namespace])

Obtains the description for the given compound from the PubChem REST API.

get_common_name(name)[source]

Returns the common name for the compound with the given name.

Parameters

name (str)

Return type

str

get_compound_id(name)[source]

Returns the compound ID (CID) for the compound with the given name.

Parameters

name (str)

Return type

str

get_description(name)[source]

Returns the description compound with the given name.

Parameters

name (str)

Return type

str

get_iupac_name(name)[source]

Returns the systematic IUPAC name for the compound with the given name.

Parameters

name (str)

Return type

str

parse_description(description_data)[source]

Parse raw data from the description endpoint of the REST API.

Parameters

description_data (Dict[str, Any])

Return type

List[Dict]

Returns

A list of dictionaries containing the CID, Title and Description for each compound

rest_get_description(identifier, namespace=<PubChemNamespace.Name: 'name'>, **kwargs)[source]

Obtains the description for the given compound from the PubChem REST API.

Parameters
  • identifier (Union[str, int, Sequence[Union[str, int]]]) – Identifiers (e.g. name, CID) for the compound to look up. When using the CID namespace data for multiple compounds can be retrieved at once by supplying either a comma-separated string or a list.

  • namespace (Union[PubChemNamespace, str]) – The type of identifier to look up. Valid values are in PubChemNamespace. Default <PubChemNamespace.Name: 'name'>.

  • kwargs – Optional arguments that json.loads takes.

Raises

ValueError – If the response body does not contain valid JSON.

Return type

Dict[str, Any]

Returns

Parsed JSON data