Chem::Structure::Builder
Inherits Reference / Object
Constructors
new(guess_bonds : Bool = false, guess_names : Bool = false, use_templates : Bool = false, **options)
SourceInstance methods
atom(name : String, serial : Int32, coords : Spatial::Vec3, element : Element, **options) : Atom
Sourceatom(name : String, serial : Int32, coords : Spatial::Vec3, **options) : Atom
Sourceatom(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.
atom(name : String, coords : Spatial::Vec3, **options) : Atom
Sourceatom(index : Int) : Atom
Sourceatom(coords : Spatial::Vec3, **options) : Atom
Sourceatom?(index : Int) : Atom | Nil
Sourcebond(name : String, other : String, order : BondOrder = :single) : Bond
Sourcebond(i : Int, j : Int, order : BondOrder = :single, aromatic : Bool = false) : Bond
Sourcebonds(bond_table : Hash(Tuple(Int32, Int32), BondOrder)) : Nil
Sourcebuild
Sourcecell(a : Spatial::Vec3, b : Spatial::Vec3, c : Spatial::Vec3) : Spatial::Parallelepiped
Sourcecell(a : Float64, b : Float64, c : Float64) : Spatial::Parallelepiped
Sourcecell(cell : Spatial::Parallelepiped | Nil)
Sourcecell
Sourcecell!
Sourcechain
Sourcechain
Sourcecurrent_chain
Sourcecurrent_residue
Sourceexpt(expt : Structure::Experiment | Nil)
Sourceresidue(name : String) : Residue
Sourceresidue
Sourceresidue(name : String, & : self -> ) : Nil
Sourcesecondary_structure(i : Tuple(Char, Int32, Char | Nil), j : Tuple(Char, Int32, Char | Nil), type : Protein::SecondaryStructure) : Nil
Sourcesecondary_structure(ri : Residue, rj : Residue, type : Protein::SecondaryStructure)
Sourcetitle(title : String)
Source