Class: Bio::PDB::Coordinate

Inherits:
Vector
  • Object
show all
Defined in:
lib/bio/db/pdb/atom.rb

Overview

Bio::PDB::Coordinate is a class to store a 3D coordinate. It inherits Vector (in bundled library in Ruby).

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](x, y, z) ⇒ Object

same as Vector.



32
33
34
# File 'lib/bio/db/pdb/atom.rb', line 32

def self.[](x,y,z)
  super
end

.elements(array, *a) ⇒ Object

same as Vector.elements



37
38
39
40
# File 'lib/bio/db/pdb/atom.rb', line 37

def self.elements(array, *a)
  raise 'Size of given array must be 3' if array.size != 3
  super
end

Instance Method Details

#distance(object2) ⇒ Object

distance between object2.



69
70
71
72
# File 'lib/bio/db/pdb/atom.rb', line 69

def distance(object2)
  Utils::convert_to_xyz(object2)
  (self - object2).r
end

#to_aryObject

Implicit conversion to an array.

Note that this method would be deprecated in the future.

– Definition of 'to_ary' means objects of the class is implicitly regarded as an array. ++



63
# File 'lib/bio/db/pdb/atom.rb', line 63

def to_ary; self.to_a; end

#xObject

x



43
# File 'lib/bio/db/pdb/atom.rb', line 43

def x; self[0]; end

#x=(n) ⇒ Object

x=(n)



49
# File 'lib/bio/db/pdb/atom.rb', line 49

def x=(n); self[0]=n; end

#xyzObject

returns self.



66
# File 'lib/bio/db/pdb/atom.rb', line 66

def xyz; self; end

#yObject

y



45
# File 'lib/bio/db/pdb/atom.rb', line 45

def y; self[1]; end

#y=(n) ⇒ Object

y=(n)



51
# File 'lib/bio/db/pdb/atom.rb', line 51

def y=(n); self[1]=n; end

#zObject

z



47
# File 'lib/bio/db/pdb/atom.rb', line 47

def z; self[2]; end

#z=(n) ⇒ Object

z=(n)



53
# File 'lib/bio/db/pdb/atom.rb', line 53

def z=(n); self[2]=n; end