mkt.databases.chembl.ChEMBLMolecule

class mkt.databases.chembl.ChEMBLMolecule(id: str, url_suffix: str = '/molecule', url_base: str = 'https://www.ebi.ac.uk/chembl/api/data', url_query: str | None = None, params: dict = <factory>, verbose: bool = False, _json: dict | None = None)[source]

Bases: ChEMBL

ChEMBL molecule API client.

__init__(id: str, url_suffix: str = '/molecule', url_base: str = 'https://www.ebi.ac.uk/chembl/api/data', url_query: str | None = None, params: dict = <factory>, verbose: bool = False, _json: dict | None = None) None

Methods

__eq__(other)

Return self==value.

__init__(id[, url_suffix, url_base, ...])

__post_init__()

Initialize the ChEMBL API client.

_stamp_from_response(res)

Record query datetime + cache provenance from a requests-cache response.

_stamp_now()

Record current UTC datetime; cache provenance unknown.

adjudicate_preferred_name([str_in])

Return the adjudicated preferred name for the queried molecule.

check_molecules()

Check that a single molecule is returned for the query.

check_response(res)

Check the response status code for errors.

get_chembl_id()

Get the ChEMBL ID for the queried molecule.

query_api()

Query the ChEMBL API for a given URL.

return_preferred_name()

Return the preferred name for the queried molecule.

return_smiles()

Return the SMILES string for the queried molecule.

update_params(**kwargs)

Update the parameters for the API query.

update_url(url)

Update the URL for querying the ChEMBL API.

Attributes

__dataclass_fields__

__dataclass_params__

__match_args__

_json

JSON response from the API query.

from_cache

Whether the most recent response was served from requests-cache.

query_datetime

UTC datetime the underlying network query was made (cache creation time if served from cache).

url_base

Base URL for the ChEMBL API.

url_query

URL query for specific queries.

url_suffix

URL suffix for querying exact molecule match in ChEMBL.

verbose

Flag to enable verbose logging.

params

Parameters for the molecule API query.

id

ID for querying specific entities.

__init__(id: str, url_suffix: str = '/molecule', url_base: str = 'https://www.ebi.ac.uk/chembl/api/data', url_query: str | None = None, params: dict = <factory>, verbose: bool = False, _json: dict | None = None) None
adjudicate_preferred_name(str_in: str | None = None) str[source]

Return the adjudicated preferred name for the queried molecule.

Parameters:

str_in (str | None) – The input string to adjudicate the preferred name. If None, will not compare to input string.

Returns:

The adjudicated preferred name or the original ID if no preferred name is found or matches the input string.

Return type:

str

id: str

ID for querying specific entities.

params: dict

Parameters for the molecule API query.

return_preferred_name() str | None[source]

Return the preferred name for the queried molecule.

return_smiles() str | None[source]

Return the SMILES string for the queried molecule.

url_suffix: str = '/molecule'

URL suffix for querying exact molecule match in ChEMBL.