dgllife.utils.load_molecule

dgllife.utils.load_molecule(molecule_file, sanitize=False, calc_charges=False, remove_hs=False, use_conformation=True)[source]

Load a molecule from a file of format .mol2 or .sdf or .pdbqt or .pdb.

Parameters
  • molecule_file (str) – Path to file for storing a molecule, which can be of format .mol2 or .sdf or .pdbqt or .pdb.

  • sanitize (bool) – Whether sanitization is performed in initializing RDKit molecule instances. See https://www.rdkit.org/docs/RDKit_Book.html for details of the sanitization. Default to False.

  • calc_charges (bool) – Whether to add Gasteiger charges via RDKit. Setting this to be True will enforce sanitize to be True. Default to False.

  • remove_hs (bool) – Whether to remove hydrogens via RDKit. Note that removing hydrogens can be quite slow for large molecules. Default to False.

  • use_conformation (bool) – Whether we need to extract molecular conformation from proteins and ligands. Default to True.

Returns

  • mol (rdkit.Chem.rdchem.Mol) – RDKit molecule instance for the loaded molecule.

  • coordinates (np.ndarray of shape (N, 3) or None) – The 3D coordinates of atoms in the molecule. N for the number of atoms in the molecule. None will be returned if use_conformation is False or we failed to get conformation information.