class

Chem::Structure::Builder

Inherits Reference / Object

Constructors

new(guess_bonds : Bool = false, guess_names : Bool = false, use_templates : Bool = false, **options)
Source

Instance methods

atom(name : String, serial : Int32, coords : Spatial::Vec3, element : Element, **options) : Atom
Source
atom(name : String, serial : Int32, coords : Spatial::Vec3, **options) : Atom
Source
atom(element : Element | Symbol, coords : Spatial::Vec3, **options) : Atom

Creates an Atom of element at the given coordinates. Extra named arguments are forwarded to the Atom constructor.

The atom name will set to the element's symbol followed by the number of atoms with the same element within the current residue.

structure = Chem::Structure.build do |builder|
  builder.residue
  builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
  builder.residue
  builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
  builder.atom Chem::PeriodicTable::N, Chem::Spatial::Vec3.zero
end
structure.atoms.map(&.name) # => ["H1", "C1", "H2", "H3", "C2", "H1", "C1", "N1"]

Note that the atom names resets on a new residue.

WARNING: This method assumes that residues are created in sequence, so calling #residue will always create a new residue, not retrieving a preceding one. Otherwise, the order of the atom names will be reset.

Source
atom(name : String, coords : Spatial::Vec3, **options) : Atom
Source
atom(index : Int) : Atom
Source
atom(coords : Spatial::Vec3, **options) : Atom
Source
atom?(index : Int) : Atom | Nil
Source
bond(name : String, other : String, order : BondOrder = :single) : Bond
Source
bond(i : Int, j : Int, order : BondOrder = :single, aromatic : Bool = false) : Bond
Source
bonds(bond_table : Hash(Tuple(Int32, Int32), BondOrder)) : Nil
Source
build
Source
cell(a : Spatial::Vec3, b : Spatial::Vec3, c : Spatial::Vec3) : Spatial::Parallelepiped
Source
cell(a : Float64, b : Float64, c : Float64) : Spatial::Parallelepiped
Source
cell(cell : Spatial::Parallelepiped | Nil)
Source
cell
Source
cell!
Source
chain(id : Char) : Chain
Source
chain
Source
chain(id : Char, & : self -> ) : Nil
Source
chain
Source
current_chain
Source
current_residue
Source
expt(expt : Structure::Experiment | Nil)
Source
residue(name : String, number : Int32, inscode : Char | Nil = nil) : Residue
Source
residue(name : String) : Residue
Source
residue
Source
residue(name : String, number : Int32, inscode : Char | Nil = nil, & : self -> ) : Nil
Source
residue(name : String, & : self -> ) : Nil
Source
secondary_structure(i : Tuple(Char, Int32, Char | Nil), j : Tuple(Char, Int32, Char | Nil), type : Protein::SecondaryStructure) : Nil
Source
secondary_structure(ri : Residue, rj : Residue, type : Protein::SecondaryStructure)
Source
title(title : String)
Source