module Chem::Mol

Overview

This module provides support for reading and writing MDL Mol files, including the connection table (CTAB) formats V2000 and V3000.

Format specification can be found in the CTFile Formats document published by BIOVIA.

NOTE The title in the MOL file will be used as residue name if it contains 3-4 uppercase letters and numbers only. In such case, the comment line will be set as the title of the structure.

WARNING Basic support only. MDL valence model (implicit hydrogens), connectivity information besides bonds, stereochemistry information (e.g., chirality, 3D), advanced properties like Sgroup, reaction data, etc. are unsupported/ignored. Therefore, hydrogens are expected to be defined explicitly.

Defined in:

chem/formats/mol.cr

Class Method Summary

Class Method Detail

def self.read(io : IO) : Structure #

Reads the structure from io. Supports both V2000 and V3000 variants.


[View source]
def self.read(path : Path | String) : Structure #

Reads the structure from path. Supports both V2000 and V3000 variants.


[View source]
def self.write(io : IO, obj : Structure | AtomView, variant : Mol::Variant = :v2000) : Nil #

Writes a structure or group of atoms to io.

The CTAB format is specified via variant: V2000 (legacy) or V3000.


[View source]
def self.write(path : Path | String, obj : Structure | AtomView, variant : Mol::Variant = :v2000) : Nil #

Writes a structure or group of atoms to path.

The CTAB format is specified via variant: V2000 (legacy) or V3000.


[View source]