module
Chem::Maestro
Overview
This module provides support for reading and writing Schrödinger
Maestro files (.mae, .maegz, .mae.gz).
The layout follows maeparser: a file is a token stream of
nested blocks, and each structure is an f_m_ct block. Atoms and
bonds live in indexed m_atom[N] / m_bond[N] blocks with 1-based
indexes. Bond rows are stored in one direction; files that list both
directions are accepted and de-duplicated.
Multi-entry files are read with .each / .read_all and written as
successive f_m_ct blocks. Path overloads decompress or compress
.maegz and .mae.gz. Chem.read("file.mae.gz") selects this format
because extensions are matched as a filename suffix.
<> is undefined: it is omitted from metadata and does not overwrite
typed field defaults. Title and CRYST1 stay on Structure#title and
#cell, not metadata. Extra columns are stored as metadata; on write,
keys that are not already Maestro property names are emitted as
{b|i|r|s}_user_<name>.
Atom names prefer s_m_pdb_atom_name, then s_m_atom_name. Residue
atoms without a name use {element}{index}. Bonds of order 4 are
Kekulized on read. Formal charges and bonds come from the file.
WARNING Basic support only. Stereo, display, and other advanced blocks are stored as metadata or skipped.
Defined in:
chem/formats/maestro.crConstant Summary
-
BLOCK_BEGINNING =
'{' -
BLOCK_END =
'}' -
DELIMITER =
":::" -
EMPTY_FIELD =
"<>" -
PROPERTY_NAME_REGEX =
/^[birs]_[a-zA-Z0-9]+_.+$/
Class Method Summary
-
.each(io : IO, source_file : Path | String | Nil = nil, & : Structure -> ) : Nil
Yields each structure in io.
-
.each(path : Path | String, & : Structure -> ) : Nil
Yields each structure in path.
-
.read(io : IO, source_file : Path | String | Nil = nil) : Structure
Returns the next structure from io.
-
.read(path : Path | String) : Structure
Returns the first structure in path.
-
.read_all(io : IO, source_file : Path | String | Nil = nil) : Array(Structure)
Returns all structures in io.
-
.read_all(path : Path | String) : Array(Structure)
Returns all structures in path.
-
.write(io : IO, struc : Structure) : Nil
Writes struc to io.
-
.write(io : IO, entries : Enumerable(Structure)) : Nil
Writes each structure in entries to io as successive
f_m_ctblocks. -
.write(path : Path | String, struc : Structure) : Nil
Writes struc to path.
-
.write(path : Path | String, entries : Enumerable(Structure)) : Nil
Writes each structure in entries to path.
Class Method Detail
Yields each structure in io.
Yields each structure in path.
Compressed .maegz and .mae.gz files are decompressed.
Returns the first structure in path.
Compressed .maegz and .mae.gz files are decompressed.
Returns all structures in io.
Returns all structures in path.
Compressed .maegz and .mae.gz files are decompressed.
Writes each structure in entries to io as successive f_m_ct blocks.
Writes struc to path.
Compressed .maegz and .mae.gz files are gzip-compressed.
Writes each structure in entries to path.
Compressed .maegz and .mae.gz files are gzip-compressed.