shnitsel.rd#

This module contains functions that accept an RDKit.Chem.Mol object; but not necessarily functions that return a Mol object.

Functions#

set_atom_props(mol[, inplace])

Set properties on atoms of an rdkit.Chem.Mol object

mol_to_numbered_smiles(mol)

Generate a SMILES string containing mapping numbers

highlight_pairs(mol, feature_indices)

Highlight specified pairs of atoms in an image of an rdkit.Chem.Mol object

Module Contents#

set_atom_props(mol, inplace=False, **kws)#

Set properties on atoms of an rdkit.Chem.Mol object

Parameters:
  • mol (rdkit.Chem.mol) – The Mol object

  • inplace (bool, optional) – Whether to alter mol; , by default False (returns a copy)

  • **kws (Sequence[str | int] | Literal[True] | Mapping[int, int | str] | None) –

    A mapping where parameter names represent the name of a property and the arguments are either

    • a dict mapping the atom indices to values that should be assigned. Missing atom indices are ignored

    • a sequence of str or int values the atoms should be set to;

    • True, in which case the atom indices as assigned by RDKit will be used as values;

    • False, in which the property will be cleared on every atom.

    • None values, which are simply ignored

Return type:

A copy of the Mol object, if inplace=False, otherwise the provided mol

Raises:

ValueError – If the amount of values passed to the properties kwargs did not match the amount of atoms in the mol.

mol_to_numbered_smiles(mol)#

Generate a SMILES string containing mapping numbers corresponding to the atom indices in the mol object

Parameters:

mol (rdkit.Chem.Mol) – An rdkit.Chem.Mol object

Return type:

A SMILES string

Notes

This is intended as a way to store the connectivity and order of a matrix of coordinates

highlight_pairs(mol, feature_indices)#

Highlight specified pairs of atoms in an image of an rdkit.Chem.Mol object

Parameters:
  • mol (rc.Mol) – The Mol object

  • feature_indices (Sequence[FeatureDescriptor]) – A list of tuples of indices for various features.

Return type:

Raw PNG data