schrodinger.structutils.smiles module

A module for generating SMILES and unique SMILES strings.

Provides python access to the classes in the canvaslibs_ext directory.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.structutils.smiles.get_property_name(stereo)

Return the default m2io property name for the unique SMILES string with the type of stereochemistry given in ‘stereo’.

Parameters

stereo – Any of the module level variables NO_STEREO, STEREO_FROM_GEOMETRY, STEREO_FROM_ANNOTATION, or STEREO_FROM_ANNOTATION_AND_GEOM, or values from the actual enum in the ChmMmctAdaptor class.

schrodinger.structutils.smiles.remove_stereo_annotation(struct)

There is no current option in the SmilesGenerator that can be used to determine stereochemical information from the 3d geometry only. The STEREO_FROM_3D option does not override any stereochemical annotations that are already present in a structure.

If you want the stereochemistry to be determined by the 3d geometry only, use this function to remove any existing stereochemical annotations.

This is a recognized issue that will be addressed in future releases in a backwards compatible way.

class schrodinger.structutils.smiles.SmilesGenerator(stereo='annotation_and_geom', unique=True, safe=True, wantAllH=False, forceAllBondOrders=False)

Bases: object

A class to generate a SMILES string from a Structure object.

This is just a thin wrapper to the canvaslibs_ext classes.

__init__(stereo='annotation_and_geom', unique=True, safe=True, wantAllH=False, forceAllBondOrders=False)

Construct a SmilesGenerator with specific behavior for stereochemistry and unique smiles. Deprecated; use schrodinger.adapter.to_smiles() instead.

Parameters
  • stereo

    This should be set to one of the module level constants

    and will specify behavior in the getSmiles method. Can be one of the following (default is STEREO_FROM_ANNOTATION_AND_GEOM):

    • STEREO_FROM_ANNOTATION_AND_GEOM - Derive stereochemistry from annotations, but use the 3D coordinates when no annotation is present. This is the same behavior as the old STEREO_FROM_3D option, which is deprecated.

    • STEREO_FROM_ANNOTATION - Derive stereochemistry from pre-existing mmstereo properties (faster, so useful when structures are known to be 2D).

    • STEREO_FROM_GEOMETRY - Derive stereochemistry from the 3D coordinates only (for 3D structures). Annotations are used for 2D structures.

    • NO_STEREO - Don’t include stereochemistry.

  • unique (bool) – If True, generate unique (a.k.a. canonical) SMILES.

  • safe (bool) – If True, use only stereochemistry from mmstereo that is deemed “safe” by the Canvas libraries. If False, use all stereochemistry info from mmstereo. This is relevant for the STEREO_FROM_GEOMETRY, STEREO_FROM_ANNOTATION, and STEREO_FROM_ANNOTATION_AND_GEOM options of the stereo argument.

  • wantAllH (bool) – If True, each hydrogen receives its own SMILES token

  • forceAllBondOrders (bool) – If True, all bond orders in the SMILES will be explicit. By default, aromatic and single bond orders (C-C, c:c) are suppressed.

getSmiles(struct)

Returns a SMILES string for a structure. Use the wantAllH option when initializing the SmilesGenerator instance if hydrogens are needed. Deprecated; use schrodinger.adapter.to_smiles() instead.

Parameters

struct – The Structure object from which to generate the SMILES string.

getSmilesAndMap(struct)

Returns a SMILES string and index mapping of the atoms in a structure. Use the wantAllH option when initializing the SmilesGenerator instance to speicify whether hydrogens should be included (default is to include heavy atoms only). Deprecated; use schrodinger.adapter.to_smiles_canonical_atom_order() instead.

Parameters

struct – The Structure object from which to generate the SMILES string.

Return type

(str, list)

Returns

SMILES string, and a list of new atom indices, which can be passed directly to build.reorder_atoms().

getStandardizedSmiles(struc)

Get a SMILES string representing the standardized version of a structure by neutralizing the structure first. This ensures different ionization states of the same compound produce the same SMILES. Different tautomers will still generate different SMILES. To check whether different input structures are tautomers of each other, analyze.generate_tautomer_code() can be used. Deprecated; use schrodinger.adapter.to_smiles() instead.

Parameters

struc (schrodinger.strucgture.Structure) – Structure to get the standardized SMILES string for.

Returns

Standardized SMILES string

Return type

str

canonicalize(pattern)

Return canonicalized (unique) version of the specified SMILES string.