class Chem::Chain
- Chem::Chain
- Reference
- Object
Defined in:
chem/core/chain.crchem/register_format.cr
Constructors
Instance Method Summary
-
#<=>(rhs : self) : Int32
The comparison operator.
- #[](number : Int32, insertion_code : Char | Nil = nil) : Residue
- #[]?(number : Int32, insertion_code : Char | Nil = nil) : Residue | Nil
- #atoms : AtomView
- #clear : self
- #delete(residue : Residue) : Residue | Nil
- #dig(number : Int32, insertion_code : Char | Nil) : Residue
- #dig(number : Int32, insertion_code : Char | Nil, *subindexes)
- #dig(number : Int32) : Residue
- #dig(number : Int32, *subindexes)
- #dig?(number : Int32, insertion_code : Char | Nil) : Residue | Nil
- #dig?(number : Int32, insertion_code : Char | Nil, *subindexes)
- #dig?(number : Int32) : Residue | Nil
- #dig?(number : Int32, *subindexes)
- #id : Char
-
#inspect(io : IO) : Nil
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
-
#matches?(id : Char) : Bool
Returns
true
if the chain id equals the given character, elsefalse
. -
#matches?(ids : Enumerable(Char)) : Bool
Returns
true
if the chain id is included in the given characters, elsefalse
. - #polymer? : Bool
-
#renumber_residues_by(& : Residue -> _) : Nil
Renumber residues based on the order by the output value of the block.
-
#renumber_residues_by_connectivity : Nil
Renumber residues based on bond information.
- #reset_cache : Nil
- #residues : ResidueView
-
#spec(io : IO) : Nil
Writes the chain specification to the given IO.
-
#spec : String
Returns the chain specification.
- #structure : Structure
-
#structure(*args, **options)
TODO remove this nonsensical line
-
#structure(*args, **options, &)
TODO remove this nonsensical line
-
#to_gen(fractional : Bool = false) : String
Returns a string representation of the chain using the
Chem::Gen
file format. -
#to_gen(output : IO | Path | String, fractional : Bool = false) : Nil
Writes the chain to output using the
Chem::Gen
file format. -
#to_mol(variant : Chem::Mol::Variant = :v2000) : String
Returns a string representation of the chain using the
Chem::Mol
file format. -
#to_mol(output : IO | Path | String, variant : Chem::Mol::Variant = :v2000) : Nil
Writes the chain to output using the
Chem::Mol
file format. -
#to_mol2(output : IO | Path | String) : Nil
Writes the chain to output using the
Chem::Mol2
file format. -
#to_mol2 : String
Returns a string representation of the chain using the
Chem::Mol2
file format. -
#to_pdb(bonds : Chem::PDB::Writer::BondOptions = Chem::PDB::Writer::BondOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : String
Returns a string representation of the chain using the
Chem::PDB
file format. -
#to_pdb(output : IO | Path | String, bonds : Chem::PDB::Writer::BondOptions = Chem::PDB::Writer::BondOptions.flags(Het, Disulfide), renumber : Bool = true, ter_on_fragment : Bool = false) : Nil
Writes the chain to output using the
Chem::PDB
file format. -
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
-
#to_xyz(extended : Bool = false, fields : Array(String) = [] of String) : String
Returns a string representation of the chain using the
Chem::XYZ
file format. -
#to_xyz(output : IO | Path | String, extended : Bool = false, fields : Array(String) = [] of String) : Nil
Writes the chain to output using the
Chem::XYZ
file format. -
#write(output : IO | Path | String, format : Chem::Format | String) : Nil
Writes the chain to output using format.
-
#write(path : Path | String) : Nil
Writes the chain to the specified file.
Constructor Detail
Instance Method Detail
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
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>
Returns true
if the chain id equals the given character, else
false
.
Returns true
if the chain id is included in the given
characters, else false
.
Renumber residues based on the order by the output value of the block.
Renumber residues based on bond information. Residue ordering is computed based on the link bond if available.
Writes the chain specification to the given IO.
Chain specification is a short string representation encoding chain information including the id.
Returns the chain specification.
Chain specification is a short string representation encoding chain information including the id.
Returns a string representation of the chain using
the Chem::Gen
file format. Arguments are forwarded to
Chem::Gen::Writer.open
.
Writes the chain to output using the Chem::Gen
file format. Arguments are forwarded to Chem::Gen::Writer.open
.
Returns a string representation of the chain using
the Chem::Mol
file format. Arguments are forwarded to
Chem::Mol::Writer.open
.
Writes the chain to output using the Chem::Mol
file format. Arguments are forwarded to Chem::Mol::Writer.open
.
Writes the chain to output using the Chem::Mol2
file format. Arguments are forwarded to Chem::Mol2::Writer.open
.
Returns a string representation of the chain using
the Chem::Mol2
file format. Arguments are forwarded to
Chem::Mol2::Writer.open
.
Returns a string representation of the chain using
the Chem::PDB
file format. Arguments are forwarded to
Chem::PDB::Writer.open
.
Writes the chain to output using the Chem::PDB
file format. Arguments are forwarded to Chem::PDB::Writer.open
.
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>
Returns a string representation of the chain using
the Chem::XYZ
file format. Arguments are forwarded to
Chem::XYZ::Writer.open
.
Writes the chain to output using the Chem::XYZ
file format. Arguments are forwarded to Chem::XYZ::Writer.open
.
Writes the chain to output using format. Raises
ArgumentError
if format has required arguments or cannot
write Chem::Chain
.
The supported file formats are Chem::Gen
, Chem::Mol2
, Chem::Mol
, Chem::PDB
, Chem::XYZ
. Use the
#to_*
methods to customize how the object is written in the
corresponding file format if possible.
Writes the chain to the specified file. The file
format is chosen based on the filename (see
Chem::Format#from_filename
). Raises ArgumentError
if the
file format cannot be determined.
The supported file formats are the following:
Chem::Gen
(.gen)Chem::Mol
(.mol)Chem::Mol2
(.mol2)Chem::PDB
(.ent, .pdb)Chem::XYZ
(.xyz)
Use the #to_*
methods to customize how the object is written
in the corresponding file format if possible.