struct
Chem::ResidueView
- Chem::ResidueView
- Struct
- Value
- Object
Included Modules
- Array::Wrapper(Chem::Residue)
Defined in:
chem/core/residue_view.crInstance Method Summary
- #atoms : AtomView
- #chains : ChainView
-
#each_residue_fragment(& : ResidueView -> ) : Nil
Iterates over residue-wise fragments.
-
#each_secondary_structure(reuse : Bool | Array(Residue) = false, strict : Bool = true, handedness : Bool = true) : Iterator(ResidueView)
Returns an iterator over secondary structure elements (SSEs).
-
#each_secondary_structure(reuse : Bool | Array(Residue) = false, strict : Bool = true, handedness : Bool = true, & : ResidueView, Protein::SecondaryStructure -> ) : Nil
Iterates over secondary structure elements (SSEs), yielding both the residues and secondary structure.
- #link_bond : Templates::Bond | Nil
-
#reset_secondary_structure : self
Sets secondary structure of every residue to none.
-
#residue_fragments : Array(ResidueView)
Returns residue-wise fragments.
- #sec=(seclist : Array(Protein::SecondaryStructure)) : Array(Protein::SecondaryStructure)
- #sec=(sec : Protein::SecondaryStructure) : Protein::SecondaryStructure
-
#secondary_structures(strict : Bool = true, handedness : Bool = true) : Array(ResidueView)
TODO rename to
#chunks_by_secor#sec_chunks
Instance methods inherited from module Indexable(Chem::Residue)
[](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::Residue)
===(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_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
Iterates over residue-wise fragments.
A fragment is an array of inter-connected residues. Fragments are
dynamically computed by iterating over Residue#bonded_residues
of the selected residues.
NOTE fragments are scoped to the current list of residues such that bonded residues not contained in the list are omitted, e.g., given the list of residues [1, 2, 3, 4, 7, 8] belonging to the sequence 1-2-3-4-5-6 7-8-9, this method will return [[1, 2, 3, 4], [7, 8]], not [[1, 2, 3, 4, 5, 6], [7, 8, 9]].
TODO Rename to #each_fragment.
Returns an iterator over secondary structure elements (SSEs).
SSEs are defined as segments of consecutive, bonded residues that
have the same secondary structure. If strict is false,
residues are grouped by their secondary structure type. If
handedness is false, handedness is not taken into account when
strict is false. See Protein::SecondaryStructure#equals?.
Let's say a structure has 25 residues with two beta strands
spanning residues 3-12 and 18-23, then:
iter = structure.each_secondary_structure
iter.next.map &.number # => [1, 2]
iter.next.map &.number # => [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
iter.next.map &.number # => [13, 14, 15, 16, 17]
iter.next.map &.number # => [18, 19, 20, 21, 22, 23]
iter.next.map &.number # => [24, 25]
iter.next # => Iterator::Stop::INSTANCE
Note that non-protein residues are skipped over.
By default, a new array is created and yielded for each slice when
invoking next.
- If reuse is
false, a new array is created for each chunk. - If reuse is
true, an array is created once and reused. - If reuse is an
Array, it will be reused instead.
The latter can be used to prevent many memory allocations when each slice of interest is to be used in a read-only fashion.
TODO Rename to chunk_by_sec
Iterates over secondary structure elements (SSEs), yielding both the residues and secondary structure.
SSEs are defined as segments of consecutive, bonded residues that
have the same secondary structure. If strict is false,
residues are grouped by their secondary structure type. If
handedness is false, handedness is not taken into account when
strict is false. See Protein::SecondaryStructure#equals?.
Let's say a structure has 25 residues with two beta strands
spanning residues 3-12 and 18-23, then:
structure.each_secondary_structure do |sec, ary|
puts "#{sec.to_s} at #{ary[0].number}..#{ary[-1].number}"
end
Prints:
None at 1..2
BetaStrand at 3..12
None at 13..17
BetaStrand at 18..23
None at 24..25
Note that non-protein residues are skipped over.
By default, a new array is created and yielded for each slice when
invoking next.
- If reuse is
false, a new array is created for each chunk. - If reuse is
true, an array is created once and reused. - If reuse is an
Array, it will be reused instead.
The latter can be used to prevent many memory allocations when each slice of interest is to be used in a read-only fashion.
TODO Rename to each_chunk_by_sec
TODO yield the sec first (similar to #chunks)
Sets secondary structure of every residue to none.
TODO remove this (residues.sec = :none is clear and shorter)
Returns residue-wise fragments. See #each_residue_fragment.
TODO rename to #fragments
TODO rename to #chunks_by_sec or #sec_chunks