Miscellaneous Utilities

smi2mol_with_errors(smi)[source]

Parse SMILES and return any associated errors or warnings

Parameters:

smi (str) – input SMILES

Return type:

Tuple[Mol, str]

Returns:

tuple of RDKit molecule, warning or error

count_fragments(mol)[source]

Count the number of fragments in a molecule

Parameters:

mol (Mol) – RDKit molecule

Return type:

int

Returns:

number of fragments

get_largest_fragment(mol)[source]

Return the fragment with the largest number of atoms

Parameters:

mol (Mol) – RDKit molecule

Return type:

Mol

Returns:

RDKit molecule with the largest number of atoms

taylor_butina_clustering(fp_list, cutoff=0.35)[source]

Cluster a set of fingerprints using the RDKit Taylor-Butina implementation

Parameters:
  • fp_list (List[ExplicitBitVect]) – a list of fingerprints

  • cutoff (float) – similarity cutoff

Return type:

List[int]

Returns:

a list of cluster ids

label_atoms(mol, labels)[source]

Label atoms when depicting a molecule

Parameters:
  • mol (Mol) – input molecule

  • labels (List[str]) – labels, one for each atom

Return type:

Mol

Returns:

molecule with labels

tag_atoms(mol, atoms_to_tag, tag='x')[source]

Tag atoms with a specified string

Parameters:
  • mol (Mol) – input molecule

  • atoms_to_tag (List[int]) – indices of atoms to tag

  • tag (str) – string to use for the tags

Return type:

Mol

Returns:

molecule with atoms tagged

rd_shut_the_hell_up()[source]

Make the RDKit be a bit more quiet

Return type:

None

Returns:

None

demo_block_logs()[source]

An example of another way to turn off RDKit logging

Return type:

None

Returns:

None