vibesketch.document.rgfile

R-group files: R-group cores and their definitions in one V3000 molfile (#90).

The format is the CTfile V3000 R-group query (BIOVIA, “CTfile Formats”, chapter “Rgroup query”): the root connection table, whose R-group atoms are R# with RGROUPS=(1 n), followed by one block per definition:

M  V30 BEGIN RGROUP 1
M  V30 RLOGIC 2 1 1-3
M  V30 BEGIN CTAB
... one connection table per member, its attachment points ATTCHPT=1 ...
M  V30 END CTAB
M  V30 END RGROUP

RLOGIC gives the R-group this one requires (0 for none), whether unsubstituted positions are hydrogen (rest-H) and the occurrence. RDKit reads and writes each connection table, but not the RGROUP blocks, which this module adds and splits off (maintainer decisions, 2026-10-24).

Functions

is_rgfile(text)

read_rgfile(text)

The root molecule and the definitions of an R-group file.

rgfile(root, definitions)

root and the RGROUP blocks of definitions as one V3000 molfile.

Classes

Definition(number[, members, occurrence, ...])

One R-group's definition: its members and its logic.

Exceptions

RgfileUnreadable

The R-group blocks of a molfile could not be read.

class vibesketch.document.rgfile.Definition(number, members=<factory>, occurrence='', rest_h=False, if_then=0)[source]

Bases: object

One R-group’s definition: its members and its logic.

Parameters:
number: int
members: list[Any]
occurrence: str = ''
rest_h: bool = False
if_then: int = 0
exception vibesketch.document.rgfile.RgfileUnreadable[source]

Bases: ValueError

The R-group blocks of a molfile could not be read.

vibesketch.document.rgfile.read_rgfile(text)[source]

The root molecule and the definitions of an R-group file.

RDKit reads the root and each member; its R# atoms keep their numbers and the members’ ATTCHPT their attachment points.

Parameters:

text (str)

Return type:

tuple[Any, list[Definition]]

vibesketch.document.rgfile.rgfile(root, definitions)[source]

root and the RGROUP blocks of definitions as one V3000 molfile.

Parameters:
Return type:

str

vibesketch.document.rgfile.is_rgfile(text)[source]
Parameters:

text (str)

Return type:

bool