rxn.chemutils.smiles_randomization.randomize_smiles_rotated

rxn.chemutils.smiles_randomization.randomize_smiles_rotated(smiles, with_order_reversal=True)[source]

Randomize a SMILES string by doing a cyclic rotation of the atomic indices.

Adapted from https://github.com/GLambard/SMILES-X/blob/758478663030580a363a9ee61c11f6d6448e18a1/SMILESX/augm.py#L19.

The outputs of this function can be reproduced by setting the seed with random.seed().

Raises

InvalidSmiles – for invalid molecules.

Parameters
  • smiles (str) – SMILES string to randomize.

  • with_order_reversal (bool, default: True) – whether to reverse the atom order with 50% chance.

Return type

str

Returns

Randomized SMILES string.