pdom.Molecule

class pdom.Molecule(identifier, properties, save=True)

This class should not be initialised directly. Use one of the following class methods instead: from_chem_id(), from_folder(), from_inchi(), from_inchi_key(), from_iupac_name(), from_name()

Parameters:
  • identifier (dict) –
    • name common name
    • iupac_name IUPAC name (can be the same as common name)
    • chem_id compound ID from PubChem
    • inchi IUPAC International Chemical Identifier (human readable)
    • inchi_key IUPAC International Chemical Identifier (hash)
  • properties (dict) –
    • chem_formula chemical formula e.g. ‘C10H22’
    • chem_formdic chemical formula as dict
    • mol_weight molecular weight in g/mol
    • mol_volume molecular volume in cm^3/mol
    • mol_surface largest projected surface area m^2/molecule
    • excess_bonds number of bonds in excess of a simple carbon chain
    • structure_3d atom position list
  • save (bool) – save data to the user cache
classmethod from_chem_id(chem_id, name=None, inchi_key=None)

Create Molecule instance identified by a chemID from PubChem data.

Note:

if molecule is cached in Molecule.db_folder load from there

Parameters:
  • chem_id (int) –

    compound ID from PubChem

  • name (str, optional) – overwrite compound name
  • inchi_key (str, optional) – IUPAC International Chemical Identifier (to check cache quickly)
Returns:

Molecule instance

classmethod from_folder(folder)

create Molecule instance from a folder created by save

Parameters:folder (str, folder) – molecule folder
Returns:Molecule instance
classmethod from_name(name)

Create Molecule instance identified by a name if unique

Note:queries chem_id and calls from_chem_id()
Parameters:name (str) – unique compound name
Returns:Molecule instance
identifier = None

dict of identifiers as described in Molecule

properties = None

dict of properties as described in Molecule

save(folder=None, name=None)

saves the molecule information to disk, can be loaded with from_folder()

Note:

If called without parameters the molecule is saved in an appropriate cache folder Molecule.db_folder.

Parameters:
  • folder (str, Path) – parent folder
  • name (str) – molecule folder name (default INCHI key)
structure_3d(rotated=True)

Returned 3d structure of the molecule

Parameters:rotated (bool) – if True the structure is rotated to cover the maximum surface in the xy space
Returns:3D structure (symbol, x, y, z)
Return type:list