struct Chem::AtomView

Overview

Gather, check and annotate types registering a format

Included Modules

Defined in:

chem/core/atom_view.cr
chem/register_format.cr

Instance Method Summary

Instance methods inherited from module Indexable(Chem::Atom)

[](idxs : Tuple) : Tuple
[](idxs : Enumerable(Int)) : Array(T)
[](*idxs : Int) : Tuple
[]
, sentence(io : IO, separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ", & : T, IO -> ) : Nil
sentence(io : IO, separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ") : Nil
sentence(separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ", & : T -> ) : String
sentence(separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ") : String
sentence
, to_dcd(io : IO, title : String | Nil = nil) : Nil
to_dcd(title : String | Nil = nil) : String
to_dcd(path : Path | String, title : String | Nil = nil) : Nil
to_dcd

Instance methods inherited from module Enumerable(Chem::Atom)

===(atom : Chem::Atom) : Bool
===(chain : Chem::Chain) : Bool
===(residue : Chem::Residue) : Bool
===
, average(weights : Indexable(Number))
average(weights : Indexable(Number), & : T -> _)
average
, find(pattern, if_none default = nil) find, find!(pattern) find!, mean
mean(& : T -> _)
mean
, to_dcd(io : IO, title : String | Nil = nil) : Nil
to_dcd(title : String | Nil = nil) : String
to_dcd(path : Path | String, title : String | Nil = nil) : Nil
to_dcd
, to_maestro(io : IO) : Nil
to_maestro(path : Path | String) : Nil
to_maestro : String
to_maestro
, to_mol2(io : IO) : Nil
to_mol2(path : Path | String) : Nil
to_mol2 : String
to_mol2
, to_pdb(io : IO, conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : Nil
to_pdb(conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : String
to_pdb(path : Path | String, conect conect_options : PDB::ConectOptions = PDB::ConectOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : Nil
to_pdb
, to_sdf(io : IO, variant : Mol::Variant = :v2000) : Nil
to_sdf(path : Path | String, variant : Mol::Variant = :v2000) : Nil
to_sdf(variant : Mol::Variant = :v2000) : String
to_sdf
, to_xyz(io : IO, extended : Bool = false, fields : Array(String) = [] of String) : Nil
to_xyz(extended : Bool = false, fields : Array(String) = [] of String) : String
to_xyz(path : Path | String, extended : Bool = false, fields : Array(String) = [] of String) : Nil
to_xyz

Instance Method Detail

def bonds : Array(Bond) #

[View source]
def chains : ChainView #

[View source]
def each_fragment(& : self -> ) : Nil #

[View source]
def fragments : Array(self) #

[View source]

[View source]

Sets the atom coordinates.


[View source]
def residues : ResidueView #

[View source]
def rmsd(other : self | Residue | ResidueView | Chain | ChainView | Structure | Spatial::Positions3Proxy, *, weights : Indexable(Float64) | Nil = nil, minimize : Bool = false, use_symmetry : Bool = false) : Float64 #

Returns the RMSD in Å between the enclosed atoms and other.

Delegates to Spatial.rmsd. If use_symmetry is true, atoms that belong to a residue template's symmetric_atom_groups are permuted so that they best match other before the RMSD is computed. The reference (other) is left unchanged. See #sort_by_symmetry.


[View source]
def rmsd(other : Indexable(Spatial::Vec3), *, weights : Indexable(Float64) | Nil = nil, minimize : Bool = false) : Float64 #

Returns the RMSD in Å between the enclosed atoms and other. Delegates to Spatial.rmsd.


[View source]
def sort_by_symmetry(to other : self) : self #

Returns a new view whose atoms are permuted so that known symmetric atoms best match other.

Pairing is by index: other is the reference and is never reordered. Only atoms in self are swapped. Symmetric atoms are those listed in a residue template's symmetric_atom_groups. Each group is a 2-fold interchange that must be applied all at once (e.g. phenylalanine CD1↔CD2 together with CE1↔CE2). Independent groups are enumerated locally per residue.

For each residue that contributes atoms to both views, every combination of its applicable groups is scored by the minimized (fit) RMSD of that residue's selected atoms, using in-place RMSD as a tiebreaker. The winning permutation is then used for the global atom order. Residues without a template, without symmetry, or whose symmetric atoms are missing from the view are skipped. Atoms without a parent residue are left unchanged.

Raises ArgumentError if the two views have different sizes.


[View source]
def to_a : Array(Atom) #

Returns a mutable copy of the enclosed atoms.


[View source]
def to_gen(io : IO, fractional : Bool = false) : Nil #

[View source]
def to_gen(fractional : Bool = false) : String #

[View source]
def to_gen(path : Path | String, fractional : Bool = false) : Nil #

[View source]
def to_mol(io : IO, variant : Mol::Variant = :v2000) : Nil #

[View source]
def to_mol(variant : Mol::Variant = :v2000) : String #

[View source]
def to_mol(path : Path | String, variant : Mol::Variant = :v2000) : Nil #

[View source]
def to_mol2(io : IO) : Nil #

[View source]
def to_mol2(path : Path | String) : Nil #

[View source]
def to_mol2 : String #

[View source]
def to_pdb(io : IO, 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 #

[View source]
def to_pdb(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) : String #

[View source]
def to_pdb(path : Path | String, 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 #

[View source]
def to_unsafe : Array(Atom) #

Returns the enclosed array. Mutating it changes the view's source.


[View source]
def to_xyz(io : IO, extended : Bool = false, fields : Array(String) = [] of String) : Nil #

[View source]
def to_xyz(extended : Bool = false, fields : Array(String) = [] of String) : String #

[View source]
def to_xyz(path : Path | String, extended : Bool = false, fields : Array(String) = [] of String) : Nil #

[View source]
def write(output : IO | Path | String, format : Chem::Gen.class) : Nil #

[View source]
def write(output : IO | Path | String, format : Chem::Mol.class) : Nil #

[View source]
def write(output : IO | Path | String, format : Chem::Mol2.class) : Nil #

[View source]
def write(output : IO | Path | String, format : Chem::PDB.class) : Nil #

[View source]
def write(output : IO | Path | String, format : Chem::XYZ.class) : Nil #

[View source]
def write(output : IO | Path | String, format) : Nil #

FIXME Make it compile time error. Should raise if format is not registered or format is incompatible with open_type. Better create an override with the other formats, and leave this as a fallback.


[View source]
def write(path : IO | Path | String) : Nil #

[View source]