drugforge.data.services.cdd.cdd_api.CDDAPI

class drugforge.data.services.cdd.cdd_api.CDDAPI(url: str, api_version: str, api_key: str, vault: str)[source]

Bases: _BaseWebAPI

An interface to the CDD JSON API which allows you to search for molecules protocols and readouts like IC50.

__init__(url: str, api_version: str, api_key: str, vault: str)[source]

Methods

__init__(url, api_version, api_key, vault)

from_settings(settings)

get_async_export(job_id)

A helper method to gather async request results.

get_ic50_data(protocol_name)

A convenience method which wraps the required function calls to gather the raw ic50 data from the CDD for the calculated as part of the named protocol.

get_molecules([smiles, names, compound_ids])

Search for molecules in the CDD vault.

get_protocols([protocol_names])

Search for a specific protocol.

get_readout(protocol_name, readout)

get_readout_rows(protocol[, molecule_ids, types])

Get the readout data for a specific protocol performed on a set of molecules.

token_name()

Return the name of the API token which should be used in the header.

get_async_export(job_id: int) dict[source]

A helper method to gather async request results.

Args:

job_id: The id of the request we want the results for.

Notes:

This function waits till the request is complete before returning the results.

Returns:

The finished request.

get_ic50_data(protocol_name: str) DataFrame | None[source]

A convenience method which wraps the required function calls to gather the raw ic50 data from the CDD for the calculated as part of the named protocol.

Args:

protocol_name: The name of the protocol we want all IC50 result for.

Returns:

A list of dictionaries containing the IC50 values along with upper and lower CI and curve class for each batch measurement on the molecules performed as part of the given protocol.

get_molecules(smiles: str | None = None, names: list[str] | None = None, compound_ids: list[int] | None = None) list[dict] | None[source]

Search for molecules in the CDD vault.

Notes:

CDD only allows for a single structure searches via smiles, multiple molecules can be downloaded when using names or compound_ids. If molecule ids are missing in CDD we only return the subset that can be found

Args:

smiles: The smiles of the molecule to search for. names: The list of names of molecules which should be searched in the CDD. compound_ids: The list of CDD compound ids of molecules we wish to search for.

Returns:

A list of molecules found in the CDD.

get_protocols(protocol_names: list[str] | None = None) list[dict][source]

Search for a specific protocol.

Args:

protocol_names: The list of protocol names to search for, if not provided all protocols will be pulled.

Returns:

A list of protocols associated with the given name

get_readout_rows(protocol: int, molecule_ids: list[int] | None = None, types: list[str] | None = None) list[dict] | None[source]

Get the readout data for a specific protocol performed on a set of molecules.

Args:

molecule_ids: The CDD ids of the molecules to get the values for if None all molecules under this protocol will be downloaded. protocol: The id of the protocol to use in the search. types: A list of readout types to pull the results for.

Returns:

A dictionary of the readout data matching the search. The actual values are stored under readouts.

classmethod token_name() str[source]

Return the name of the API token which should be used in the header.