class Chem::Chain

Included Modules

Defined in:

chem/core/chain.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(structure : Structure, id : Char) #

[View source]

Class Method Detail

def self.succ_id(id : Char | Nil = nil) : Char #

Returns the next alphanumeric chain identifier after id.

The sequence is AZ, then az, then 09. Returns 'A' if id is nil. Raises if there is no next identifier.

Chain.succ_id      # => 'A'
Chain.succ_id('A') # => 'B'
Chain.succ_id('Z') # => 'a'
Chain.succ_id('z') # => '0'

[View source]

Instance Method Detail

def <=>(rhs : self) : Int32 #

The comparison operator.

Returns -1, 0 or 1 depending on whether self precedes rhs, equals to rhs or comes after rhs. The comparison is done based on chain identifier.

chains = Structure.read("peptide.pdb").chains

chains[0] <=> chains[1] # => -1
chains[1] <=> chains[1] # => 0
chains[2] <=> chains[1] # => 1

[View source]
def [](number : Int32, insertion_code : Char | Nil = nil) : Residue #

[View source]
def []?(number : Int32, insertion_code : Char | Nil = nil) : Residue | Nil #

[View source]
def atoms : AtomView #

[View source]
def clear : self #

[View source]
def delete(residue : Residue) : Residue | Nil #

[View source]
def delete : Nil #

[View source]
def dig(number : Int32, insertion_code : Char | Nil) : Residue #

[View source]
def dig(number : Int32, insertion_code : Char | Nil, *subindexes) #

[View source]
def dig(number : Int32) : Residue #

[View source]
def dig(number : Int32, *subindexes) #

[View source]
def dig?(number : Int32, insertion_code : Char | Nil) : Residue | Nil #

[View source]
def dig?(number : Int32, insertion_code : Char | Nil, *subindexes) #

[View source]
def dig?(number : Int32) : Residue | Nil #

[View source]
def dig?(number : Int32, *subindexes) #

[View source]
def id : Char #

[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def matches?(id : Char) : Bool #

Returns true if the chain id equals the given character, else false.


[View source]
def matches?(ids : Enumerable(Char)) : Bool #

Returns true if the chain id is included in the given characters, else false.


[View source]
def polymer? : Bool #

[View source]
def renumber_residues_by(& : Residue -> _) : Nil #

Renumber residues based on the order by the output value of the block.


[View source]
def renumber_residues_by_connectivity : Nil #

Renumber residues based on bond information. Residue ordering is computed based on the link bond if available.


[View source]
def residues : ResidueView #

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

Writes the chain specification to the given IO.

Chain specification is a short string representation encoding chain information including the id.


[View source]
def spec : String #

Returns the chain specification.

Chain specification is a short string representation encoding chain information including the id.


[View source]
def structure : Structure #

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

TODO remove this nonsensical line


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

TODO remove this nonsensical line


[View source]
def succ_id : Char #

Returns the next alphanumeric chain identifier after this chain.


[View source]
def to_s(io : IO) #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]