module Chem::PDB

Defined in:

chem/formats/pdb.cr

Class Method Summary

Class Method Detail

def self.each(io : IO, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true, & : Structure -> ) : Nil #

Yields each structure in io.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.each(path : Path | String, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true, & : Structure -> ) : Nil #

Yields each structure in path.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.read(io : IO, info : PDB::Info | Nil = nil, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true) : Structure #

Returns the next structure from io. Raises IO::EOFError when there are no more structures. Use .read_all or .each for multiple.

Experimental and structural data specified in the header is set from info. If info is nil and io is at the beginning, the header is read first.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.read(path : Path | String, info : PDB::Info | Nil = nil, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true) : Structure #

Returns the next structure from path. Raises IO::EOFError when there are no more structures. Use .read_all or .each for multiple.

Experimental and structural data specified in the header is set from info. If info is nil and path is at the beginning, the header is read first.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.read_all(io : IO, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true) : Array(Structure) #

Returns all structures in io.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.read_all(path : Path | String, alt_loc : Char | Nil = nil, chains : Enumerable(Char) | String | Nil = nil, guess_bonds : Bool = false, het : Bool = true) : Array(Structure) #

Returns all structures in path.

If passed, only chains in chains will be read, otherwise all chains will be read. Similarly, HET atoms can be excluded by setting het to false.

If the structure has alternate locations, only the most populated one will be read unless alt_loc is set.


[View source]
def self.read_header(io : IO) : Structure::Experiment #

Returns the experimental information from the header of io.

TODO Remove in favor of .read_info.


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

Returns the experimental information from the header of path.

TODO Remove in favor of .read_info.


[View source]
def self.read_info(io : IO) : Info #

Returns the info from io. It must be called at the beginning of the PDB content and before reading structures via .read.


[View source]
def self.read_info(path : Path | String) : Info #

Returns the info from path. It must be called at the beginning of the PDB content and before reading structures via .read.


[View source]
def self.write(io : IO, struc : AtomView | Structure, conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false, include_header : Bool = true, include_end : Bool = true) : Nil #

Writes one or more structures or groups of atoms to io.

Atom numbering starts from 1 and increments sequentially if renumber is true, otherwise the atom numbers are written as is.

CONECT records are written for HET residues and disulfide bridges only, but can be changed using conect. TER records are written for each fragment if ter_on_fragment is true.

If include_header is true, the experimental data, secondary structure, unit cell, and other information is written if available. If include_end is true, the END record is written at the end of the output.


[View source]
def self.write(io : IO, structures : Enumerable(Structure), conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : Nil #

Writes one or more structures or groups of atoms to io.

Atom numbering starts from 1 and increments sequentially if renumber is true, otherwise the atom numbers are written as is.

CONECT records are written for HET residues and disulfide bridges only, but can be changed using conect. TER records are written for each fragment if ter_on_fragment is true.

If include_header is true, the experimental data, secondary structure, unit cell, and other information is written if available. If include_end is true, the END record is written at the end of the output.


[View source]
def self.write(path : Path | String, struc : AtomView | Structure, conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false, include_header : Bool = true, include_end : Bool = true) : Nil #

Writes one or more structures or groups of atoms to path.

Atom numbering starts from 1 and increments sequentially if renumber is true, otherwise the atom numbers are written as is.

CONECT records are written for HET residues and disulfide bridges only, but can be changed using conect. TER records are written for each fragment if ter_on_fragment is true.

If include_header is true, the experimental data, secondary structure, unit cell, and other information is written if available. If include_end is true, the END record is written at the end of the output.


[View source]
def self.write(path : Path | String, structures : Enumerable(Structure), conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : Nil #

Writes one or more structures or groups of atoms to path.

Atom numbering starts from 1 and increments sequentially if renumber is true, otherwise the atom numbers are written as is.

CONECT records are written for HET residues and disulfide bridges only, but can be changed using conect. TER records are written for each fragment if ter_on_fragment is true.

If include_header is true, the experimental data, secondary structure, unit cell, and other information is written if available. If include_end is true, the END record is written at the end of the output.


[View source]