vibesketch.document.abbreviations

Abbreviations such as Ph, Boc and OTf: contracted and expanded on a drawn species (#90).

An abbreviation is the canvas engine’s own superatom (SUP) S-group: the KET molecule keeps every atom and bond, and the group names the atoms that the canvas and figures show as one label. Contracting or expanding therefore changes only how a structure is drawn; its SMILES, InChIKey, calculations and exports are those of the full structure, and each atom stays where it was drawn.

Groups are found with RDKit’s abbreviation matcher (rdAbbreviations, G. Landrum, RDKit 2020.09), over a table of the abbreviations the Journal of Organic Chemistry lists as standard (“Standard Abbreviations and Acronyms”, J. Org. Chem. author guidelines) followed by RDKit’s own defaults. Larger groups come first, so Cbz is preferred over Bn and Bn over Ph. Figures draw a contracted group as its label at the atom that carries the bond, with the label reversed (TfO, EtO2C) when the bond leaves it to the right.

Functions

abbreviation_labels()

The labels that can be contracted, largest groups first.

abbreviations_of(document)

The contracted abbreviations drawn in each species, by species id.

condensed(mol, abbreviations)

A copy of mol with each abbreviation drawn as one labelled atom, for figures.

with_abbreviations(document[, species, labels])

document with abbreviations contracted in the drawing of species, or of all.

without_abbreviations(document[, species, ...])

document with the abbreviations of species, or of all, expanded to their atoms.

Exceptions

AbbreviationRefused

Abbreviations that cannot be contracted or expanded as asked.

exception vibesketch.document.abbreviations.AbbreviationRefused[source]

Bases: ValueError

Abbreviations that cannot be contracted or expanded as asked.

vibesketch.document.abbreviations.abbreviation_labels()[source]

The labels that can be contracted, largest groups first.

Return type:

list[str]

vibesketch.document.abbreviations.abbreviations_of(document)[source]

The contracted abbreviations drawn in each species, by species id.

Parameters:

document (Document)

Return type:

dict[str, list[str]]

vibesketch.document.abbreviations.condensed(mol, abbreviations)[source]

A copy of mol with each abbreviation drawn as one labelled atom, for figures.

Each atom kept carries its index in mol as the vibesketch_index property, so highlights and other marks can follow it. A group with no bond to the rest of the molecule is drawn in full.

Parameters:
Return type:

Any

vibesketch.document.abbreviations.with_abbreviations(document, species=None, labels=None)[source]

document with abbreviations contracted in the drawing of species, or of all.

Without labels every known group is contracted, as long as the groups leave most of each molecule drawn; named labels are contracted wherever they occur. A group that overlaps one already on the canvas is left alone.

Parameters:
Return type:

Document

vibesketch.document.abbreviations.without_abbreviations(document, species=None, labels=None)[source]

document with the abbreviations of species, or of all, expanded to their atoms.

labels limits it to groups of those names; any group the canvas holds, including one made in the canvas, can be named.

Parameters:
Return type:

Document