SMILES

class Smiles[source]

Bases: stk.molecular.key_makers.molecule.MoleculeKeyMaker

Used to get the SMILES of molecules.

Examples

Adding SMILES to a Molecule’s JSON

You want to use the isomeric, canonical SMILES from RDKit as part of a JSON representation of a molecule

import stk

jsonizer = stk.MoleculeJsonizer(
    key_makers=(stk.Smiles(), ),
)
# Get the JSON representation, including an SMILES.
json = jsonizer.to_json(stk.BuildingBlock('NCCN'))

Methods

get_key(molecule)

Get the key of molecule.

get_key_name()

Get the name of the key.

__init__()[source]

Initialize a Smiles instance.

get_key(molecule)

Get the key of molecule.

Parameters

molecule (Molecule) – The molecule for which a key is needed.

Return type

object

Returns

The key of molecule.

get_key_name()

Get the name of the key.

Return type

str

Returns

The name of the key.