data_sources
Thin wrappers over PubChem and ChEMBL endpoints.
- drugs.data_sources.pubchem_properties(cid: int, properties: Iterable[str] = ('IUPACName', 'InChIKey', 'CanonicalSMILES', 'MolecularFormula', 'MolecularWeight', 'XLogP', 'TPSA')) Dict[str, Any]
Fetch core compound properties from PubChem PUG-REST.
- Parameters:
cid (int) – PubChem compound identifier.
properties (Iterable[str], optional) – Property names to request. Defaults to a curated set including IUPAC name, InChIKey, SMILES, formula, and physicochemical descriptors.
- Returns:
First property record returned by PUG-REST, or an empty dict when missing.
- Return type:
dict
- drugs.data_sources.pubchem_pug_view_record(cid: int) Dict[str, Any]
Fetch the full PUG-View record for a compound.
- Parameters:
cid (int) – PubChem compound identifier.
- Returns:
Complete PUG-View record payload in display mode.
- Return type:
dict
- drugs.data_sources.pubchem_text_snippets(cid: int, headings: Iterable[str]) Dict[str, Dict[str, Any]]
Fetch text snippets for selected PUG-View headings.
Invalid headings for the specific compound are skipped silently to avoid PUG-View errors.
- Parameters:
cid (int) – PubChem compound identifier.
headings (Iterable[str]) – Heading labels to fetch for the compound.
- Returns:
Mapping of heading -> payload containing the record title, section tree, and list of readable string snippets.
- Return type:
dict[str, dict]
- drugs.data_sources.list_pubchem_text_headings(cid: int) List[str]
List PUG-View headings available for a compound.
- Parameters:
cid (int) – PubChem compound identifier.
- Returns:
Unique heading labels in first-seen order.
- Return type:
list[str]
- drugs.data_sources.chembl_molecules_by_inchikey(inchikey: str, limit: int = 10) List[Dict[str, Any]]
Query ChEMBL for molecules by InChIKey.
- Parameters:
inchikey (str) – Standard InChIKey to search for.
limit (int, default=10) – Maximum number of molecules to return.
- Returns:
Sequence of molecule records returned by the ChEMBL API.
- Return type:
list[dict]
- drugs.data_sources.chembl_mechanisms(molecule_chembl_id: str, limit: int = 50) List[Dict[str, Any]]
Fetch mechanisms of action for a ChEMBL molecule.
- Parameters:
molecule_chembl_id (str) – ChEMBL molecule identifier.
limit (int, default=50) – Maximum number of mechanism records to fetch.
- Returns:
Mechanism-of-action entries returned by ChEMBL.
- Return type:
list[dict]
- drugs.data_sources.chembl_target_detail(target_chembl_id: str) Dict[str, Any]
Fetch target details from ChEMBL, including components.
- Parameters:
target_chembl_id (str) – ChEMBL target identifier.
- Returns:
Target detail payload containing components, accessions, and synonyms.
- Return type:
dict