class Chem::Structure

Included Modules

Defined in:

chem/core/structure.cr
chem/io/reader.cr
chem/io/writer.cr

Constructors

Instance Method Summary

Instance methods inherited from module Chem::ResidueCollection

each_residue : Iterator(Residue)
each_residue(&block : Residue -> )
each_residue
, each_residue_fragment(& : ResidueView -> ) : Nil each_residue_fragment, each_secondary_structure(reuse : Bool | Array(Residue) = false, strict : Bool = true, handedness : Bool = true) : Iterator(ResidueView)
each_secondary_structure(reuse : Bool | Array(Residue) = false, strict : Bool = true, handedness : Bool = true, & : ResidueView, Protein::SecondaryStructure -> ) : Nil
each_secondary_structure
, link_bond : Topology::BondType | Nil link_bond, n_residues : Int32 n_residues, reset_secondary_structure : self reset_secondary_structure, residue_fragments : Array(ResidueView) residue_fragments, residues : ResidueView residues, sec=(seclist : Array(Protein::SecondaryStructure)) : Array(Protein::SecondaryStructure)
sec=(sec : Protein::SecondaryStructure) : Protein::SecondaryStructure
sec=
, secondary_structures(strict : Bool = true, handedness : Bool = true) : Array(ResidueView) secondary_structures

Instance methods inherited from module Chem::ChainCollection

chains : ChainView chains, each_chain : Iterator(Chain)
each_chain(&block : Chain -> )
each_chain
, n_chains : Int32 n_chains

Instance methods inherited from module Chem::AtomCollection

atoms : AtomView atoms, bonds : Array(Bond) bonds, coords : Spatial::CoordinatesProxy coords, each_atom : Iterator(Atom)
each_atom(&block : Atom -> )
each_atom
, each_fragment(& : AtomView -> ) : Nil each_fragment, formal_charge : Int32 formal_charge, formal_charges : Array(Int32) formal_charges, fragments : Array(AtomView) fragments, has_hydrogens? : Bool has_hydrogens?, n_atoms : Int32 n_atoms, to_gen(output : ::IO | Path | String, *args, **options) : Nil
to_gen(*args, **options) : String
to_gen
, to_mol2(output : ::IO | Path | String, *args, **options) : Nil
to_mol2(*args, **options) : String
to_mol2
, to_pdb(output : ::IO | Path | String, *args, **options) : Nil
to_pdb(*args, **options) : String
to_pdb
, to_poscar(output : ::IO | Path | String, *args, **options) : Nil
to_poscar(*args, **options) : String
to_poscar
, to_xyz(output : ::IO | Path | String, *args, **options) : Nil
to_xyz(*args, **options) : String
to_xyz

Constructor Detail

def self.build(guess_topology : Bool = true, &) : self #

[View source]
def self.from_gen(input : ::IO | Path | String, *args, **options) : self #

[View source]
def self.from_mol2(input : ::IO | Path | String, *args, **options) : self #

[View source]
def self.from_pdb(input : ::IO | Path | String, *args, **options) : self #

[View source]
def self.from_poscar(input : ::IO | Path | String, *args, **options) : self #

[View source]
def self.from_xyz(input : ::IO | Path | String, *args, **options) : self #

[View source]
def self.read(path : Path | String, guess_topology : Bool = true) : self #

[View source]
def self.read(input : ::IO | Path | String, format : IO::FileFormat | String, guess_topology : Bool = true) : self #

[View source]

Instance Method Detail

def [](*args, **options) #

[View source]
def [](*args, **options, &) #

[View source]
def []?(*args, **options) #

[View source]
def []?(*args, **options, &) #

[View source]
def biases : Array(Chem::Bias) #

[View source]
def clear : self #

[View source]
def clone : self #

Returns a deep copy of self, that is, every chain/residue/atom is copied.

Unlike array-like classes in the language, #dup (shallow copy) is not possible.

structure = Structure.new "/path/to/file.pdb"
other = structure.clone
other == structure     # => true
other.same?(structure) # => false

structure.dig('A', 23, "OG").partial_charge         # => 0.0
other.dig('A', 23, "OG").partial_charge             # => 0.0
structure.dig('A', 23, "OG").partial_charge = 0.635 # => 0.635
other.dig('A', 23, "OG").partial_charge             # => 0.0

[View source]

[View source]
def delete(ch : Chain) : Chain | Nil #

[View source]
def dig(id : Char) : Chain #

[View source]
def dig(id : Char, *subindexes) #

[View source]
def dig?(id : Char) : Chain | Nil #

[View source]
def dig?(id : Char, *subindexes) #

[View source]
def each_atom : Iterator(Atom) #

[View source]
def each_atom(&block : Atom -> ) #

[View source]
def each_chain : Iterator(Chain) #

[View source]
def each_chain(&block : Chain -> ) #

[View source]
def each_residue : Iterator(Residue) #

[View source]
def each_residue(&block : Residue -> ) #

[View source]
def empty? #

[View source]
def experiment : Structure::Experiment | Nil #

[View source]
def experiment=(experiment : Structure::Experiment | Nil) #

[View source]
def inspect(io : ::IO) #

[View source]
def lattice : Lattice | Nil #

[View source]
def lattice=(lattice : Lattice | Nil) #

[View source]
def n_atoms : Int32 #

[View source]
def n_chains : Int32 #

[View source]
def n_residues : Int32 #

[View source]
def periodic? : Bool #

[View source]
def renumber_by_connectivity(split_chains : Bool = true) : Nil #

Renumber chain and residues based on bond information.

Residue fragments are assigned to unique chains unless split_chains is false, which keeps existing chains intact. Residue ordering is computed based on the link bond if available.

NOTE existing chains are reused to re-arrang the residues among them, so avoid caching them before calling this.


[View source]
def sequence : Protein::Sequence | Nil #

[View source]
def sequence=(sequence : Protein::Sequence | Nil) #

[View source]
def title : String #

[View source]
def title=(title : String) #

[View source]
def to_pymol(output : ::IO | Path | String, *args, **options) : Nil #

[View source]
def to_pymol(*args, **options) : String #

[View source]
def to_s(io : ::IO) #

[View source]
def to_stride(output : ::IO | Path | String, *args, **options) : Nil #

[View source]
def to_stride(*args, **options) : String #

[View source]
def to_vmd(output : ::IO | Path | String, *args, **options) : Nil #

[View source]
def to_vmd(*args, **options) : String #

[View source]
def unwrap : self #

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

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

[View source]