utils

pubchem_downloader

class pdbeccdutils.utils.pubchem_downloader.PubChemDownloader(pubchem_templates: str)

Toolkit to retrieve 2D layouts from the PubChem database.

process_template(component)

Process template for a given component. First the component is attempted to be downloaded and re-scaled. Since the RDKit default depiction has 1.5A single bond size whereas templates from pubchem are 1.0A.

Parameters:
  • component (Component) – Component

  • destination (str) – Path to the pubchem 2D template dir

Returns:

whether or not the new template has been processed

Return type:

bool

update_ccd_dir(components: str)

Update 2D images of PDBeChem components which are available in the pubchem database

Parameters:

components (str) – Path to the directory with components in .cif format

update_ccd_file(ccd: str) None

Update 2d images of pdbechem components which are available in the pubchem database from CCD files.

Parameters:

ccd (str) – Path to the the .cif CCD file

pdbeccdutils.utils.pubchem_downloader.download_template(destination: str, template_id: str, inchikey: str) bool

Download 2D layout from the PubChem FTP.

Parameters:
  • destination (str) – Path to the pubchem template

  • template_id (str) – CCD id of a pubchem template

  • inchikey (str) – CCD’s INCHIKey

Returns:

If the download was successful or no.

Return type:

bool

pdbeccdutils.utils.pubchem_downloader.rescale_molecule(path, factor)

Rescale molecule coords to a given factor

Parameters:
  • path (str) –

  • factor (float) – rescaling factor

web_services

module handling UniChem mapping

pdbeccdutils.utils.web_services.get_agreed_unichem_mapping(inchikey)
Get the agreed mappings for PDBeChem:
  • ChEMBL, DrugBank, KEGG LIGAND, ChEBI, ZINC, N¬MRShiftDB, BindingDB MetaboLights, BRENDA, Rhea

Parameters:

inchikey (str) – InchiKey (preferably from CIF CCD)

Returns:

str: Resource mapping. Key is a resource name,

value is the internal identifier.

Return type:

dict of str

pdbeccdutils.utils.web_services.get_all_unichem_mapping(inchikey)

Get all mappings for PDBeChem

Parameters:

inchikey (str) – InchiKey (preferably from CIF CCD)

Returns:

str: Resource mapping. Key is a resource name,

value is the internal identifier.

Return type:

dict of str