Skip to Content
ReferenceAPIStandardising molecules

Standardising molecules

The one part of Ligase that needs a chemistry toolkit, and the only module that imports one. Install it with pip install 'ligase-bio[chem]'.

Everything else about molecules — loading a table, reading its representation, hashing it, refusing to join two that disagree — is the engine’s work and needs no toolkit (D49). What needs RDKit is producing a set whose standardisation is known, which is this.

chem.standardize

standardize(molecules: 'MoleculeSet', *, to: 'str') -> 'MoleculeSet'

Standardise a set of molecules and name them by InChIKey.

The output declares the state it has arrived in, by carrying a representation line, so everything downstream is checked against a true statement rather than against a claim nobody verified.

Parameters

ParameterDescription
moleculesThe set to standardise. It needs a smiles column: standardisation works on structures, and an InChIKey cannot be turned back into one.
toThe state to arrive in, spelled as a representation — inchikey; salt-stripped, charge-neutralised. The identity must be inchikey, because that is what this step computes and what four years of RDKit releases did not move.

Returns

A recipe, typed as the molecule set the step produces.

Raises

RaisesWhen
StepDefinitionErrorIf RDKit is not installed, or if to is not a representation this step can arrive at.

chem.standardize_ranking

standardize_ranking( molecules: 'MoleculeRanking', *, to: 'str', ) -> 'MoleculeRanking'

Standardise a ranking of molecules, keeping its order.

Everything standardize does, for the kind whose row order is the answer. The order is kept exactly: a molecule that does not standardise is left out, and every row below it moves up, so a cut-off taken after this step is not the cut-off taken before it.

Parameters

ParameterDescription
moleculesThe ranking to standardise, in rank order.
toAs standardize.

Returns

A recipe, typed as the molecule ranking the step produces.

Raises

RaisesWhen
StepDefinitionErrorAs standardize.

chem.toolkit_version

toolkit_version() -> 'str'

The version of RDKit this interpreter has.

Called before a standardize step is built rather than inside it, so that the version is one of the step’s parameters and joins its cache key. Read inside the body it would not, and the step would then serve a cached answer across an upgrade that could have changed every key it computed — which is exactly the failure D42’s version-capture clause was written for, where upgrading bwa moved no key at all.

Returns

The version, as RDKit reports it, e.g. 2026.03.6.

Raises

RaisesWhen
StepDefinitionErrorIf RDKit is not installed, naming the extra.
Last updated on