mispr.common package

Submodules

mispr.common.pubchem module

Implement a core class PubChemRunner for retrieving molecules from the PubChem database using a molecule name as a query criteria.

class mispr.common.pubchem.PubChemRunner(abbreviation, working_dir=None)[source]

Bases: object

Wrapper for retrieving molecules from PubChem database.

Parameters:
abbreviation : str

Abbreviation to be used when saving molecule file.

working_dir : str, optional

Working directory for saving the molecule file in; will use the current working directory if not specified.

cleanup()[source]

Delete the sdf file downloaded from PubChem.

convert_sdf_to_mol(save_to_file, fmt)[source]

Convert an SDF file to a pymatgen Molecule object.

Parameters:
save_to_file : bool

Whether to save the Molecule object to a file.

fmt : str

Molecule file format if save_to_file is True.

Returns:

pymatgen Molecule object.

Return type:

Molecule

download_sdf(name)[source]

Download an SDF file from PubChem using a common name for the molecule as an identifier.

Parameters:
name : str

Name of the molecule to use for searching PubChem.

get_mol(name, save_to_file=True, fmt='pdb', cleanup=True)[source]

Wrapper function that searches for a molecule in the PubChem database, downloads it in the form of an SDF file, and converts the file to a pymatgen Molecule object.

Parameters:
name : str

Name of the molecule to use for searching PubChem.

save_to_file : bool, optional

Whether to save the Molecule object to a file. Defaults to True.

fmt : str, optional

Molecule file format if save_to_file is True; defaults to “pdb”.

cleanup : bool, optional

Whether to remove the intermediate sdf file.

Returns:

pymatgen Molecule object.

Return type:

Molecule

Module contents